Skip to content

Commit

Permalink
[TASK] lint
Browse files Browse the repository at this point in the history
  • Loading branch information
KartoffelToby committed Feb 8, 2024
1 parent 8c79bcf commit 84e4d4f
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions custom_components/better_thermostat/adapters/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions custom_components/better_thermostat/adapters/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions custom_components/better_thermostat/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions custom_components/better_thermostat/device_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
9 changes: 4 additions & 5 deletions custom_components/better_thermostat/events/trv.py
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
----------
Expand Down

0 comments on commit 84e4d4f

Please sign in to comment.