The Nest Thermostat device will display on-screen if it's 'cooling' or 'heating'. How do I get this state through the Nest API?
The hvac_mode
property seems to simply show what the user's Thermostat is capable of controlling and doesn't change when either cooling or heating occurs.
For now, I'm using a simple but not flawless logic:
if (can_cool && target_temperature < ambient_temperature) --> isCooling
if (can_heat && target_temperature > ambient_temperature) --> isHeating
else --> isDoingNothing
By not flawless, I mean that I've encountered situations where this logic is incorrect. For example, in a given situation where the ambient_temperature
is 20 Celsius
and the target_temperature
is 21 Celsius
with can_heat
set to true
, my UI will say the Thermostat is heating, while it actually isn't.
This is probably because target and ambient temperatures are too close, but I don't know what the threshold is.
Is there another or better way to figure out heating and cooling states?
Your system will either heat or cool to try to keep your home within the temperature range you've manually set. Your thermostat will automatically switch your system between heating and cooling as needed to meet any scheduled temperatures or a temperature that you've manually selected.
For heating, turn up the target temperature until it turns orange. For cooling, turn it down until it turns blue. Wait about 5 minutes and check the air coming from the vents, radiators, or whatever your system uses.
Your thermostat's temperature screen will often show you two different temperatures: The large target temperature in the middle of the thermostat screen is the temperature that your thermostat was set to either manually or automatically by your temperature schedule.
To select this setting, highlight over HEAT-COOL and press. In this setting, you set the temperature range that you want to keep your home between, and the thermostat will automatically switch between heating and cooling as needed.
As of May 2015, the Nest API now officially reports the hvac_state property. The value will be one of either 'heating','cooling' or 'off'.
New fields in the data model: hvac_state. You'll use hvac_state to learn if the home HVAC system is actively heating, cooling or is off.
Looking at the API, they don't provide any way of identifying if the thermostat is actually heating. The closest you can get to identify is what you currently have written.
If the device itself is capable of displaying it's heating or cooling, they must have different code or different methods (such as internal electronics) for identifying that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With