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?
  • Hi Victor, Stack Exchange generally favors a focused one question per question approach. Thus, it would be good—and likely result in better answers if you focus on one question tackling one problem at a time.
    – Helmar
    Apr 24, 2018 at 15:28

1 Answer 1

  1. Never used Pandas, you probably have to ask elsewhere to get an answer how to serialize your object

  2. There are two methods of generating addresses. There is one way to generate the next free address (which you can attach to the tangle automatically), or you can generate an address by index (which will not attach it automatically). Anyway, as soon as you send a transaction to the address, it will be attached by that transaction, so in M2M scenarios there is usually no need for attaching your addresses manually.

  3. Use the findTransactions API to find your transactions (by address or tag).

  4. Not using python myself, but perhaps tracking this issue helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.