I recently updated my Nest binding and encountered an issue with my rule for adjusting thermostat targets. The rule worked perfectly before the update, but now it’s causing errors. It seems the item types for the Nest binding have changed, leading to mismatched data types in my calculations. Here’s what I’ve observed:
- Target Values: The target temperature values are still correct, but when I try to adjust them using a local constant, the results are way off and exceed API limits.
markdown
Example of the Rule
rule “Adjust Nest Thermostat Targets” {
when {
Item gInTown changed
}
then {
val Number TARGET_ADJUST = 3.0
logInfo(“my_log”, “Adjust Nest Thermostat Targets - Nest max = {}”, TargetTemperatureMax.state)
logInfo(“my_log”, “Adjust Nest Thermostat Targets - Nest min = {}”, TargetTemperatureMin.state)
var TargetMax = TargetTemperatureMax.state as Number
var TargetMin = TargetTemperatureMin.state as Number
logInfo("my_log", "Adjust Nest Thermostat Targets - TargetMax = {}", TargetMax)
logInfo("my_log", "Adjust Nest Thermostat Targets - TargetMin = {}", TargetMin)
if (nestStructureAway.state == "HOME") {
if (gInTown.state == OFF) {
TargetMax = TargetMax + TARGET_ADJUST
TargetMin = TargetMin - TARGET_ADJUST
} else {
if ((TargetMax - TargetMin) >= (3.0 + (2 * TARGET_ADJUST))) {
TargetMax = TargetMax - TARGET_ADJUST
TargetMin = TargetMin + TARGET_ADJUST
}
}
}
logInfo("my_log", "Adjust Nest Thermostat Targets - Adj. TargetMax = {}", TargetMax)
logInfo("my_log", "Adjust Nest Thermostat Targets - Adj. TargetMin = {}", TargetMin)
if (TargetTemperatureMax.state != TargetMax) {
TargetTemperatureMax.sendCommand(TargetMax)
}
if (TargetTemperatureMin.state != TargetMin) {
TargetTemperatureMin.sendCommand(TargetMin)
}
}
}
Logs Showing the Issue
[INFO ] [pse.smarthome.model.script.SPT_house] - Adjust Nest Thermostat Targets - Nest max = 76.0 °F
[INFO ] [pse.smarthome.model.script.SPT_house] - Adjust Nest Thermostat Targets - Nest min = 72.0 °F
[INFO ] [pse.smarthome.model.script.SPT_house] - Adjust Nest Thermostat Targets - TargetMax = 76.0 °F
[INFO ] [pse.smarthome.model.script.SPT_house] - Adjust Nest Thermostat Targets - TargetMin = 72.0 °F
[INFO ] [pse.smarthome.model.script.SPT_house] - Adjust Nest Thermostat Targets - Out of town temperatures
[INFO ] [pse.smarthome.model.script.SPT_house] - Adjust Nest Thermostat Targets - Adj. TargetMax = 300.5944444444444444444444444444444
[INFO ] [pse.smarthome.model.script.SPT_house] - Adjust Nest Thermostat Targets - Adj. TargetMin = 292.3722222222222222222222222222222
Errors
[WARN ] [t.internal.handler.NestBridgeHandler] - Nest API error: Temperature F value is too high: 301.0
[WARN ] [t.internal.handler.NestBridgeHandler] - Nest API error: Cannot set target low temperature ‘292.0’ higher than target high temperature ‘76.0’
My Thoughts
It looks like the data types aren’t being handled correctly after the binding update. The adjustments are causing the values to go way beyond the expected range. I need to ensure that the calculations are using the correct data types and that the adjustments are within valid limits.
If anyone has experience with similar issues or knows how to properly handle these data type conversions, I’d greatly appreciate your insights! Let’s figure this out together.