worknenjoy/ahorta

Set parameters for the micropython script that will run on device

alexanmtz opened this issue · 0 comments

Description

The project is an Open Source Plant as a service, that send from a sensor data about some plant humidity. It's a NodeMCU controller originally in Lua that we can change the Firmware to use MicroPython.

We have a script python that was sent to this controller and and node server running on Heroku. So, because this the Python script that you will work cannot be tested, but it should be simple and straightforward to check if this is working by looking on the code based on this current that already works.

We have a script using MicroPython (please read the documentation about how it works on microcontroller)

https://github.com/worknenjoy/ahorta/blob/master/device/main.py

This scripts runs fine and will run when the device is on. It reads the value of the sensor and send to the endpoint from 1 to 1 hour (3600000 ms).

We will need some changes to allow the device to deal with different parameters that is returned from the endpoint, so thats it how should work:

  1. Make a request with a token to a endpoint that will return some device data (period, ssid, password), based on the input (token and device id)
  2. This device data should be used in the rest of the script

The endpoint to obtain the script data is:
https://ahorta.herokuapp.com/sensor?secret=%s&deviceid=%s

So the device should have a deviceid that will be a given name (like thefirstplant)

To send the solution

  1. You should fork the project
  2. Work on the code and make the changes need
  3. Push to your repository
  4. Create a Pull Request