diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1406b957..2be9a701 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ repos: rev: v2.37.3 hooks: - id: pyupgrade - args: [--py312-plus] + args: [--py311-plus] - repo: https://github.com/psf/black rev: 24.1.1 hooks: diff --git a/custom_components/better_thermostat/adapters/generic.py b/custom_components/better_thermostat/adapters/generic.py index 5b03dfa2..94a071c3 100644 --- a/custom_components/better_thermostat/adapters/generic.py +++ b/custom_components/better_thermostat/adapters/generic.py @@ -23,9 +23,9 @@ async def init(self, entity_id): self.real_trvs[entity_id]["local_temperature_calibration_entity"] is None and self.real_trvs[entity_id]["calibration"] != 1 ): - self.real_trvs[entity_id][ - "local_temperature_calibration_entity" - ] = await find_local_calibration_entity(self, entity_id) + self.real_trvs[entity_id]["local_temperature_calibration_entity"] = ( + await find_local_calibration_entity(self, entity_id) + ) _LOGGER.debug( "better_thermostat %s: uses local calibration entity %s", self.name, diff --git a/custom_components/better_thermostat/adapters/mqtt.py b/custom_components/better_thermostat/adapters/mqtt.py index ba7cea34..288c487b 100644 --- a/custom_components/better_thermostat/adapters/mqtt.py +++ b/custom_components/better_thermostat/adapters/mqtt.py @@ -31,9 +31,9 @@ async def init(self, entity_id): self.real_trvs[entity_id]["local_temperature_calibration_entity"] is None and self.real_trvs[entity_id]["calibration"] != 1 ): - self.real_trvs[entity_id][ - "local_temperature_calibration_entity" - ] = await find_local_calibration_entity(self, entity_id) + self.real_trvs[entity_id]["local_temperature_calibration_entity"] = ( + await find_local_calibration_entity(self, entity_id) + ) _LOGGER.debug( "better_thermostat %s: uses local calibration entity %s", self.name, diff --git a/custom_components/better_thermostat/climate.py b/custom_components/better_thermostat/climate.py index 1afbe0a0..75babfe2 100644 --- a/custom_components/better_thermostat/climate.py +++ b/custom_components/better_thermostat/climate.py @@ -792,9 +792,9 @@ async def startup(self): self.real_trvs[trv]["local_calibration_max"] = await get_max_offset( self, trv ) - self.real_trvs[trv][ - "local_calibration_steps" - ] = await get_offset_steps(self, trv) + self.real_trvs[trv]["local_calibration_steps"] = ( + await get_offset_steps(self, trv) + ) else: self.real_trvs[trv]["last_calibration"] = 0 diff --git a/custom_components/better_thermostat/device_trigger.py b/custom_components/better_thermostat/device_trigger.py index aa134f6d..ec354f50 100644 --- a/custom_components/better_thermostat/device_trigger.py +++ b/custom_components/better_thermostat/device_trigger.py @@ -93,13 +93,13 @@ async def async_attach_trigger( } if trigger_type == "current_temperature_changed": - numeric_state_config[ - numeric_state_trigger.CONF_VALUE_TEMPLATE - ] = "{{ state.attributes.current_temperature }}" + numeric_state_config[numeric_state_trigger.CONF_VALUE_TEMPLATE] = ( + "{{ state.attributes.current_temperature }}" + ) else: - numeric_state_config[ - numeric_state_trigger.CONF_VALUE_TEMPLATE - ] = "{{ state.attributes.current_humidity }}" + numeric_state_config[numeric_state_trigger.CONF_VALUE_TEMPLATE] = ( + "{{ state.attributes.current_humidity }}" + ) if CONF_ABOVE in config: numeric_state_config[CONF_ABOVE] = config[CONF_ABOVE] diff --git a/custom_components/better_thermostat/events/trv.py b/custom_components/better_thermostat/events/trv.py index 595b2e0a..876ffe0f 100644 --- a/custom_components/better_thermostat/events/trv.py +++ b/custom_components/better_thermostat/events/trv.py @@ -1,7 +1,6 @@ import asyncio from datetime import datetime import logging -from typing import Union from custom_components.better_thermostat.utils.const import CONF_HOMATICIP from homeassistant.components.climate.const import ( @@ -108,9 +107,9 @@ async def trigger_trv_change(self, event): ) _main_change = False if self.real_trvs[entity_id]["calibration"] == 0: - self.real_trvs[entity_id][ - "last_calibration" - ] = await get_current_offset(self, entity_id) + self.real_trvs[entity_id]["last_calibration"] = ( + await get_current_offset(self, entity_id) + ) if self.ignore_states: return @@ -300,7 +299,7 @@ def convert_inbound_states(self, entity_id, state: State) -> str: return remapped_state -def convert_outbound_states(self, entity_id, hvac_mode) -> Union[dict, None]: +def convert_outbound_states(self, entity_id, hvac_mode) -> dict | None: """Creates the new outbound thermostat state. Parameters ----------