Trying to send Sauna temp to Thingspeak
Posted: 08 Sep 2019, 20:14
Hello!
I have a 18650 battery operated wemos D1 in an enclosure in bathroom and the ds18b20 temp sensor goes to sauna.
I am using analog input along with the temp sensor, for reading battery voltage.
Instead of reading and publishing sauna temperature to Thingspeak in a fixed interval, I would like to make the temperature determine if values are sent in a slow or fast interval.
Because, when sauna is not in use, it is about 25 degrees and something like 15 minute interval is enough.
And then when sauna is turned on to heat up, the temp sensor will soon see a rise in temperature, and after +30 degrees, the interval should change to updating every 1 minute.
After sauna is shut down, and temperature drops below 30 degrees, the update interval should be 15 minutes again.
Also, when ever possible, wemos should be sleeping.
So far, I have no luck.
I´m either locked out of the web interface because of immeadiate sleeping, or things seem to work but no values are sent to ThingsPeak.
This is my latest Rule arrangement:
I have a 18650 battery operated wemos D1 in an enclosure in bathroom and the ds18b20 temp sensor goes to sauna.
I am using analog input along with the temp sensor, for reading battery voltage.
Instead of reading and publishing sauna temperature to Thingspeak in a fixed interval, I would like to make the temperature determine if values are sent in a slow or fast interval.
Because, when sauna is not in use, it is about 25 degrees and something like 15 minute interval is enough.
And then when sauna is turned on to heat up, the temp sensor will soon see a rise in temperature, and after +30 degrees, the interval should change to updating every 1 minute.
After sauna is shut down, and temperature drops below 30 degrees, the update interval should be 15 minutes again.
Also, when ever possible, wemos should be sleeping.
So far, I have no luck.
I´m either locked out of the web interface because of immeadiate sleeping, or things seem to work but no values are sent to ThingsPeak.
This is my latest Rule arrangement:
Code: Select all
on Wifi#Connected do
if [Sauna#Temperature]>30
sendToHTTP api.thingspeak.com,80,/update?key=XXXXXXXXXXXXXXX&field7=[Sauna#Temperature]
timerSet,1,16 //Set Timer 1 for the next event in 16 seconds
on Rules#Timer=1 do //When Timer1 expires, do
sendToHTTP api.thingspeak.com,80,/update?key=XXXXXXXXXXXXXXX&field8=[akku#percentage]
timerSet,1,0
delay 10000 //lähetetään tietoa 60 sek välein
deepsleep,60 //Sauna is heating, so going for short sleep
endif
if [Sauna#Temperature]<30
sendToHTTP api.thingspeak.com,80,/update?key=XXXXXXXXXXXXXXX&field7=[Sauna#Temperature]
timerSet,2,16 //Set Timer 1 for the next event in 15 seconds
endon
on Rules#Timer=2 do //When Timer1 expires, do
sendToHTTP api.thingspeak.com,80,/update?key=XXXXXXXXXXXXXXX&field8=[akku#percentage]
timerSet,2,0
delay 20000 //delay just for fun
deepsleep,900 //sauna was cold, going for a longer sleep
endif
endon