Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problems saving data and date
01-25-2017, 02:47 AM
Post: #1
Problems saving data and date
Hello everyone!

I'm using Lizard-swap running on a RPi with a panStick as modem and 3 panStamp for the moment just sending the Id and Voltage.

I have modified the SwapManager.py file to create a .txt and store the id of the panStamp every time I receive a notification on the modem. The problem is that I keep them in a row, the code is:

file = open("Prueba.txt", "a")
file.write(str(endpoints.RegAddress()) + "\n")
file.close()

I would also like to save the date and time of arrival of each notification, but I do not know where I can get those data.

A greeting.
Thank you.
Find all posts by this user
Quote this message in a reply
01-25-2017, 04:14 AM
Post: #2
RE: Problems saving data and date
Hi @Davvid_,

Why not simply log the MQTT packet transmitted by lagarto? You can do it from an external software like node-red. Otherwise you'll probably want to put your code into swapPacketReceived. It's not currently being used by SwapManager but you can add it any time. It's defined from pyswap/swap/SwapInterface.py.

In any case, I recommend you to do the log from the outside.

Daniel Berenguer
http://www.panstamp.com
Visit this user's website Find all posts by this user
Quote this message in a reply
01-26-2017, 02:20 AM
Post: #3
RE: Problems saving data and date
Hello Daniel

I do not understand what you want to tell me.

What I try to do is a totally autonomous system without internet connection. Therefore, what I intend is to store the data of a sensor in a file along with the time and date of activation of said sensor.

That is why I want to be able to take the data and parse so that I can interpret them better when accessing the file with the data.

I do not know if you understand what I want to do.

A greeting.
Thank.
Find all posts by this user
Quote this message in a reply
01-26-2017, 04:16 AM
Post: #4
RE: Problems saving data and date
Well, you don't need to have an Internet connection to work with MQTT. You can simply run it in your LAN. Otherwise, try the hack explained in my precedent e-mail (swapPacketReceived is your callback function in SwapManager).

Daniel Berenguer
http://www.panstamp.com
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)