From c10b7b8fa4bb42ef2be2d1f2d69c322d02671216 Mon Sep 17 00:00:00 2001 From: Stephan Uhle Date: Tue, 26 Dec 2023 18:40:10 +0000 Subject: [PATCH] Solved lint errors. --- custom_components/mygekko/button.py | 6 ++- custom_components/mygekko/climate.py | 3 +- custom_components/mygekko/coordinator.py | 1 + custom_components/mygekko/cover.py | 7 ++- custom_components/mygekko/entity.py | 8 ++-- custom_components/mygekko/light.py | 6 ++- custom_components/mygekko/scene.py | 4 +- custom_components/mygekko/select.py | 5 +- custom_components/mygekko/sensor.py | 47 ++++++++++++------- custom_components/mygekko/switch.py | 6 ++- .../mygekko/translations/de.json | 30 ++++++------ .../mygekko/translations/en.json | 30 ++++++------ .../mygekko/translations/fr.json | 30 ++++++------ .../mygekko/translations/it.json | 30 ++++++------ .../mygekko/translations/nb.json | 30 ++++++------ custom_components/mygekko/water_heater.py | 5 +- 16 files changed, 146 insertions(+), 102 deletions(-) diff --git a/custom_components/mygekko/button.py b/custom_components/mygekko/button.py index 54d56b2..fc8f071 100644 --- a/custom_components/mygekko/button.py +++ b/custom_components/mygekko/button.py @@ -8,7 +8,7 @@ async def async_setup_entry(hass, entry, async_add_devices): - """Setup button platform.""" + """Set up button platform.""" coordinator = hass.data[DOMAIN][entry.entry_id] lights = coordinator.api.get_lights() if lights is not None: @@ -30,12 +30,14 @@ class MyGekkoLightGroupOnButton(MyGekkoEntity, ButtonEntity): """mygekko Light class.""" def __init__(self, coordinator, light: Light): + """Initialize the Light Group On button.""" super().__init__(coordinator, light, "lights", "On") self._light = light self._attr_icon = "mdi:lightbulb-on" self._attr_translation_key = "mygekko_light_group_on" async def async_press(self) -> None: + """Press the button.""" await self._light.set_state(LightState.ON) @@ -43,10 +45,12 @@ class MyGekkoLightGroupOffButton(MyGekkoEntity, ButtonEntity): """mygekko Light class.""" def __init__(self, coordinator, light: Light): + """Initialize the Light Group Off button.""" super().__init__(coordinator, light, "lights", "Off") self._light = light self._attr_icon = "mdi:lightbulb-off" self._attr_translation_key = "mygekko_light_group_off" async def async_press(self) -> None: + """Press the button.""" await self._light.set_state(LightState.OFF) diff --git a/custom_components/mygekko/climate.py b/custom_components/mygekko/climate.py index 9b19464..43df056 100644 --- a/custom_components/mygekko/climate.py +++ b/custom_components/mygekko/climate.py @@ -20,7 +20,7 @@ async def async_setup_entry(hass, entry, async_add_devices): - """Setup cover platform.""" + """Set up cover platform.""" coordinator = hass.data[DOMAIN][entry.entry_id] async_add_devices( @@ -35,6 +35,7 @@ class MyGekkoRoomTempClimate(MyGekkoEntity, ClimateEntity): _attr_temperature_unit = UnitOfTemperature.CELSIUS def __init__(self, coordinator, room_temp: RoomTemp): + """Initialize the MyGekko climate entity.""" super().__init__(coordinator, room_temp, "room_temps") self._room_temp = room_temp self._attr_translation_key = "mygekko_roomtemp" diff --git a/custom_components/mygekko/coordinator.py b/custom_components/mygekko/coordinator.py index 4e805f8..bab991e 100644 --- a/custom_components/mygekko/coordinator.py +++ b/custom_components/mygekko/coordinator.py @@ -1,3 +1,4 @@ +"""Data Update Coordinator for the MyGekko integration.""" import logging from datetime import timedelta diff --git a/custom_components/mygekko/cover.py b/custom_components/mygekko/cover.py index 8b4c47a..173e26c 100644 --- a/custom_components/mygekko/cover.py +++ b/custom_components/mygekko/cover.py @@ -17,7 +17,7 @@ async def async_setup_entry(hass, entry, async_add_devices): - """Setup cover platform.""" + """Set up cover platform.""" coordinator = hass.data[DOMAIN][entry.entry_id] blinds = coordinator.api.get_blinds() if blinds is not None: @@ -31,6 +31,7 @@ class MyGekkoCover(MyGekkoEntity, CoverEntity): _attr_device_class = CoverDeviceClass.SHUTTER def __init__(self, coordinator, blind: Blind): + """Initialize the MyGekko cover.""" super().__init__(coordinator, blind, "blinds") self._blind = blind supported_features = self._blind.supported_features @@ -66,6 +67,7 @@ def _handle_coordinator_update(self) -> None: @property def is_closed(self) -> bool | None: + """Check whether the cover is closed.""" # myGekko blinds are closed on 100 and open on 0 return ( ceil(self._blind.position) == 100 @@ -95,6 +97,7 @@ def current_cover_tilt_position(self) -> int | None: @property def is_closing(self) -> bool: + """Check whether the cover is closing.""" return ( self._blind.state == BlindState.DOWN or self._blind.state == BlindState.HOLD_DOWN @@ -102,6 +105,7 @@ def is_closing(self) -> bool: @property def is_opening(self) -> bool: + """Check whether the cover is opening.""" return ( self._blind.state == BlindState.UP or self._blind.state == BlindState.HOLD_UP @@ -120,6 +124,7 @@ async def async_stop_cover(self, **kwargs: Any): await self._blind.set_state(BlindState.STOP) async def async_set_cover_position(self, **kwargs: Any) -> None: + """Set the cover position.""" # myGekko blinds are closed on 100 and open on 0 await self._blind.set_position(100.0 - float(kwargs[ATTR_POSITION])) diff --git a/custom_components/mygekko/entity.py b/custom_components/mygekko/entity.py index e904f9f..9c2e832 100644 --- a/custom_components/mygekko/entity.py +++ b/custom_components/mygekko/entity.py @@ -1,4 +1,4 @@ -"""MyGekkoEntity class""" +"""MyGekkoEntity class.""" import logging from homeassistant.helpers.entity import DeviceInfo @@ -13,13 +13,14 @@ class MyGekkoEntity(CoordinatorEntity): - """Base Class for MyGekko entities""" + """Base Class for MyGekko entities.""" _attr_has_entity_name = True def __init__( self, coordinator, entity: Entity, entity_prefix: str, entity_suffix: str = "" ): + """Initialize a MyGekko entity.""" super().__init__(coordinator) device_id = f"{entity_prefix}{entity.entity_id}" @@ -37,13 +38,14 @@ def __init__( class MyGekkoControllerEntity(CoordinatorEntity): - """Base Class for MyGekko controller entities""" + """Base Class for MyGekko controller entities.""" _attr_has_entity_name = True def __init__( self, coordinator, entity: Entity, globals_network, entity_prefix: str ): + """Initialize a MyGekko controller entity.""" super().__init__(coordinator) device_id = f"mygekko_controller_{globals_network['gekkoname']}" diff --git a/custom_components/mygekko/light.py b/custom_components/mygekko/light.py index 3780d83..d5b9be2 100644 --- a/custom_components/mygekko/light.py +++ b/custom_components/mygekko/light.py @@ -18,7 +18,7 @@ async def async_setup_entry(hass, entry, async_add_devices): - """Setup light platform.""" + """Set up light platform.""" coordinator = hass.data[DOMAIN][entry.entry_id] lights: list[Light] = coordinator.api.get_lights() if lights is not None: @@ -36,6 +36,7 @@ class MyGekkoLight(MyGekkoEntity, LightEntity): _attr_name = None def __init__(self, coordinator, light: Light): + """Initialize a MyGekko light.""" super().__init__(coordinator, light, "lights") self._light = light @@ -59,16 +60,19 @@ def _handle_coordinator_update(self) -> None: @property def is_on(self) -> bool | None: + """Check whether the light is on.""" _LOGGER.debug( "The light state of %s is %d", self._light.name, self._light.state ) return self._light.state == LightState.ON async def async_turn_off(self, **kwargs): + """Turn off the light.""" _LOGGER.debug("Switch off light %s", self._light.name) await self._light.set_state(LightState.OFF) async def async_turn_on(self, **kwargs): + """Turn on the light.""" _LOGGER.debug("Switch on light %s", self._light.name) if ATTR_RGB_COLOR in kwargs and kwargs[ATTR_RGB_COLOR]: await self._light.set_rgb_color(kwargs[ATTR_RGB_COLOR]) diff --git a/custom_components/mygekko/scene.py b/custom_components/mygekko/scene.py index 55e1f78..86cfc50 100644 --- a/custom_components/mygekko/scene.py +++ b/custom_components/mygekko/scene.py @@ -11,7 +11,7 @@ async def async_setup_entry(hass, entry, async_add_devices): - """Setup scene platform.""" + """Set up scene platform.""" coordinator = hass.data[DOMAIN][entry.entry_id] actions = coordinator.api.get_actions() globals_network = coordinator.api.get_globals_network() @@ -25,6 +25,7 @@ class MyGekkoScene(MyGekkoControllerEntity, Scene): """mygekko Scene class.""" def __init__(self, coordinator, action: Action, globals_network): + """Initialize a MyGekko scene.""" super().__init__(coordinator, action, globals_network, "actions") self._action = action @@ -34,4 +35,5 @@ def _handle_coordinator_update(self) -> None: self.async_write_ha_state() async def async_activate(self, **kwargs: Any) -> None: + """Activate the scene.""" await self._action.set_state(ActionState.ON) diff --git a/custom_components/mygekko/select.py b/custom_components/mygekko/select.py index 5fa5f39..27cc3d6 100644 --- a/custom_components/mygekko/select.py +++ b/custom_components/mygekko/select.py @@ -11,7 +11,7 @@ async def async_setup_entry(hass, entry, async_add_devices): - """Setup select platform.""" + """Set up select platform.""" coordinator = hass.data[DOMAIN][entry.entry_id] async_add_devices( @@ -32,6 +32,7 @@ class MyGekkoVentBypassSelect(MyGekkoEntity, SelectEntity): """mygekko vent bypass select class.""" def __init__(self, coordinator, vent: Vent): + """Initialize a MyGekko vent bypass selection.""" super().__init__(coordinator, vent, "vents", "Bypass") self._vent = vent self.entity_description = SelectEntityDescription( @@ -62,6 +63,7 @@ class MyGekkoVentWorkingModeSelect(MyGekkoEntity, SelectEntity): """mygekko vent working mode select class.""" def __init__(self, coordinator, vent: Vent): + """Initialize a MyGekko vent working mode selection.""" super().__init__(coordinator, vent, "vents", "Working Mode") self._vent = vent self.entity_description = SelectEntityDescription( @@ -93,6 +95,7 @@ class MyGekkoVentWorkingLevelSelect(MyGekkoEntity, SelectEntity): """mygekko vent level select class.""" def __init__(self, coordinator, vent: Vent): + """Initialize a MyGekko vent working level selection.""" super().__init__(coordinator, vent, "vents", "Level") self._vent = vent self.entity_description = SelectEntityDescription( diff --git a/custom_components/mygekko/sensor.py b/custom_components/mygekko/sensor.py index e19ba59..66b5397 100644 --- a/custom_components/mygekko/sensor.py +++ b/custom_components/mygekko/sensor.py @@ -24,98 +24,98 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = ( SensorEntityDescription( key="actPower", - translation_key="mygekko_energycost_actPower", + translation_key="mygekko_energycost_act_power", state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.POWER, ), SensorEntityDescription( key="powerMax", name="Power Max", - translation_key="mygekko_energycost_powerMax", + translation_key="mygekko_energycost_power_max", state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.POWER, ), SensorEntityDescription( key="energySum", name="Energy Sum", - translation_key="mygekko_energycost_energySum", + translation_key="mygekko_energycost_energy_sum", state_class=SensorStateClass.TOTAL_INCREASING, device_class=SensorDeviceClass.ENERGY, ), SensorEntityDescription( key="energyToday", name="Energy Today", - translation_key="mygekko_energycost_energyToday", + translation_key="mygekko_energycost_energy_today", state_class=SensorStateClass.TOTAL, device_class=SensorDeviceClass.ENERGY, ), SensorEntityDescription( key="energyMonth", name="Energy Month", - translation_key="mygekko_energycost_energyMonth", + translation_key="mygekko_energycost_energy_month", state_class=SensorStateClass.TOTAL, device_class=SensorDeviceClass.ENERGY, ), SensorEntityDescription( key="energyToday6", name="Energy Today 6", - translation_key="mygekko_energycost_energyToday6", + translation_key="mygekko_energycost_energy_today6", state_class=SensorStateClass.TOTAL, device_class=SensorDeviceClass.ENERGY, ), SensorEntityDescription( key="energyToday12", name="Energy Today 12", - translation_key="mygekko_energycost_energyToday12", + translation_key="mygekko_energycost_energy_today12", state_class=SensorStateClass.TOTAL, device_class=SensorDeviceClass.ENERGY, ), SensorEntityDescription( key="energyToday18", name="Energy Today 18", - translation_key="mygekko_energycost_energyToday18", + translation_key="mygekko_energycost_energy_today18", state_class=SensorStateClass.TOTAL, device_class=SensorDeviceClass.ENERGY, ), SensorEntityDescription( key="energyToday24", name="Energy Today 24", - translation_key="mygekko_energycost_energyToday24", + translation_key="mygekko_energycost_energy_today24", state_class=SensorStateClass.TOTAL, device_class=SensorDeviceClass.ENERGY, ), SensorEntityDescription( key="energyYesterd6", name="Energy Yesterday 6", - translation_key="mygekko_energycost_energyYesterd6", + translation_key="mygekko_energycost_energy_yesterd6", state_class=SensorStateClass.TOTAL, device_class=SensorDeviceClass.ENERGY, ), SensorEntityDescription( key="energyYesterd12", name="Energy Yesterday 12", - translation_key="mygekko_energycost_energyYesterd12", + translation_key="mygekko_energycost_energy_yesterd12", state_class=SensorStateClass.TOTAL, device_class=SensorDeviceClass.ENERGY, ), SensorEntityDescription( key="energyYesterd18", name="Energy Yesterday 18", - translation_key="mygekko_energycost_energyYesterd18", + translation_key="mygekko_energycost_energy_yesterd18", state_class=SensorStateClass.TOTAL, device_class=SensorDeviceClass.ENERGY, ), SensorEntityDescription( key="energyYesterd24", name="Energy Yesterday 24", - translation_key="mygekko_energycost_energyYesterd24", + translation_key="mygekko_energycost_energy_yesterd24", state_class=SensorStateClass.TOTAL, device_class=SensorDeviceClass.ENERGY, ), SensorEntityDescription( key="energyYear", name="Energy Year", - translation_key="mygekko_energycost_energyYear", + translation_key="mygekko_energycost_energy_year", state_class=SensorStateClass.TOTAL, device_class=SensorDeviceClass.ENERGY, ), @@ -157,7 +157,7 @@ async def async_setup_entry(hass, entry, async_add_devices): - """Setup sensor platform.""" + """Set up sensor platform.""" coordinator = hass.data[DOMAIN][entry.entry_id] energy_costs: list[EnergyCost] = coordinator.api.get_energy_costs() for energy_cost in energy_costs: @@ -238,6 +238,7 @@ class MyGekkoAlarmsLogicsSensor(MyGekkoControllerEntity, SensorEntity): """mygekko AlarmsLogics Sensor class.""" def __init__(self, coordinator, alarms_logic: AlarmsLogic, globals_network): + """Initialize a MyGekko AlarmsLogics sensor.""" super().__init__(coordinator, alarms_logic, globals_network, "alarms_logic") self._alarms_logic = alarms_logic @@ -257,7 +258,8 @@ def __init__( index, sensorEntityDescription: SensorEntityDescription, ): - super(MyGekkoEnergySensor, self).__init__( + """Initialize a MyGekko EnergyCost sensor.""" + super().__init__( coordinator, energy_cost, "energy_cost", @@ -290,6 +292,7 @@ class MyGekkoRoomTempsHumiditySensor(MyGekkoEntity, SensorEntity): _attr_native_unit_of_measurement = PERCENTAGE def __init__(self, coordinator, room_temp: RoomTemp): + """Initialize a MyGekko RoomTemp humidity sensor.""" super().__init__(coordinator, room_temp, "room_temps", "Humidity") self._room_temp = room_temp self.entity_description = SENSORS["humidity"] @@ -306,6 +309,7 @@ class MyGekkoRoomTempsAirQualitySensor(MyGekkoEntity, SensorEntity): _attr_native_unit_of_measurement = CONCENTRATION_PARTS_PER_MILLION def __init__(self, coordinator, room_temp: RoomTemp): + """Initialize a MyGekko RoomTemp air quality sensor.""" super().__init__(coordinator, room_temp, "room_temps", "Air Quality") self._room_temp = room_temp self.entity_description = SENSORS["voc"] @@ -322,6 +326,7 @@ class MyGekkoHotwaterSystemsBottomTemperatureSensor(MyGekkoEntity, SensorEntity) _attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS def __init__(self, coordinator, hotwater_system: HotWaterSystem): + """Initialize a MyGekko bottom Temperature sensor.""" super().__init__( coordinator, hotwater_system, "hotwater_systems", "Bottom Temperature" ) @@ -341,6 +346,7 @@ class MyGekkoHotwaterSystemsTopTemperatureSensor(MyGekkoEntity, SensorEntity): _attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS def __init__(self, coordinator, hotwater_system: HotWaterSystem): + """Initialize a MyGekko top Temperature sensor.""" super().__init__( coordinator, hotwater_system, "hotwater_systems", "Top Temperature" ) @@ -360,6 +366,7 @@ class MyGekkoVentHumiditySensor(MyGekkoEntity, SensorEntity): _attr_native_unit_of_measurement = PERCENTAGE def __init__(self, coordinator, vent: Vent): + """Initialize a MyGekko vent humidity sensor.""" super().__init__(coordinator, vent, "vents", "Humidity") self._vent = vent self.entity_description = SENSORS["humidity"] @@ -376,6 +383,7 @@ class MyGekkoVentAirQualitySensor(MyGekkoEntity, SensorEntity): _attr_native_unit_of_measurement = PERCENTAGE def __init__(self, coordinator, vent: Vent): + """Initialize a MyGekko vent air quality sensor.""" super().__init__(coordinator, vent, "vents", "Air Quality") self._vent = vent self.entity_description = SENSORS["air_quality"] @@ -392,6 +400,7 @@ class MyGekkoVentCo2Sensor(MyGekkoEntity, SensorEntity): _attr_native_unit_of_measurement = CONCENTRATION_PARTS_PER_MILLION def __init__(self, coordinator, vent: Vent): + """Initialize a MyGekko vent co2 sensor.""" super().__init__(coordinator, vent, "vents", "CO2") self._vent = vent self.entity_description = SENSORS["co2"] @@ -408,6 +417,7 @@ class MyGekkoVentExhaustAirTemperatureSensor(MyGekkoEntity, SensorEntity): _attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS def __init__(self, coordinator, vent: Vent): + """Initialize a MyGekko vent exhaust air temperature sensor.""" super().__init__(coordinator, vent, "vents", "Exhaust Air Temperature") self._vent = vent self.entity_description = SENSORS["temperature"] @@ -426,6 +436,7 @@ class MyGekkoVentExhaustAirWorkingLevelSensor(MyGekkoEntity, SensorEntity): _attr_icon = "mdi:gauge" def __init__(self, coordinator, vent: Vent): + """Initialize a MyGekko vent exhaust air working level sensor.""" super().__init__(coordinator, vent, "vents", "Exhaust Air Working Level") self._vent = vent self._attr_translation_key = "mygekko_vent_exhaust_air_working_level" @@ -442,6 +453,7 @@ class MyGekkoVentOutgoingAirTemperatureSensor(MyGekkoEntity, SensorEntity): _attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS def __init__(self, coordinator, vent: Vent): + """Initialize a MyGekko vent outgoing air temperature sensor.""" super().__init__(coordinator, vent, "vents", "Outgoing Air Temperature") self._vent = vent self.entity_description = SENSORS["temperature"] @@ -459,6 +471,7 @@ class MyGekkoVentOutsideAirTemperatureSensor(MyGekkoEntity, SensorEntity): _attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS def __init__(self, coordinator, vent: Vent): + """Initialize a MyGekko vent outside air temperature sensor.""" super().__init__(coordinator, vent, "vents", "Outside Air Temperature") self._vent = vent self.entity_description = SENSORS["temperature"] @@ -476,6 +489,7 @@ class MyGekkoVentSupplyAirTemperatureSensor(MyGekkoEntity, SensorEntity): _attr_native_unit_of_measurement = UnitOfTemperature.CELSIUS def __init__(self, coordinator, vent: Vent): + """Initialize a MyGekko vent supply air temperature sensor.""" super().__init__(coordinator, vent, "vents", "Supply Air Temperature") self._vent = vent self.entity_description = SENSORS["temperature"] @@ -494,6 +508,7 @@ class MyGekkoVentSupplyAirWorkingLevelSensor(MyGekkoEntity, SensorEntity): _attr_icon = "mdi:gauge" def __init__(self, coordinator, vent: Vent): + """Initialize a MyGekko vent supply air working level sensor.""" super().__init__(coordinator, vent, "vents", "Supply Air Working Level") self._vent = vent self._attr_translation_key = "mygekko_vent_supply_air_working_level" diff --git a/custom_components/mygekko/switch.py b/custom_components/mygekko/switch.py index 72e2228..23a1d98 100644 --- a/custom_components/mygekko/switch.py +++ b/custom_components/mygekko/switch.py @@ -9,7 +9,7 @@ async def async_setup_entry(hass, entry, async_add_devices): - """Setup switch platform.""" + """Set up switch platform.""" coordinator = hass.data[DOMAIN][entry.entry_id] loads = coordinator.api.get_loads() if loads is not None: @@ -22,6 +22,7 @@ class MyGekkoSwitch(MyGekkoEntity, SwitchEntity): _attr_name = None def __init__(self, coordinator, load: Load): + """Initialize a MyGekko switch.""" super().__init__(coordinator, load, "loads") self._load = load @@ -32,13 +33,16 @@ def _handle_coordinator_update(self) -> None: @property def is_on(self) -> bool | None: + """Check wether the swich is on.""" return ( self._load.state == LoadState.ON_PERMANENT or self._load.state == LoadState.ON_IMPULSE ) async def async_turn_off(self, **kwargs): + """Turn off the switch.""" await self._load.set_state(LoadState.OFF) async def async_turn_on(self, **kwargs): + """Turn on the switch.""" await self._load.set_state(LoadState.ON_PERMANENT) diff --git a/custom_components/mygekko/translations/de.json b/custom_components/mygekko/translations/de.json index 09b6b4a..51669ed 100644 --- a/custom_components/mygekko/translations/de.json +++ b/custom_components/mygekko/translations/de.json @@ -92,46 +92,46 @@ } }, "sensor": { - "mygekko_energycost_actPower": { + "mygekko_energycost_act_power": { "name": "Aktuelle Leistung" }, - "mygekko_energycost_powerMax": { + "mygekko_energycost_power_max": { "name": "Nennleistung" }, - "mygekko_energycost_energySum": { + "mygekko_energycost_energy_sum": { "name": "Energie insgesamt" }, - "mygekko_energycost_energyToday": { + "mygekko_energycost_energy_today": { "name": "Energie insgesamt (heute)" }, - "mygekko_energycost_energyMonth": { + "mygekko_energycost_energy_month": { "name": "Energie insgesamt (dieser Monat)" }, - "mygekko_energycost_energyToday6": { + "mygekko_energycost_energy_today6": { "name": "Energie insgesamt (heute von 00:00 bis 06:00)" }, - "mygekko_energycost_energyToday12": { + "mygekko_energycost_energy_today12": { "name": "Energie insgesamt (heute von 06:00 bis 12:00)" }, - "mygekko_energycost_energyToday18": { + "mygekko_energycost_energy_today18": { "name": "Energie insgesamt (heute von 12:00 bis 18:00)" }, - "mygekko_energycost_energyToday24": { + "mygekko_energycost_energy_today24": { "name": "Energie insgesamt (heute von 18:00 bis 24:00)" }, - "mygekko_energycost_energyYesterd6": { + "mygekko_energycost_energy_yesterd6": { "name": "Energie insgesamt (gestern von 00:00 bis 06:00)" }, - "mygekko_energycost_energyYesterd12": { + "mygekko_energycost_energy_yesterd12": { "name": "Energie insgesamt (gestern von 06:00 bis 12:00)" }, - "mygekko_energycost_energyYesterd18": { + "mygekko_energycost_energy_yesterd18": { "name": "Energie insgesamt (gestern von 12:00 bis 18:00)" }, - "mygekko_energycost_energyYesterd24": { + "mygekko_energycost_energy_yesterd24": { "name": "Energie insgesamt (gestern von 18:00 bis 24:00)" }, - "mygekko_energycost_energyYear": { + "mygekko_energycost_energy_year": { "name": "Energie insgesamt (dieses Jahr)" }, "mygekko_hotwatersystem_bottom_temperature": { @@ -168,4 +168,4 @@ } } } -} +} \ No newline at end of file diff --git a/custom_components/mygekko/translations/en.json b/custom_components/mygekko/translations/en.json index 77832a3..6c4e783 100644 --- a/custom_components/mygekko/translations/en.json +++ b/custom_components/mygekko/translations/en.json @@ -91,46 +91,46 @@ } }, "sensor": { - "mygekko_energycost_actPower": { + "mygekko_energycost_act_power": { "name": "Current Power" }, - "mygekko_energycost_powerMax": { + "mygekko_energycost_power_max": { "name": "Nominal Power" }, - "mygekko_energycost_energySum": { + "mygekko_energycost_energy_sum": { "name": "Total Energy" }, - "mygekko_energycost_energyToday": { + "mygekko_energycost_energy_today": { "name": "Total Energy Today" }, - "mygekko_energycost_energyMonth": { + "mygekko_energycost_energy_month": { "name": "Total Energy This Month" }, - "mygekko_energycost_energyToday6": { + "mygekko_energycost_energy_today6": { "name": "Total Energy Today From 00:00 to 06:00" }, - "mygekko_energycost_energyToday12": { + "mygekko_energycost_energy_today12": { "name": "Total Energy Today From 06:00 to 12:00" }, - "mygekko_energycost_energyToday18": { + "mygekko_energycost_energy_today18": { "name": "Total Energy Today From 12:00 to 18:00" }, - "mygekko_energycost_energyToday24": { + "mygekko_energycost_energy_today24": { "name": "Total Energy Today From 18:00 to 24:00" }, - "mygekko_energycost_energyYesterd6": { + "mygekko_energycost_energy_yesterd6": { "name": "Total Energy Yesterday From 00:00 to 06:00" }, - "mygekko_energycost_energyYesterd12": { + "mygekko_energycost_energy_yesterd12": { "name": "Total Energy Yesterday From 06:00 to 12:00" }, - "mygekko_energycost_energyYesterd18": { + "mygekko_energycost_energy_yesterd18": { "name": "Total Energy Yesterday From 12:00 to 18:00" }, - "mygekko_energycost_energyYesterd24": { + "mygekko_energycost_energy_yesterd24": { "name": "Total Energy Yesterday From 18:00 to 24:00" }, - "mygekko_energycost_energyYear": { + "mygekko_energycost_energy_year": { "name": "Total Energy This Year" }, "mygekko_hotwatersystem_bottom_temperature": { @@ -167,4 +167,4 @@ } } } -} +} \ No newline at end of file diff --git a/custom_components/mygekko/translations/fr.json b/custom_components/mygekko/translations/fr.json index 0602e0f..fc1c25c 100644 --- a/custom_components/mygekko/translations/fr.json +++ b/custom_components/mygekko/translations/fr.json @@ -91,46 +91,46 @@ } }, "sensor": { - "mygekko_energycost_actPower": { + "mygekko_energycost_act_power": { "name": "Puissance actuelle" }, - "mygekko_energycost_powerMax": { + "mygekko_energycost_power_max": { "name": "Puissance nominale" }, - "mygekko_energycost_energySum": { + "mygekko_energycost_energy_sum": { "name": "Énergie totale" }, - "mygekko_energycost_energyToday": { + "mygekko_energycost_energy_today": { "name": "Énergie totale aujourd'hui" }, - "mygekko_energycost_energyMonth": { + "mygekko_energycost_energy_month": { "name": "Énergie totale ce mois-ci" }, - "mygekko_energycost_energyToday6": { + "mygekko_energycost_energy_today6": { "name": "Energie totale aujourd'hui de 00:00 à 06:00" }, - "mygekko_energycost_energyToday12": { + "mygekko_energycost_energy_today12": { "name": "Total Energy Aujourd'hui De 06:00 à 12:00" }, - "mygekko_energycost_energyToday18": { + "mygekko_energycost_energy_today18": { "name": "Total Energy Aujourd'hui De 12h00 à 18h00" }, - "mygekko_energycost_energyToday24": { + "mygekko_energycost_energy_today24": { "name": "Total Energy Aujourd'hui De 18:00 à 24:00" }, - "mygekko_energycost_energyYesterd6": { + "mygekko_energycost_energy_yesterd6": { "name": "Énergie totale hier de 00:00 à 06:00" }, - "mygekko_energycost_energyYesterd12": { + "mygekko_energycost_energy_yesterd12": { "name": "Énergie totale hier de 06:00 à 12:00" }, - "mygekko_energycost_energyYesterd18": { + "mygekko_energycost_energy_yesterd18": { "name": "Énergie totale hier De 12:00 à 18:00" }, - "mygekko_energycost_energyYesterd24": { + "mygekko_energycost_energy_yesterd24": { "name": "Énergie totale hier De 18:00 à 24:00" }, - "mygekko_energycost_energyYear": { + "mygekko_energycost_energy_year": { "name": "Énergie totale cette année" }, "mygekko_hotwatersystem_bottom_temperature": { @@ -167,4 +167,4 @@ } } } -} +} \ No newline at end of file diff --git a/custom_components/mygekko/translations/it.json b/custom_components/mygekko/translations/it.json index e3b698b..1c4faa6 100644 --- a/custom_components/mygekko/translations/it.json +++ b/custom_components/mygekko/translations/it.json @@ -91,46 +91,46 @@ } }, "sensor": { - "mygekko_energycost_actPower": { + "mygekko_energycost_act_power": { "name": "Potenza attuale" }, - "mygekko_energycost_powerMax": { + "mygekko_energycost_power_max": { "name": "Potenza nominale" }, - "mygekko_energycost_energySum": { + "mygekko_energycost_energy_sum": { "name": "Energia totale" }, - "mygekko_energycost_energyToday": { + "mygekko_energycost_energy_today": { "name": "Energia totale oggi" }, - "mygekko_energycost_energyMonth": { + "mygekko_energycost_energy_month": { "name": "Energia totale questo mese" }, - "mygekko_energycost_energyToday6": { + "mygekko_energycost_energy_today6": { "name": "Energia totale Oggi Dalle 00:00 alle 06:00" }, - "mygekko_energycost_energyToday12": { + "mygekko_energycost_energy_today12": { "name": "Energia totale Oggi Dalle 06:00 alle 12:00" }, - "mygekko_energycost_energyToday18": { + "mygekko_energycost_energy_today18": { "name": "Energia totale Oggi Dalle 12:00 alle 18:00" }, - "mygekko_energycost_energyToday24": { + "mygekko_energycost_energy_today24": { "name": "Energia totale Oggi Dalle 18:00 alle 24:00" }, - "mygekko_energycost_energyYesterd6": { + "mygekko_energycost_energy_yesterd6": { "name": "Energia totale Ieri dalle 00:00 alle 06:00" }, - "mygekko_energycost_energyYesterd12": { + "mygekko_energycost_energy_yesterd12": { "name": "Energia totale Ieri Dalle 06:00 alle 12:00" }, - "mygekko_energycost_energyYesterd18": { + "mygekko_energycost_energy_yesterd18": { "name": "Energia totale Ieri Dalle 12:00 alle 18:00" }, - "mygekko_energycost_energyYesterd24": { + "mygekko_energycost_energy_yesterd24": { "name": "Energia totale Ieri Dalle 18:00 alle 24:00" }, - "mygekko_energycost_energyYear": { + "mygekko_energycost_energy_year": { "name": "Energia totale quest'anno" }, "mygekko_hotwatersystem_bottom_temperature": { @@ -167,4 +167,4 @@ } } } -} +} \ No newline at end of file diff --git a/custom_components/mygekko/translations/nb.json b/custom_components/mygekko/translations/nb.json index f45856b..a5fc346 100644 --- a/custom_components/mygekko/translations/nb.json +++ b/custom_components/mygekko/translations/nb.json @@ -91,46 +91,46 @@ } }, "sensor": { - "mygekko_energycost_actPower": { + "mygekko_energycost_act_power": { "name": "Huidig vermogen" }, - "mygekko_energycost_powerMax": { + "mygekko_energycost_power_max": { "name": "Nominaal vermogen" }, - "mygekko_energycost_energySum": { + "mygekko_energycost_energy_sum": { "name": "Totaal Energie" }, - "mygekko_energycost_energyToday": { + "mygekko_energycost_energy_today": { "name": "Totale energie vandaag" }, - "mygekko_energycost_energyMonth": { + "mygekko_energycost_energy_month": { "name": "Totaal energie deze maand" }, - "mygekko_energycost_energyToday6": { + "mygekko_energycost_energy_today6": { "name": "Totale Energie Vandaag Van 00:00 tot 06:00" }, - "mygekko_energycost_energyToday12": { + "mygekko_energycost_energy_today12": { "name": "Totale Energie Vandaag Van 06:00 tot 12:00" }, - "mygekko_energycost_energyToday18": { + "mygekko_energycost_energy_today18": { "name": "Totale Energie Vandaag Van 12:00 tot 18:00" }, - "mygekko_energycost_energyToday24": { + "mygekko_energycost_energy_today24": { "name": "Totale Energie Vandaag Van 18:00 tot 24:00" }, - "mygekko_energycost_energyYesterd6": { + "mygekko_energycost_energy_yesterd6": { "name": "Totale energie gisteren van 00:00 tot 06:00" }, - "mygekko_energycost_energyYesterd12": { + "mygekko_energycost_energy_yesterd12": { "name": "Totaal Energie Gisteren Van 06:00 tot 12:00" }, - "mygekko_energycost_energyYesterd18": { + "mygekko_energycost_energy_yesterd18": { "name": "Totaal Energie Gisteren Van 12:00 tot 18:00" }, - "mygekko_energycost_energyYesterd24": { + "mygekko_energycost_energy_yesterd24": { "name": "Totaal Energie Gisteren Van 18:00 tot 24:00" }, - "mygekko_energycost_energyYear": { + "mygekko_energycost_energy_year": { "name": "Totale energie dit jaar" }, "mygekko_hotwatersystem_bottom_temperature": { @@ -167,4 +167,4 @@ } } } -} +} \ No newline at end of file diff --git a/custom_components/mygekko/water_heater.py b/custom_components/mygekko/water_heater.py index 8736602..e61481e 100644 --- a/custom_components/mygekko/water_heater.py +++ b/custom_components/mygekko/water_heater.py @@ -21,7 +21,7 @@ async def async_setup_entry(hass, entry, async_add_devices): - """Setup light platform.""" + """Set up light platform.""" coordinator = hass.data[DOMAIN][entry.entry_id] hotwater_systems = coordinator.api.get_hot_water_systems() if hotwater_systems is not None: @@ -38,6 +38,7 @@ class MyGekkoWaterHeater(MyGekkoEntity, WaterHeaterEntity): _attr_temperature_unit = UnitOfTemperature.CELSIUS def __init__(self, coordinator, hotwater_system: HotWaterSystem): + """Initialize a MyGekko water heater.""" super().__init__(coordinator, hotwater_system, "hotwater_systems") self._hotwater_system = hotwater_system @@ -56,10 +57,12 @@ def _handle_coordinator_update(self) -> None: self.async_write_ha_state() async def async_turn_off(self, **kwargs): + """Turn off the water heater.""" _LOGGER.debug("Switch off water heater %s", self._hotwater_system.name) await self._hotwater_system.set_state(HotWaterSystemState.OFF) async def async_turn_on(self, **kwargs): + """Turn on the water heater.""" _LOGGER.debug("Switch on water heater %s", self._hotwater_system.name) await self._hotwater_system.set_state(HotWaterSystemState.ON)