I have a data stream, for whatever reason is best sent as two values, separated by a comma.
Is there any way to separate them into two feeds?
Roger
Can data sent to AIO be parsed?
Moderators: adafruit_support_bill, adafruit
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
- mikeysklar
- Posts: 13936
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Can data sent to AIO be parsed?
Roger,
There is a temperature humidity example here you can customize to your needs.
https://github.com/adafruit/Adafruit_IO ... umidity.py
There is a temperature humidity example here you can customize to your needs.
https://github.com/adafruit/Adafruit_IO ... umidity.py
Code: Select all
while True:
humidity, temperature = Adafruit_DHT.read_retry(dht22_sensor, DHT_DATA_PIN)
if humidity is not None and temperature is not None:
print('Temp={0:0.1f}*C Humidity={1:0.1f}%'.format(temperature, humidity))
# Send humidity and temperature feeds to Adafruit IO
temperature = '%.2f'%(temperature)
humidity = '%.2f'%(humidity)
aio.send(temperature_feed.key, str(temperature))
aio.send(humidity_feed.key, str(humidity))
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.