diff --git a/drivers/esphome_climate/driver.lua b/drivers/esphome_climate/driver.lua
index 7c8c7fb..0c49ec8 100644
--- a/drivers/esphome_climate/driver.lua
+++ b/drivers/esphome_climate/driver.lua
@@ -155,9 +155,10 @@ local function getEntityTempStep()
return ENTITY.visual_target_temperature_step or ENTITY.target_temperature_step or 0.5
end
---- Valid C4 setpoint resolutions per the thermostatV2 proxy docs.
-local VALID_RESOLUTIONS_C = { 0.5, 1, 2, 5 }
-local VALID_RESOLUTIONS_F = { 0.5, 1, 2, 5 }
+--- Valid C4 temperature resolutions per the thermostatV2 proxy docs.
+--- F floor is 0.2; C has no documented floor.
+local VALID_RESOLUTIONS_C = { 0.1, 0.5, 1, 2, 5 }
+local VALID_RESOLUTIONS_F = { 0.2, 0.5, 1, 2, 5 }
--- Snap a resolution value to the nearest valid C4 resolution.
--- @param value number The raw resolution value.
@@ -179,6 +180,13 @@ local function snapResolution(value, validValues)
return best
end
+--- Convert a Celsius delta to a Fahrenheit delta.
+--- @param value number Temperature delta in Celsius.
+--- @return number Temperature delta in Fahrenheit.
+local function celsiusDeltaToFahrenheit(value)
+ return value * 9 / 5
+end
+
--- Clamp a Celsius temperature to the entity's min/max range.
--- @param celsius number Temperature in Celsius.
--- @return number clamped Clamped temperature in Celsius.
@@ -398,7 +406,7 @@ local function sendCapabilities(entity)
local step = entity.visual_target_temperature_step or entity.target_temperature_step
if step ~= nil then
local res_c = snapResolution(step, VALID_RESOLUTIONS_C)
- local res_f = snapResolution(step * 9 / 5, VALID_RESOLUTIONS_F)
+ local res_f = snapResolution(celsiusDeltaToFahrenheit(step), VALID_RESOLUTIONS_F)
SendToProxy(PROXY_BINDING, "DYNAMIC_CAPABILITIES_CHANGED", {
HEAT_SETPOINT_RESOLUTION_C = res_c,
HEAT_SETPOINT_RESOLUTION_F = res_f,
@@ -409,6 +417,14 @@ local function sendCapabilities(entity)
}, "NOTIFY")
end
+ local currentStep = entity.visual_current_temperature_step
+ if currentStep ~= nil then
+ SendToProxy(PROXY_BINDING, "DYNAMIC_CAPABILITIES_CHANGED", {
+ CURRENT_TEMPERATURE_RESOLUTION_C = snapResolution(currentStep, VALID_RESOLUTIONS_C),
+ CURRENT_TEMPERATURE_RESOLUTION_F = snapResolution(celsiusDeltaToFahrenheit(currentStep), VALID_RESOLUTIONS_F),
+ }, "NOTIFY")
+ end
+
CAPABILITIES_SENT = true
-- Water heater extras
diff --git a/drivers/esphome_climate/driver.xml b/drivers/esphome_climate/driver.xml
index 140053c..61449ad 100644
--- a/drivers/esphome_climate/driver.xml
+++ b/drivers/esphome_climate/driver.xml
@@ -112,8 +112,8 @@
150
-58
302
- 0.1
- 0.1
+ 0.5
+ 1
0.5
1
0
@@ -135,9 +135,9 @@
False
False
True
-
+
Off,Heat,Cool,Auto
-
+
thermostatV2