Update demetriek to v1.1.0 (#133064)

pull/133073/head
Franck Nijhof 2024-12-12 19:39:24 +01:00 committed by GitHub
parent 1205178702
commit b8ce1b010f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 14 additions and 6 deletions

View File

@ -13,7 +13,7 @@
"integration_type": "device",
"iot_class": "local_polling",
"loggers": ["demetriek"],
"requirements": ["demetriek==1.0.0"],
"requirements": ["demetriek==1.1.0"],
"ssdp": [
{
"deviceType": "urn:schemas-upnp-org:device:LaMetric:1"

View File

@ -25,6 +25,7 @@ class LaMetricNumberEntityDescription(NumberEntityDescription):
"""Class describing LaMetric number entities."""
value_fn: Callable[[Device], int | None]
has_fn: Callable[[Device], bool] = lambda device: True
set_value_fn: Callable[[LaMetricDevice, float], Awaitable[Any]]
@ -49,7 +50,8 @@ NUMBERS = [
native_step=1,
native_min_value=0,
native_max_value=100,
value_fn=lambda device: device.audio.volume,
has_fn=lambda device: bool(device.audio),
value_fn=lambda device: device.audio.volume if device.audio else 0,
set_value_fn=lambda api, volume: api.audio(volume=int(volume)),
),
]

View File

@ -25,6 +25,7 @@ class LaMetricSwitchEntityDescription(SwitchEntityDescription):
"""Class describing LaMetric switch entities."""
available_fn: Callable[[Device], bool] = lambda device: True
has_fn: Callable[[Device], bool] = lambda device: True
is_on_fn: Callable[[Device], bool]
set_fn: Callable[[LaMetricDevice, bool], Awaitable[Any]]
@ -34,8 +35,11 @@ SWITCHES = [
key="bluetooth",
translation_key="bluetooth",
entity_category=EntityCategory.CONFIG,
available_fn=lambda device: device.bluetooth.available,
is_on_fn=lambda device: device.bluetooth.active,
available_fn=lambda device: bool(
device.bluetooth and device.bluetooth.available
),
has_fn=lambda device: bool(device.bluetooth),
is_on_fn=lambda device: bool(device.bluetooth and device.bluetooth.active),
set_fn=lambda api, active: api.bluetooth(active=active),
),
]
@ -54,6 +58,7 @@ async def async_setup_entry(
description=description,
)
for description in SWITCHES
if description.has_fn(coordinator.data)
)

View File

@ -747,7 +747,7 @@ defusedxml==0.7.1
deluge-client==1.10.2
# homeassistant.components.lametric
demetriek==1.0.0
demetriek==1.1.0
# homeassistant.components.denonavr
denonavr==1.0.1

View File

@ -637,7 +637,7 @@ defusedxml==0.7.1
deluge-client==1.10.2
# homeassistant.components.lametric
demetriek==1.0.0
demetriek==1.1.0
# homeassistant.components.denonavr
denonavr==1.0.1

View File

@ -26,6 +26,7 @@
'brightness_mode': 'auto',
'display_type': 'mixed',
'height': 8,
'on': None,
'screensaver': dict({
'enabled': False,
}),