Mill 3. gen add support for PRECISION_HALVES (#73592)

* Add support for PRECISION_HALVES for Mill 3. generation heaters

* Add support for precision halves for Mill local API

* Make sure to cast to float for local api

* Support both float for gen 3 heaters and int for gen < 3 heaters when using cloud api

* Mill attribute bugfix

* Add support for PRECISION_HALVES for Mill 3. generation heaters

* Add support for precision halves for Mill local API

* Make sure to cast to float for local api

* Support both float for gen 3 heaters and int for gen < 3 heaters when using cloud api

* Mill attribute bugfix

* Revert PRECISION_HALVES for Mill cloud integration

* Remove unused code

* Revert to casting to int for mill cloud integration

* Remove unused code
pull/77821/head
Ståle Storø Hauknes 2022-09-04 19:32:57 +02:00 committed by GitHub
parent 03b3959b95
commit b3596fdea1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -15,6 +15,7 @@ from homeassistant.const import (
ATTR_TEMPERATURE, ATTR_TEMPERATURE,
CONF_IP_ADDRESS, CONF_IP_ADDRESS,
CONF_USERNAME, CONF_USERNAME,
PRECISION_HALVES,
PRECISION_WHOLE, PRECISION_WHOLE,
TEMP_CELSIUS, TEMP_CELSIUS,
) )
@ -200,7 +201,7 @@ class LocalMillHeater(CoordinatorEntity, ClimateEntity):
_attr_max_temp = MAX_TEMP _attr_max_temp = MAX_TEMP
_attr_min_temp = MIN_TEMP _attr_min_temp = MIN_TEMP
_attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
_attr_target_temperature_step = PRECISION_WHOLE _attr_target_temperature_step = PRECISION_HALVES
_attr_temperature_unit = TEMP_CELSIUS _attr_temperature_unit = TEMP_CELSIUS
def __init__(self, coordinator): def __init__(self, coordinator):
@ -225,7 +226,7 @@ class LocalMillHeater(CoordinatorEntity, ClimateEntity):
if (temperature := kwargs.get(ATTR_TEMPERATURE)) is None: if (temperature := kwargs.get(ATTR_TEMPERATURE)) is None:
return return
await self.coordinator.mill_data_connection.set_target_temperature( await self.coordinator.mill_data_connection.set_target_temperature(
int(temperature) float(temperature)
) )
await self.coordinator.async_request_refresh() await self.coordinator.async_request_refresh()