Skip to content

Commit

Permalink
Bugfixes for 2022.11 (#825)
Browse files Browse the repository at this point in the history
* Update HA dependencies

* Update pyoverkiz

* Fix breaking changes in core for select

* Fix number entity deprecation

* Fix entity registry
  • Loading branch information
iMicknl authored Nov 4, 2022
1 parent 69f9a2d commit 76c0582
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 22 deletions.
5 changes: 3 additions & 2 deletions custom_components/tahoma/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from homeassistant.helpers import (
config_validation as cv,
device_registry as dr,
entity_registry as er,
service,
)
from homeassistant.helpers.aiohttp_client import async_create_clientsession
Expand Down Expand Up @@ -138,7 +139,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

hass.config_entries.async_setup_platforms(entry, SUPPORTED_PLATFORMS)

device_registry = await dr.async_get_registry(hass)
device_registry = dr.async_get(hass)

for gateway in setup.gateways:
_LOGGER.debug("Added gateway (%s)", gateway)
Expand All @@ -155,7 +156,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

async def handle_execute_command(call: ServiceCall):
"""Handle execute command service."""
entity_registry = await hass.helpers.entity_registry.async_get_registry()
entity_registry = er.async_get(hass)

for entity_id in call.data.get("entity_id"):
entity = entity_registry.entities.get(entity_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
TEMP_CELSIUS,
)
from homeassistant.core import callback
from homeassistant.helpers import entity_registry as er
from homeassistant.helpers.event import async_track_state_change

from ..coordinator import OverkizDataUpdateCoordinator
Expand Down Expand Up @@ -106,7 +107,7 @@ async def async_added_to_hass(self):
):
return

entity_registry = await self.hass.helpers.entity_registry.async_get_registry()
entity_registry = er.async_get(self.hass)
self._temp_sensor_entity_id = next(
(
entity_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
TEMP_CELSIUS,
)
from homeassistant.core import callback
from homeassistant.helpers import entity_registry as er
from homeassistant.helpers.event import async_track_state_change

from ..coordinator import OverkizDataUpdateCoordinator
Expand Down Expand Up @@ -76,7 +77,7 @@ async def async_added_to_hass(self):
"""Register temperature sensor after added to hass."""
await super().async_added_to_hass()

entity_registry = await self.hass.helpers.entity_registry.async_get_registry()
entity_registry = er.async_get(self.hass)

# The linked temperature sensor uses subsystem_id + 1
new_subsystem_id = int(self.device_url.split("#", 1)[1]) + 1
Expand Down
4 changes: 2 additions & 2 deletions custom_components/tahoma/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/tahoma",
"requirements": [
"pyoverkiz==1.4.1"
"pyoverkiz==1.5.6"
],
"codeowners": [
"@imicknl",
Expand All @@ -23,4 +23,4 @@
"macaddress": "F8811A*"
}
]
}
}
20 changes: 10 additions & 10 deletions custom_components/tahoma/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class OverkizNumberDescription(NumberEntityDescription, OverkizNumberDescription
name="Expected Number Of Shower",
icon="mdi:shower-head",
command=OverkizCommand.SET_EXPECTED_NUMBER_OF_SHOWER,
min_value=2,
max_value=4,
native_min_value=2,
native_max_value=4,
entity_category=EntityCategory.CONFIG,
),
# SomfyHeatingTemperatureInterface
Expand All @@ -54,26 +54,26 @@ class OverkizNumberDescription(NumberEntityDescription, OverkizNumberDescription
name="Eco Room Temperature",
icon="mdi:thermometer",
command=OverkizCommand.SET_ECO_TEMPERATURE,
min_value=6,
max_value=29,
native_min_value=6,
native_max_value=29,
entity_category=EntityCategory.CONFIG,
),
OverkizNumberDescription(
key=OverkizState.CORE_COMFORT_ROOM_TEMPERATURE,
name="Comfort Room Temperature",
icon="mdi:home-thermometer-outline",
command=OverkizCommand.SET_COMFORT_TEMPERATURE,
min_value=7,
max_value=30,
native_min_value=7,
native_max_value=30,
entity_category=EntityCategory.CONFIG,
),
OverkizNumberDescription(
key=OverkizState.CORE_SECURED_POSITION_TEMPERATURE,
name="Freeze Protection Temperature",
icon="mdi:sun-thermometer-outline",
command=OverkizCommand.SET_SECURED_POSITION_TEMPERATURE,
min_value=5,
max_value=15,
native_min_value=5,
native_max_value=15,
entity_category=EntityCategory.CONFIG,
),
]
Expand Down Expand Up @@ -116,14 +116,14 @@ class OverkizNumber(OverkizDescriptiveEntity, NumberEntity):
entity_description: OverkizNumberDescription

@property
def value(self) -> float | None:
def native_value(self) -> float | None:
"""Return the entity value to represent the entity state."""
if state := self.device.states.get(self.entity_description.key):
return cast(float, state.value)

return None

async def async_set_value(self, value: float) -> None:
async def async_set_native_value(self, value: float) -> None:
"""Set new value."""
await self.executor.async_execute_command(
self.entity_description.command, value
Expand Down
1 change: 0 additions & 1 deletion custom_components/tahoma/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
class OverkizSelectDescriptionMixin:
"""Define an entity description mixin for select entities."""

options: list[str | OverkizCommandParam]
select_option: Callable[[str, Callable[..., Awaitable[None]]], Awaitable[None]]


Expand Down
4 changes: 2 additions & 2 deletions hacs.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Overkiz (by Somfy) - Custom component",
"homeassistant": "2022.5.0",
"homeassistant": "2022.11.0",
"render_readme": true
}
}
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pyoverkiz==1.4.1
pyoverkiz==1.5.6
2 changes: 1 addition & 1 deletion requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-r requirements.txt
homeassistant==2022.5.5
homeassistant==2022.11.0
2 changes: 1 addition & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-r requirements_dev.txt
pytest-homeassistant-custom-component==0.9.3
pytest-homeassistant-custom-component==0.12.17
# required for DHCP discovery test
scapy==2.4.5
aiodiscover==1.4.5
Expand Down

0 comments on commit 76c0582

Please sign in to comment.