1
0
mirror of https://github.com/home-assistant/core.git synced 2026-02-15 07:36:16 +00:00

Bump valbuasio to 2026.1.4 (#161270)

This commit is contained in:
Maikel Punie
2026-01-26 08:35:12 +01:00
committed by GitHub
parent c5e1787e3b
commit 2ee7155764
7 changed files with 17 additions and 14 deletions

View File

@@ -7,6 +7,7 @@ from functools import wraps
from typing import Any, Concatenate
from velbusaio.channels import Channel as VelbusChannel
from velbusaio.properties import Property as VelbusProperty
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.device_registry import DeviceInfo
@@ -27,7 +28,7 @@ class VelbusEntity(Entity):
_attr_has_entity_name = True
_attr_should_poll: bool = False
def __init__(self, channel: VelbusChannel) -> None:
def __init__(self, channel: VelbusChannel | VelbusProperty) -> None:
"""Initialize a Velbus entity."""
self._channel = channel
self._module_address = str(channel.get_module_address())

View File

@@ -14,7 +14,7 @@
"velbus-protocol"
],
"quality_scale": "silver",
"requirements": ["velbus-aio==2026.1.1"],
"requirements": ["velbus-aio==2026.1.4"],
"usb": [
{
"pid": "0B1B",

View File

@@ -1,6 +1,6 @@
"""Support for Velbus select."""
from velbusaio.channels import SelectedProgram
from velbusaio.properties import SelectedProgram
from homeassistant.components.select import SelectEntity
from homeassistant.const import EntityCategory

View File

@@ -5,7 +5,8 @@ from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass
from velbusaio.channels import ButtonCounter, LightSensor, SensorNumber, Temperature
from velbusaio.channels import ButtonCounter, SensorNumber, Temperature
from velbusaio.properties import LightValue
from homeassistant.components.sensor import (
SensorDeviceClass,
@@ -21,7 +22,7 @@ from .entity import VelbusEntity
PARALLEL_UPDATES = 0
type VelbusSensorChannel = ButtonCounter | Temperature | LightSensor | SensorNumber
type VelbusSensorChannel = ButtonCounter | Temperature | LightValue | SensorNumber
@dataclass(frozen=True, kw_only=True)
@@ -31,9 +32,7 @@ class VelbusSensorEntityDescription(SensorEntityDescription):
value_fn: Callable[[VelbusSensorChannel], float | None] = lambda channel: float(
channel.get_state()
)
unit_fn: Callable[[VelbusSensorChannel], str | None] = (
lambda channel: channel.get_unit()
)
unit_fn: Callable[[VelbusSensorChannel], str | None] | None = None
unique_id_suffix: str = ""
@@ -42,15 +41,18 @@ SENSOR_DESCRIPTIONS: dict[str, VelbusSensorEntityDescription] = {
key="power",
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
unit_fn=lambda channel: channel.get_unit(),
),
"temperature": VelbusSensorEntityDescription(
key="temperature",
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
unit_fn=lambda channel: channel.get_unit(),
),
"measurement": VelbusSensorEntityDescription(
key="measurement",
state_class=SensorStateClass.MEASUREMENT,
unit_fn=lambda channel: channel.get_unit(),
),
"counter": VelbusSensorEntityDescription(
key="counter",
@@ -108,7 +110,8 @@ class VelbusSensor(VelbusEntity, SensorEntity):
super().__init__(channel)
self.entity_description = description
self._is_counter = is_counter
self._attr_native_unit_of_measurement = description.unit_fn(channel)
if description.unit_fn:
self._attr_native_unit_of_measurement = description.unit_fn(channel)
self._attr_unique_id = f"{self._attr_unique_id}{description.unique_id_suffix}"
# Modify name for counter entities

2
requirements_all.txt generated
View File

@@ -3124,7 +3124,7 @@ vegehub==0.1.26
vehicle==2.2.2
# homeassistant.components.velbus
velbus-aio==2026.1.1
velbus-aio==2026.1.4
# homeassistant.components.venstar
venstarcolortouch==0.21

View File

@@ -2615,7 +2615,7 @@ vegehub==0.1.26
vehicle==2.2.2
# homeassistant.components.velbus
velbus-aio==2026.1.1
velbus-aio==2026.1.4
# homeassistant.components.venstar
venstarcolortouch==0.21

View File

@@ -9,13 +9,12 @@ from velbusaio.channels import (
Button,
ButtonCounter,
Dimmer,
LightSensor,
Relay,
SelectedProgram,
SensorNumber,
Temperature,
)
from velbusaio.module import Module
from velbusaio.properties import LightValue, SelectedProgram
from homeassistant.components.velbus import VelbusConfigEntry
from homeassistant.components.velbus.const import DOMAIN
@@ -238,7 +237,7 @@ def mock_sensornumber() -> AsyncMock:
@pytest.fixture
def mock_lightsensor() -> AsyncMock:
"""Mock a successful velbus channel."""
channel = AsyncMock(spec=LightSensor)
channel = AsyncMock(spec=LightValue)
channel.get_categories.return_value = ["sensor"]
channel.get_name.return_value = "LightSensor"
channel.get_module_address.return_value = 2