From 5b7f5fef88b8b9e8debbacb9d53c14ecefb28746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hjelseth=20H=C3=B8yer?= Date: Tue, 17 Dec 2024 20:48:17 +0100 Subject: [PATCH] mill MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel Hjelseth Høyer --- homeassistant/components/mill/climate.py | 35 +++++---------------- homeassistant/components/mill/const.py | 1 - homeassistant/components/mill/icons.json | 3 -- homeassistant/components/mill/services.yaml | 17 ---------- homeassistant/components/mill/strings.json | 14 --------- 5 files changed, 7 insertions(+), 63 deletions(-) diff --git a/homeassistant/components/mill/climate.py b/homeassistant/components/mill/climate.py index ee4acaf05b0..cc720c49e37 100644 --- a/homeassistant/components/mill/climate.py +++ b/homeassistant/components/mill/climate.py @@ -14,7 +14,6 @@ from homeassistant.components.climate import ( ) from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( - ATTR_ENTITY_ID, ATTR_TEMPERATURE, CONF_IP_ADDRESS, CONF_USERNAME, @@ -24,16 +23,12 @@ from homeassistant.const import ( from homeassistant.core import HomeAssistant, ServiceCall, callback from homeassistant.helpers import config_validation as cv from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC, DeviceInfo -from homeassistant.helpers.entity_platform import ( - AddEntitiesCallback, - async_get_current_platform, -) +from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.update_coordinator import CoordinatorEntity from .const import ( ATTR_AWAY_TEMP, ATTR_COMFORT_TEMP, - ATTR_MAX_HEATING_POWER, ATTR_ROOM_NAME, ATTR_SLEEP_TEMP, CLOUD, @@ -43,7 +38,6 @@ from .const import ( MANUFACTURER, MAX_TEMP, MIN_TEMP, - SERVICE_MAX_HEATING_POWER, SERVICE_SET_ROOM_TEMP, ) from .coordinator import MillDataUpdateCoordinator @@ -90,21 +84,6 @@ async def async_setup_entry( DOMAIN, SERVICE_SET_ROOM_TEMP, set_room_temp, schema=SET_ROOM_TEMP_SCHEMA ) - async def max_heating_power(entity: MillHeater, service: ServiceCall) -> None: - """Limit heating power.""" - await mill_data_coordinator.mill_data_connection.max_heating_power( - entity.heater_id, service.data[ATTR_MAX_HEATING_POWER] - ) - - async_get_current_platform().async_register_entity_service( - SERVICE_MAX_HEATING_POWER, - schema={ - vol.Required(ATTR_ENTITY_ID): cv.entity_id, - vol.Required(ATTR_MAX_HEATING_POWER): vol.Range(min=0, max=2000), - }, - func=max_heating_power, - ) - class MillHeater(CoordinatorEntity[MillDataUpdateCoordinator], ClimateEntity): """Representation of a Mill Thermostat device.""" @@ -131,7 +110,7 @@ class MillHeater(CoordinatorEntity[MillDataUpdateCoordinator], ClimateEntity): self._available = False - self.heater_id = heater.device_id + self._id = heater.device_id self._attr_unique_id = heater.device_id self._attr_device_info = DeviceInfo( identifiers={(DOMAIN, heater.device_id)}, @@ -147,10 +126,10 @@ class MillHeater(CoordinatorEntity[MillDataUpdateCoordinator], ClimateEntity): if (temperature := kwargs.get(ATTR_TEMPERATURE)) is None: return await self.coordinator.mill_data_connection.set_heater_temp( - self.heater_id, float(temperature) + self._id, float(temperature) ) await self.coordinator.mill_data_connection.fetch_historic_energy_usage( - self.heater_id + self._id ) await self.coordinator.async_request_refresh() @@ -158,12 +137,12 @@ class MillHeater(CoordinatorEntity[MillDataUpdateCoordinator], ClimateEntity): """Set new target hvac mode.""" if hvac_mode == HVACMode.HEAT: await self.coordinator.mill_data_connection.heater_control( - self.heater_id, power_status=True + self._id, power_status=True ) await self.coordinator.async_request_refresh() elif hvac_mode == HVACMode.OFF: await self.coordinator.mill_data_connection.heater_control( - self.heater_id, power_status=False + self._id, power_status=False ) await self.coordinator.async_request_refresh() @@ -175,7 +154,7 @@ class MillHeater(CoordinatorEntity[MillDataUpdateCoordinator], ClimateEntity): @callback def _handle_coordinator_update(self) -> None: """Handle updated data from the coordinator.""" - self._update_attr(self.coordinator.data[self.heater_id]) + self._update_attr(self.coordinator.data[self._id]) self.async_write_ha_state() @callback diff --git a/homeassistant/components/mill/const.py b/homeassistant/components/mill/const.py index beaf8231754..25cbc0fcb91 100644 --- a/homeassistant/components/mill/const.py +++ b/homeassistant/components/mill/const.py @@ -18,6 +18,5 @@ MANUFACTURER = "Mill" MAX_TEMP = 35 MIN_TEMP = 5 SERVICE_SET_ROOM_TEMP = "set_room_temperature" -SERVICE_MAX_HEATING_POWER = "max_heating_power" TEMPERATURE = "current_temp" TVOC = "tvoc" diff --git a/homeassistant/components/mill/icons.json b/homeassistant/components/mill/icons.json index 40329b0226e..f2595f28057 100644 --- a/homeassistant/components/mill/icons.json +++ b/homeassistant/components/mill/icons.json @@ -2,9 +2,6 @@ "services": { "set_room_temperature": { "service": "mdi:thermometer" - }, - "max_heating_power": { - "service": "mdi:power" } } } diff --git a/homeassistant/components/mill/services.yaml b/homeassistant/components/mill/services.yaml index 5b58a49ef07..14e2196eb83 100644 --- a/homeassistant/components/mill/services.yaml +++ b/homeassistant/components/mill/services.yaml @@ -23,20 +23,3 @@ set_room_temperature: min: 0 max: 100 unit_of_measurement: "°" - -max_heating_power: - fields: - entity_id: - required: true - example: "climate.house" - selector: - entity: - integration: mill - domain: climate - max_heating_power: - required: true - selector: - number: - min: 0 - max: 2000 - unit_of_measurement: "W" diff --git a/homeassistant/components/mill/strings.json b/homeassistant/components/mill/strings.json index 4f0837adf39..21e3e7a44a5 100644 --- a/homeassistant/components/mill/strings.json +++ b/homeassistant/components/mill/strings.json @@ -53,20 +53,6 @@ } }, "services": { - "max_heating_power": { - "description": "Sets max power heater can use.", - "fields": { - "entity_id": { - "description": "Entity id of heater to change.", - "name": "Entity id" - }, - "max_heating_power": { - "description": "Max heating power.", - "name": "Max heating power" - } - }, - "name": "Set max heating power" - }, "set_room_temperature": { "name": "Set room temperature", "description": "Sets Mill room temperatures.",