Parse this comma separated string to find GPIO pins on which we must
enable DHT sensors. Seperators are space and comma.
Can be empty, single GPIO pins, or a list:
app.dht_gpio=""
app.dht_gpio="5"
app.dht_gpio="5,4,14"
app.dht_gpio="5 4 14"
app.dht_gpio="5, 4 14"
s_dht is a list of MAX_DHT elements. Pass the index to the callback
so we can report on individual sensors by 0-based index.
Mon Feb 12 18:26:12 2018 - esp8266_052EE8/stat/dht {"idx":0, "temp":18.80, "humidity":31.6}
Mon Feb 12 18:26:12 2018 - esp8266_052EE8/stat/dht {"idx":1, "temp":18.70, "humidity":36.4}
Mon Feb 12 18:26:12 2018 - esp8266_052EE8/stat/dht {"idx":2, "temp":18.80, "humidity":39.5}
Very rough stab just to test the waters -- this will need some
more work.
For now, hard code 4,5,15 pins (as per Sonoff SV), but before
rolling this out, add a config flag for this behavior.
Neat trick -- the presence of dht library in mos.yml triggers
inclusion of the code via define -DMGOS_HAVE_DHT=1
- Refactor mqtt_publish_stat() to take va_list
- Make publish_stat format its response with json_vprintf() so it is
valid JSON.
- Call publish_stat in channel_set, the only place where the GPIO state
changes
- Return (valid) JSON response in all RPCs