I'm working on a project for sending sensor data to the tangle and up to now I've managed to do the following
- Collect environment data from a sensor attached to a Raspberry Pi
- Send that data via MQTT
- Set up a linux client subscribed to the MQTT channel where I have installed a IOTA light wallet. In this machine i have got 2 running programms:
- One stores sensor data in a MySQLdb database
- With the other one i pretend to compute a 5 minute statistic summary of the data and send it to the tangle. Im currently using Pandas to compute that summary, concretely the method df.describe() provides just what I need (mean, max, min, std).
I've previously managed to send data to the tangle by converting it to JSON and coding that string to trytes with the TryteString.from_string() method. The problem I'm currenty facing is that the object returned by the describe method is a series and it is no JSONizable. I'm getting this error: TypeError: Object of type 'Series' is not JSON serializable
So my questions are:
- Does anyone know how can I convert that series object in a dictionary which I then convert to JSON? (already tried dict() and .to_dict() and no working)
- Any other idea of how can I send the summary? Or maybe other to way to compute the summary in other JSONizable way?
- I'm currently generating and attaching the addresses manually, I've seen that there's a method for generating addresses with the API. Are those addresses automatically attached to the tangle?
- How can i "subscribe" to the messages sent to the tangle? I'm currently manually searching them by the address in www.thetangle.org and i would like to automate more the process.
- Also I would like to implement MAM, Do you know any resources or docs from where study how it works with Python?