Is there any way to force a temperature reading refresh on a device? I am running a space heater and would like 15 min refresh when I enable my heater control, but would like to back off the refresh rate when it isn’t enabled.
I will assume you want to do this using NodeRed (NR) correct?
In any event I am doing something similar here with my commsrack temp sensor fans in the garage. There will be many ways to achieve what you want to do though this is one option. Another way to do this instead of polling would be to allow the sensor to check in say every 30secs (if that’s standard) but drop anything before the 15 min window.
Also, to add the extra bit for you to be able to only do this when the heater is running you could add in a switch node and simply filter on if the space heater is running so if it’s not then nothing will happen or add other conditions. Again, there is a few ways you could set this up though.
If you are running z2m then you can send a “get” to a topic to refresh it PROVIDED there is a converter in place for said device AND the converter is setup to respond to the “get” for the attribute you wish to refresh. There is more info in the z2m docs. The examples there all use “state” as the attribute so just substitute “temperature”. If temperature is not supported for "get"ing a red pop-up will appear on the z2m page in your browser.
I recently had the same issue with Iman Haryadi’s environment sensor and I can’t say that I’m fully satisfied with the response. With the 1.28 release I now have that specific attribute "get"able but I was asking for a generic way so that all attributes on all devices could be "get"ed, er "got"ed, heck, you know what I mean.
Battery powered Zigbee temperature sensors with a firmware which follows the standard 100% (many don’t) can be configured with a minimum refresh time coupled with a minimum change limit, eg 0.5C change. Then set the max report time to a higher level. This way when there are changes they are reported quickly, if the temperature remains stable the temperature is only reported at the max time.
What I describe above is NOT something which always works and can drain the battery of many devices which doesn’t implement this correctly, but if you have a device which does this right, it’d be better than polling (which may not work anyway since battery powered devices tend to not check for polls very often, if ever).
Then there’s the route of getting a DS18B20 temp sensor (or multiple on the same wire, they use the 1-wire protocol for those who care). They exist as separate chips, but also as prebuilt wires. Connect this type of sensor to an ESP32 flashed with ESPHome and you can have a continuous stream of data sent straight into MQTT.
The issue I am trying to fix is I like to add Deadman switches with heater controls. So if I don’t see a report for 30 min, turn off the heater. When the heater control is not enabled, I don’t care if it reports for hours… That way I can maximize battery life. I could also be convinced on a plug in temp sensor…
With a properly configured zigbee sensor as I described above you could set a 30 min timer from last report with change. If there is no change, it won’t report. If it reports the same value due to just doing a checkin, you could ignore that and not reset the timer.
That’s what the max report time is for, unless you have a lot of temperature fluctuations without turning on the heat, draining the battery won’t be an issue. All this is if you have a temp sensor which actually follows these settings, not all do.
NOW this makes sense to me. In other systems the failure to poll is ignored. If you set up a poll and watch the logs, you’ll see the failures. This polling is only going to logically work if the device is already awake. I have the iris v2’s and found out the hard way about polling these on the other systems. I would suggest a aeotec multisensor 6. I have a few of them and they’re chatty Kathies and would work perfectly for your use case. Paired on mains power, they also actively repeat. But, you’d have to be on Z-Wave for that. Or go with an aqara temperature sensor they’re more reliable as long as they’re set up correctly. The new P1 3.0 sensors.