Add Homee number platform (#138962)
Co-authored-by: Joostlek <joostlek@outlook.com>pull/139266/head
parent
2b55f3af36
commit
3059d06960
|
@ -18,6 +18,7 @@ PLATFORMS = [
|
|||
Platform.BUTTON,
|
||||
Platform.COVER,
|
||||
Platform.LIGHT,
|
||||
Platform.NUMBER,
|
||||
Platform.SENSOR,
|
||||
Platform.SWITCH,
|
||||
Platform.VALVE,
|
||||
|
|
|
@ -75,4 +75,4 @@ class HomeeButton(HomeeEntity, ButtonEntity):
|
|||
|
||||
async def async_press(self) -> None:
|
||||
"""Handle the button press."""
|
||||
await self.async_set_value(1)
|
||||
await self.async_set_homee_value(1)
|
||||
|
|
|
@ -205,17 +205,17 @@ class HomeeCover(HomeeNodeEntity, CoverEntity):
|
|||
"""Open the cover."""
|
||||
assert self._open_close_attribute is not None
|
||||
if not self._open_close_attribute.is_reversed:
|
||||
await self.async_set_value(self._open_close_attribute, 0)
|
||||
await self.async_set_homee_value(self._open_close_attribute, 0)
|
||||
else:
|
||||
await self.async_set_value(self._open_close_attribute, 1)
|
||||
await self.async_set_homee_value(self._open_close_attribute, 1)
|
||||
|
||||
async def async_close_cover(self, **kwargs: Any) -> None:
|
||||
"""Close cover."""
|
||||
assert self._open_close_attribute is not None
|
||||
if not self._open_close_attribute.is_reversed:
|
||||
await self.async_set_value(self._open_close_attribute, 1)
|
||||
await self.async_set_homee_value(self._open_close_attribute, 1)
|
||||
else:
|
||||
await self.async_set_value(self._open_close_attribute, 0)
|
||||
await self.async_set_homee_value(self._open_close_attribute, 0)
|
||||
|
||||
async def async_set_cover_position(self, **kwargs: Any) -> None:
|
||||
"""Move the cover to a specific position."""
|
||||
|
@ -230,12 +230,12 @@ class HomeeCover(HomeeNodeEntity, CoverEntity):
|
|||
homee_max = attribute.maximum
|
||||
homee_position = (position / 100) * (homee_max - homee_min) + homee_min
|
||||
|
||||
await self.async_set_value(attribute, homee_position)
|
||||
await self.async_set_homee_value(attribute, homee_position)
|
||||
|
||||
async def async_stop_cover(self, **kwargs: Any) -> None:
|
||||
"""Stop the cover."""
|
||||
if self._open_close_attribute is not None:
|
||||
await self.async_set_value(self._open_close_attribute, 2)
|
||||
await self.async_set_homee_value(self._open_close_attribute, 2)
|
||||
|
||||
async def async_open_cover_tilt(self, **kwargs: Any) -> None:
|
||||
"""Open the cover tilt."""
|
||||
|
@ -245,9 +245,9 @@ class HomeeCover(HomeeNodeEntity, CoverEntity):
|
|||
)
|
||||
) is not None:
|
||||
if not slat_attribute.is_reversed:
|
||||
await self.async_set_value(slat_attribute, 2)
|
||||
await self.async_set_homee_value(slat_attribute, 2)
|
||||
else:
|
||||
await self.async_set_value(slat_attribute, 1)
|
||||
await self.async_set_homee_value(slat_attribute, 1)
|
||||
|
||||
async def async_close_cover_tilt(self, **kwargs: Any) -> None:
|
||||
"""Close the cover tilt."""
|
||||
|
@ -257,9 +257,9 @@ class HomeeCover(HomeeNodeEntity, CoverEntity):
|
|||
)
|
||||
) is not None:
|
||||
if not slat_attribute.is_reversed:
|
||||
await self.async_set_value(slat_attribute, 1)
|
||||
await self.async_set_homee_value(slat_attribute, 1)
|
||||
else:
|
||||
await self.async_set_value(slat_attribute, 2)
|
||||
await self.async_set_homee_value(slat_attribute, 2)
|
||||
|
||||
async def async_set_cover_tilt_position(self, **kwargs: Any) -> None:
|
||||
"""Move the cover tilt to a specific position."""
|
||||
|
@ -276,4 +276,4 @@ class HomeeCover(HomeeNodeEntity, CoverEntity):
|
|||
homee_max = attribute.maximum
|
||||
homee_position = (position / 100) * (homee_max - homee_min) + homee_min
|
||||
|
||||
await self.async_set_value(attribute, homee_position)
|
||||
await self.async_set_homee_value(attribute, homee_position)
|
||||
|
|
|
@ -54,7 +54,7 @@ class HomeeEntity(Entity):
|
|||
"""Return the availability of the underlying node."""
|
||||
return (self._attribute.state == AttributeState.NORMAL) and self._host_connected
|
||||
|
||||
async def async_set_value(self, value: float) -> None:
|
||||
async def async_set_homee_value(self, value: float) -> None:
|
||||
"""Set an attribute value on the homee node."""
|
||||
homee = self._entry.runtime_data
|
||||
try:
|
||||
|
@ -144,7 +144,9 @@ class HomeeNodeEntity(Entity):
|
|||
|
||||
return None
|
||||
|
||||
async def async_set_value(self, attribute: HomeeAttribute, value: float) -> None:
|
||||
async def async_set_homee_value(
|
||||
self, attribute: HomeeAttribute, value: float
|
||||
) -> None:
|
||||
"""Set an attribute value on the homee node."""
|
||||
homee = self._entry.runtime_data
|
||||
try:
|
||||
|
|
|
@ -175,24 +175,26 @@ class HomeeLight(HomeeNodeEntity, LightEntity):
|
|||
kwargs[ATTR_BRIGHTNESS],
|
||||
)
|
||||
)
|
||||
await self.async_set_value(self._dimmer_attr, target_value)
|
||||
await self.async_set_homee_value(self._dimmer_attr, target_value)
|
||||
else:
|
||||
# If no brightness value is given, just turn on.
|
||||
await self.async_set_value(self._on_off_attr, 1)
|
||||
await self.async_set_homee_value(self._on_off_attr, 1)
|
||||
|
||||
if ATTR_COLOR_TEMP_KELVIN in kwargs and self._temp_attr is not None:
|
||||
await self.async_set_value(self._temp_attr, kwargs[ATTR_COLOR_TEMP_KELVIN])
|
||||
await self.async_set_homee_value(
|
||||
self._temp_attr, kwargs[ATTR_COLOR_TEMP_KELVIN]
|
||||
)
|
||||
if ATTR_HS_COLOR in kwargs:
|
||||
color = kwargs[ATTR_HS_COLOR]
|
||||
if self._col_attr is not None:
|
||||
await self.async_set_value(
|
||||
await self.async_set_homee_value(
|
||||
self._col_attr,
|
||||
rgb_list_to_decimal(color_hs_to_RGB(*color)),
|
||||
)
|
||||
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Instruct the light to turn off."""
|
||||
await self.async_set_value(self._on_off_attr, 0)
|
||||
await self.async_set_homee_value(self._on_off_attr, 0)
|
||||
|
||||
def _get_supported_color_modes(self) -> set[ColorMode]:
|
||||
"""Determine the supported color modes from the available attributes."""
|
||||
|
|
|
@ -0,0 +1,130 @@
|
|||
"""The Homee number platform."""
|
||||
|
||||
from pyHomee.const import AttributeType
|
||||
from pyHomee.model import HomeeAttribute
|
||||
|
||||
from homeassistant.components.number import (
|
||||
NumberDeviceClass,
|
||||
NumberEntity,
|
||||
NumberEntityDescription,
|
||||
)
|
||||
from homeassistant.const import EntityCategory
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
from . import HomeeConfigEntry
|
||||
from .const import HOMEE_UNIT_TO_HA_UNIT
|
||||
from .entity import HomeeEntity
|
||||
|
||||
NUMBER_DESCRIPTIONS = {
|
||||
AttributeType.DOWN_POSITION: NumberEntityDescription(
|
||||
key="down_position",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
AttributeType.DOWN_SLAT_POSITION: NumberEntityDescription(
|
||||
key="down_slat_position",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
AttributeType.DOWN_TIME: NumberEntityDescription(
|
||||
key="down_time",
|
||||
device_class=NumberDeviceClass.DURATION,
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
AttributeType.ENDPOSITION_CONFIGURATION: NumberEntityDescription(
|
||||
key="endposition_configuration",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
AttributeType.MOTION_ALARM_CANCELATION_DELAY: NumberEntityDescription(
|
||||
key="motion_alarm_cancelation_delay",
|
||||
device_class=NumberDeviceClass.DURATION,
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
AttributeType.OPEN_WINDOW_DETECTION_SENSIBILITY: NumberEntityDescription(
|
||||
key="open_window_detection_sensibility",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
AttributeType.POLLING_INTERVAL: NumberEntityDescription(
|
||||
key="polling_interval",
|
||||
device_class=NumberDeviceClass.DURATION,
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
AttributeType.SHUTTER_SLAT_TIME: NumberEntityDescription(
|
||||
key="shutter_slat_time",
|
||||
device_class=NumberDeviceClass.DURATION,
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
AttributeType.SLAT_MAX_ANGLE: NumberEntityDescription(
|
||||
key="slat_max_angle",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
AttributeType.SLAT_MIN_ANGLE: NumberEntityDescription(
|
||||
key="slat_min_angle",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
AttributeType.SLAT_STEPS: NumberEntityDescription(
|
||||
key="slat_steps",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
AttributeType.TEMPERATURE_OFFSET: NumberEntityDescription(
|
||||
key="temperature_offset",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
AttributeType.UP_TIME: NumberEntityDescription(
|
||||
key="up_time",
|
||||
device_class=NumberDeviceClass.DURATION,
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
AttributeType.WAKE_UP_INTERVAL: NumberEntityDescription(
|
||||
key="wake_up_interval",
|
||||
device_class=NumberDeviceClass.DURATION,
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant,
|
||||
config_entry: HomeeConfigEntry,
|
||||
async_add_entities: AddConfigEntryEntitiesCallback,
|
||||
) -> None:
|
||||
"""Add the Homee platform for the number component."""
|
||||
|
||||
async_add_entities(
|
||||
HomeeNumber(attribute, config_entry, NUMBER_DESCRIPTIONS[attribute.type])
|
||||
for node in config_entry.runtime_data.nodes
|
||||
for attribute in node.attributes
|
||||
if attribute.type in NUMBER_DESCRIPTIONS and attribute.data != "fixed_value"
|
||||
)
|
||||
|
||||
|
||||
class HomeeNumber(HomeeEntity, NumberEntity):
|
||||
"""Representation of a Homee number."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
attribute: HomeeAttribute,
|
||||
entry: HomeeConfigEntry,
|
||||
description: NumberEntityDescription,
|
||||
) -> None:
|
||||
"""Initialize a Homee number entity."""
|
||||
super().__init__(attribute, entry)
|
||||
self.entity_description = description
|
||||
self._attr_translation_key = description.key
|
||||
self._attr_native_unit_of_measurement = HOMEE_UNIT_TO_HA_UNIT[attribute.unit]
|
||||
self._attr_native_min_value = attribute.minimum
|
||||
self._attr_native_max_value = attribute.maximum
|
||||
self._attr_native_step = attribute.step_value
|
||||
|
||||
@property
|
||||
def available(self) -> bool:
|
||||
"""Return the availability of the entity."""
|
||||
return super().available and self._attribute.editable
|
||||
|
||||
@property
|
||||
def native_value(self) -> int:
|
||||
"""Return the native value of the number."""
|
||||
return int(self._attribute.current_value)
|
||||
|
||||
async def async_set_native_value(self, value: float) -> None:
|
||||
"""Set the selected value."""
|
||||
await self.async_set_homee_value(value)
|
|
@ -66,6 +66,50 @@
|
|||
"name": "Light {instance}"
|
||||
}
|
||||
},
|
||||
"number": {
|
||||
"down_position": {
|
||||
"name": "Down position"
|
||||
},
|
||||
"down_slat_position": {
|
||||
"name": "Down slat position"
|
||||
},
|
||||
"down_time": {
|
||||
"name": "Down-movement duration"
|
||||
},
|
||||
"endposition_configuration": {
|
||||
"name": "End position"
|
||||
},
|
||||
"motion_alarm_cancelation_delay": {
|
||||
"name": "Motion alarm delay"
|
||||
},
|
||||
"open_window_detection_sensibility": {
|
||||
"name": "Window open sensibility"
|
||||
},
|
||||
"polling_interval": {
|
||||
"name": "Polling interval"
|
||||
},
|
||||
"shutter_slat_time": {
|
||||
"name": "Slat turn duration"
|
||||
},
|
||||
"slat_max_angle": {
|
||||
"name": "Maximum slat angle"
|
||||
},
|
||||
"slat_min_angle": {
|
||||
"name": "Minimum slat angle"
|
||||
},
|
||||
"slat_steps": {
|
||||
"name": "Slat steps"
|
||||
},
|
||||
"temperature_offset": {
|
||||
"name": "Temperature offset"
|
||||
},
|
||||
"up_time": {
|
||||
"name": "Up-movement duration"
|
||||
},
|
||||
"wake_up_interval": {
|
||||
"name": "Wake-up interval"
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
"brightness_instance": {
|
||||
"name": "Illuminance {instance}"
|
||||
|
|
|
@ -120,8 +120,8 @@ class HomeeSwitch(HomeeEntity, SwitchEntity):
|
|||
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the switch on."""
|
||||
await self.async_set_value(1)
|
||||
await self.async_set_homee_value(1)
|
||||
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn the switch off."""
|
||||
await self.async_set_value(0)
|
||||
await self.async_set_homee_value(0)
|
||||
|
|
|
@ -78,4 +78,4 @@ class HomeeValve(HomeeEntity, ValveEntity):
|
|||
|
||||
async def async_set_valve_position(self, position: int) -> None:
|
||||
"""Move the valve to a specific position."""
|
||||
await self.async_set_value(position)
|
||||
await self.async_set_homee_value(position)
|
||||
|
|
|
@ -0,0 +1,337 @@
|
|||
{
|
||||
"id": 1,
|
||||
"name": "Test Number",
|
||||
"profile": 2011,
|
||||
"image": "default",
|
||||
"favorite": 0,
|
||||
"order": 1,
|
||||
"protocol": 3,
|
||||
"routing": 0,
|
||||
"state": 1,
|
||||
"state_changed": 1731020474,
|
||||
"added": 1680027411,
|
||||
"history": 1,
|
||||
"cube_type": 3,
|
||||
"note": "",
|
||||
"services": 0,
|
||||
"phonetic_name": "",
|
||||
"owner": 2,
|
||||
"security": 0,
|
||||
"attributes": [
|
||||
{
|
||||
"id": 2,
|
||||
"node_id": 1,
|
||||
"instance": 0,
|
||||
"minimum": 0,
|
||||
"maximum": 100,
|
||||
"current_value": 100.0,
|
||||
"target_value": 100.0,
|
||||
"last_value": 100.0,
|
||||
"unit": "%",
|
||||
"step_value": 0.5,
|
||||
"editable": 1,
|
||||
"type": 349,
|
||||
"state": 1,
|
||||
"last_changed": 1624446307,
|
||||
"changed_by": 1,
|
||||
"changed_by_id": 0,
|
||||
"based_on": 1,
|
||||
"data": "",
|
||||
"name": ""
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"node_id": 1,
|
||||
"instance": 0,
|
||||
"minimum": -75,
|
||||
"maximum": 75,
|
||||
"current_value": 38.0,
|
||||
"target_value": 38.0,
|
||||
"last_value": 38.0,
|
||||
"unit": "°",
|
||||
"step_value": 1.0,
|
||||
"editable": 1,
|
||||
"type": 350,
|
||||
"state": 1,
|
||||
"last_changed": 1624446307,
|
||||
"changed_by": 1,
|
||||
"changed_by_id": 0,
|
||||
"based_on": 1,
|
||||
"data": "",
|
||||
"name": ""
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"node_id": 1,
|
||||
"instance": 0,
|
||||
"minimum": 4,
|
||||
"maximum": 240,
|
||||
"current_value": 57.0,
|
||||
"target_value": 57.0,
|
||||
"last_value": 90.0,
|
||||
"unit": "s",
|
||||
"step_value": 1.0,
|
||||
"editable": 1,
|
||||
"type": 111,
|
||||
"state": 1,
|
||||
"last_changed": 1615396252,
|
||||
"changed_by": 1,
|
||||
"changed_by_id": 0,
|
||||
"based_on": 1,
|
||||
"data": "",
|
||||
"name": ""
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"node_id": 1,
|
||||
"instance": 0,
|
||||
"minimum": 0,
|
||||
"maximum": 130,
|
||||
"current_value": 129.0,
|
||||
"target_value": 129.0,
|
||||
"last_value": 1.0,
|
||||
"unit": "n/a",
|
||||
"step_value": 1.0,
|
||||
"editable": 1,
|
||||
"type": 325,
|
||||
"state": 1,
|
||||
"last_changed": 1672086680,
|
||||
"changed_by": 1,
|
||||
"changed_by_id": 0,
|
||||
"based_on": 1,
|
||||
"data": "",
|
||||
"name": ""
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"node_id": 1,
|
||||
"instance": 0,
|
||||
"minimum": 1,
|
||||
"maximum": 15300,
|
||||
"current_value": 10.0,
|
||||
"target_value": 1.0,
|
||||
"last_value": 10.0,
|
||||
"unit": "s",
|
||||
"step_value": 1.0,
|
||||
"editable": 0,
|
||||
"type": 28,
|
||||
"state": 1,
|
||||
"last_changed": 1676204559,
|
||||
"changed_by": 0,
|
||||
"changed_by_id": 0,
|
||||
"based_on": 1,
|
||||
"data": "",
|
||||
"name": ""
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"node_id": 1,
|
||||
"instance": 0,
|
||||
"minimum": 0,
|
||||
"maximum": 3,
|
||||
"current_value": 3.0,
|
||||
"target_value": 3.0,
|
||||
"last_value": 2.0,
|
||||
"unit": "",
|
||||
"step_value": 1.0,
|
||||
"editable": 1,
|
||||
"type": 261,
|
||||
"state": 1,
|
||||
"last_changed": 1666336770,
|
||||
"changed_by": 1,
|
||||
"changed_by_id": 0,
|
||||
"based_on": 1,
|
||||
"data": "",
|
||||
"name": ""
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"node_id": 1,
|
||||
"instance": 0,
|
||||
"minimum": 5,
|
||||
"maximum": 45,
|
||||
"current_value": 30.0,
|
||||
"target_value": 30.0,
|
||||
"last_value": 0.0,
|
||||
"unit": "min",
|
||||
"step_value": 5.0,
|
||||
"editable": 1,
|
||||
"type": 88,
|
||||
"state": 1,
|
||||
"last_changed": 1672086680,
|
||||
"changed_by": 1,
|
||||
"changed_by_id": 0,
|
||||
"based_on": 1,
|
||||
"data": "",
|
||||
"name": ""
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"node_id": 1,
|
||||
"instance": 0,
|
||||
"minimum": 0,
|
||||
"maximum": 24,
|
||||
"current_value": 1.6,
|
||||
"target_value": 1.6,
|
||||
"last_value": 0.0,
|
||||
"unit": "s",
|
||||
"step_value": 0.1,
|
||||
"editable": 1,
|
||||
"type": 114,
|
||||
"state": 1,
|
||||
"last_changed": 1615396156,
|
||||
"changed_by": 1,
|
||||
"changed_by_id": 0,
|
||||
"based_on": 1,
|
||||
"data": "",
|
||||
"name": ""
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"node_id": 1,
|
||||
"instance": 0,
|
||||
"minimum": -127,
|
||||
"maximum": 127,
|
||||
"current_value": 75.0,
|
||||
"target_value": 75.0,
|
||||
"last_value": 0.0,
|
||||
"unit": "°",
|
||||
"step_value": 1.0,
|
||||
"editable": 1,
|
||||
"type": 323,
|
||||
"state": 1,
|
||||
"last_changed": 1615396156,
|
||||
"changed_by": 1,
|
||||
"changed_by_id": 0,
|
||||
"based_on": 1,
|
||||
"data": "",
|
||||
"name": ""
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"node_id": 1,
|
||||
"instance": 0,
|
||||
"minimum": -127,
|
||||
"maximum": 127,
|
||||
"current_value": -75.0,
|
||||
"target_value": -75.0,
|
||||
"last_value": 0.0,
|
||||
"unit": "°",
|
||||
"step_value": 1.0,
|
||||
"editable": 1,
|
||||
"type": 322,
|
||||
"state": 1,
|
||||
"last_changed": 1615396156,
|
||||
"changed_by": 1,
|
||||
"changed_by_id": 0,
|
||||
"based_on": 1,
|
||||
"data": "",
|
||||
"name": ""
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"node_id": 1,
|
||||
"instance": 0,
|
||||
"minimum": 1,
|
||||
"maximum": 20,
|
||||
"current_value": 6.0,
|
||||
"target_value": 6.0,
|
||||
"last_value": 1.0,
|
||||
"unit": "n/a",
|
||||
"step_value": 1.0,
|
||||
"editable": 1,
|
||||
"type": 174,
|
||||
"state": 1,
|
||||
"last_changed": 1672149083,
|
||||
"changed_by": 1,
|
||||
"changed_by_id": 0,
|
||||
"based_on": 1,
|
||||
"data": "",
|
||||
"name": ""
|
||||
},
|
||||
{
|
||||
"id": 13,
|
||||
"node_id": 1,
|
||||
"instance": 0,
|
||||
"minimum": -5,
|
||||
"maximum": 128,
|
||||
"current_value": -3,
|
||||
"target_value": -3,
|
||||
"last_value": 128.0,
|
||||
"unit": "°C",
|
||||
"step_value": 0.1,
|
||||
"editable": 1,
|
||||
"type": 64,
|
||||
"state": 6,
|
||||
"last_changed": 1711799534,
|
||||
"changed_by": 1,
|
||||
"changed_by_id": 0,
|
||||
"based_on": 1,
|
||||
"data": "",
|
||||
"name": ""
|
||||
},
|
||||
{
|
||||
"id": 14,
|
||||
"node_id": 1,
|
||||
"instance": 0,
|
||||
"minimum": 4,
|
||||
"maximum": 240,
|
||||
"current_value": 57.0,
|
||||
"target_value": 57.0,
|
||||
"last_value": 90.0,
|
||||
"unit": "s",
|
||||
"step_value": 1.0,
|
||||
"editable": 1,
|
||||
"type": 110,
|
||||
"state": 1,
|
||||
"last_changed": 1615396246,
|
||||
"changed_by": 1,
|
||||
"changed_by_id": 0,
|
||||
"based_on": 1,
|
||||
"data": "",
|
||||
"name": ""
|
||||
},
|
||||
{
|
||||
"id": 15,
|
||||
"node_id": 1,
|
||||
"instance": 0,
|
||||
"minimum": 30,
|
||||
"maximum": 7200,
|
||||
"current_value": 600.0,
|
||||
"target_value": 600.0,
|
||||
"last_value": 600.0,
|
||||
"unit": "min",
|
||||
"step_value": 30.0,
|
||||
"editable": 1,
|
||||
"type": 29,
|
||||
"state": 1,
|
||||
"last_changed": 1739333970,
|
||||
"changed_by": 1,
|
||||
"changed_by_id": 0,
|
||||
"based_on": 1,
|
||||
"data": "",
|
||||
"name": ""
|
||||
},
|
||||
{
|
||||
"id": 16,
|
||||
"node_id": 1,
|
||||
"instance": 0,
|
||||
"minimum": 0,
|
||||
"maximum": 240,
|
||||
"current_value": 12.0,
|
||||
"target_value": 12.0,
|
||||
"last_value": 12.0,
|
||||
"unit": "h",
|
||||
"step_value": 1.0,
|
||||
"editable": 0,
|
||||
"type": 29,
|
||||
"state": 1,
|
||||
"last_changed": 1735964135,
|
||||
"changed_by": 1,
|
||||
"changed_by_id": 0,
|
||||
"based_on": 1,
|
||||
"data": "fixed_value",
|
||||
"name": ""
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,802 @@
|
|||
# serializer version: 1
|
||||
# name: test_number_snapshot[number.test_number_down_movement_duration-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'max': 240,
|
||||
'min': 4,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'number',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'number.test_number_down_movement_duration',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <NumberDeviceClass.DURATION: 'duration'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Down-movement duration',
|
||||
'platform': 'homee',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'down_time',
|
||||
'unique_id': '00055511EECC-1-4',
|
||||
'unit_of_measurement': <UnitOfTime.SECONDS: 's'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_down_movement_duration-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'duration',
|
||||
'friendly_name': 'Test Number Down-movement duration',
|
||||
'max': 240,
|
||||
'min': 4,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
'unit_of_measurement': <UnitOfTime.SECONDS: 's'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'number.test_number_down_movement_duration',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '57',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_down_position-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'max': 100,
|
||||
'min': 0,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 0.5,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'number',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'number.test_number_down_position',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Down position',
|
||||
'platform': 'homee',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'down_position',
|
||||
'unique_id': '00055511EECC-1-2',
|
||||
'unit_of_measurement': '%',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_down_position-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Test Number Down position',
|
||||
'max': 100,
|
||||
'min': 0,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 0.5,
|
||||
'unit_of_measurement': '%',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'number.test_number_down_position',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '100',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_down_slat_position-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'max': 75,
|
||||
'min': -75,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'number',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'number.test_number_down_slat_position',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Down slat position',
|
||||
'platform': 'homee',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'down_slat_position',
|
||||
'unique_id': '00055511EECC-1-3',
|
||||
'unit_of_measurement': '°',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_down_slat_position-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Test Number Down slat position',
|
||||
'max': 75,
|
||||
'min': -75,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
'unit_of_measurement': '°',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'number.test_number_down_slat_position',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '38',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_end_position-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'max': 130,
|
||||
'min': 0,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'number',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'number.test_number_end_position',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'End position',
|
||||
'platform': 'homee',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'endposition_configuration',
|
||||
'unique_id': '00055511EECC-1-5',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_end_position-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Test Number End position',
|
||||
'max': 130,
|
||||
'min': 0,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'number.test_number_end_position',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '129',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_maximum_slat_angle-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'max': 127,
|
||||
'min': -127,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'number',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'number.test_number_maximum_slat_angle',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Maximum slat angle',
|
||||
'platform': 'homee',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'slat_max_angle',
|
||||
'unique_id': '00055511EECC-1-10',
|
||||
'unit_of_measurement': '°',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_maximum_slat_angle-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Test Number Maximum slat angle',
|
||||
'max': 127,
|
||||
'min': -127,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
'unit_of_measurement': '°',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'number.test_number_maximum_slat_angle',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '75',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_minimum_slat_angle-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'max': 127,
|
||||
'min': -127,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'number',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'number.test_number_minimum_slat_angle',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Minimum slat angle',
|
||||
'platform': 'homee',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'slat_min_angle',
|
||||
'unique_id': '00055511EECC-1-11',
|
||||
'unit_of_measurement': '°',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_minimum_slat_angle-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Test Number Minimum slat angle',
|
||||
'max': 127,
|
||||
'min': -127,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
'unit_of_measurement': '°',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'number.test_number_minimum_slat_angle',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '-75',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_motion_alarm_delay-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'max': 15300,
|
||||
'min': 1,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'number',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'number.test_number_motion_alarm_delay',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <NumberDeviceClass.DURATION: 'duration'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Motion alarm delay',
|
||||
'platform': 'homee',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'motion_alarm_cancelation_delay',
|
||||
'unique_id': '00055511EECC-1-6',
|
||||
'unit_of_measurement': <UnitOfTime.SECONDS: 's'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_motion_alarm_delay-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'duration',
|
||||
'friendly_name': 'Test Number Motion alarm delay',
|
||||
'max': 15300,
|
||||
'min': 1,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
'unit_of_measurement': <UnitOfTime.SECONDS: 's'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'number.test_number_motion_alarm_delay',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unavailable',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_polling_interval-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'max': 45,
|
||||
'min': 5,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 5.0,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'number',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'number.test_number_polling_interval',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <NumberDeviceClass.DURATION: 'duration'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Polling interval',
|
||||
'platform': 'homee',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'polling_interval',
|
||||
'unique_id': '00055511EECC-1-8',
|
||||
'unit_of_measurement': <UnitOfTime.MINUTES: 'min'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_polling_interval-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'duration',
|
||||
'friendly_name': 'Test Number Polling interval',
|
||||
'max': 45,
|
||||
'min': 5,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 5.0,
|
||||
'unit_of_measurement': <UnitOfTime.MINUTES: 'min'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'number.test_number_polling_interval',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '30',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_slat_steps-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'max': 20,
|
||||
'min': 1,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'number',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'number.test_number_slat_steps',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Slat steps',
|
||||
'platform': 'homee',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'slat_steps',
|
||||
'unique_id': '00055511EECC-1-12',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_slat_steps-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Test Number Slat steps',
|
||||
'max': 20,
|
||||
'min': 1,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'number.test_number_slat_steps',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '6',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_slat_turn_duration-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'max': 24,
|
||||
'min': 0,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 0.1,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'number',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'number.test_number_slat_turn_duration',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <NumberDeviceClass.DURATION: 'duration'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Slat turn duration',
|
||||
'platform': 'homee',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'shutter_slat_time',
|
||||
'unique_id': '00055511EECC-1-9',
|
||||
'unit_of_measurement': <UnitOfTime.SECONDS: 's'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_slat_turn_duration-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'duration',
|
||||
'friendly_name': 'Test Number Slat turn duration',
|
||||
'max': 24,
|
||||
'min': 0,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 0.1,
|
||||
'unit_of_measurement': <UnitOfTime.SECONDS: 's'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'number.test_number_slat_turn_duration',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '1',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_temperature_offset-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'max': 128,
|
||||
'min': -5,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 0.1,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'number',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'number.test_number_temperature_offset',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Temperature offset',
|
||||
'platform': 'homee',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'temperature_offset',
|
||||
'unique_id': '00055511EECC-1-13',
|
||||
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_temperature_offset-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Test Number Temperature offset',
|
||||
'max': 128,
|
||||
'min': -5,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 0.1,
|
||||
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'number.test_number_temperature_offset',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unavailable',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_up_movement_duration-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'max': 240,
|
||||
'min': 4,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'number',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'number.test_number_up_movement_duration',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <NumberDeviceClass.DURATION: 'duration'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Up-movement duration',
|
||||
'platform': 'homee',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'up_time',
|
||||
'unique_id': '00055511EECC-1-14',
|
||||
'unit_of_measurement': <UnitOfTime.SECONDS: 's'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_up_movement_duration-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'duration',
|
||||
'friendly_name': 'Test Number Up-movement duration',
|
||||
'max': 240,
|
||||
'min': 4,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
'unit_of_measurement': <UnitOfTime.SECONDS: 's'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'number.test_number_up_movement_duration',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '57',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_wake_up_interval-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'max': 7200,
|
||||
'min': 30,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 30.0,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'number',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'number.test_number_wake_up_interval',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <NumberDeviceClass.DURATION: 'duration'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Wake-up interval',
|
||||
'platform': 'homee',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'wake_up_interval',
|
||||
'unique_id': '00055511EECC-1-15',
|
||||
'unit_of_measurement': <UnitOfTime.MINUTES: 'min'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_wake_up_interval-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'duration',
|
||||
'friendly_name': 'Test Number Wake-up interval',
|
||||
'max': 7200,
|
||||
'min': 30,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 30.0,
|
||||
'unit_of_measurement': <UnitOfTime.MINUTES: 'min'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'number.test_number_wake_up_interval',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '600',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_window_open_sensibility-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'max': 3,
|
||||
'min': 0,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'number',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'number.test_number_window_open_sensibility',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Window open sensibility',
|
||||
'platform': 'homee',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'open_window_detection_sensibility',
|
||||
'unique_id': '00055511EECC-1-7',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_number_snapshot[number.test_number_window_open_sensibility-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Test Number Window open sensibility',
|
||||
'max': 3,
|
||||
'min': 0,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'number.test_number_window_open_sensibility',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '3',
|
||||
})
|
||||
# ---
|
|
@ -0,0 +1,74 @@
|
|||
"""Test Homee nmumbers."""
|
||||
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.number import (
|
||||
ATTR_VALUE,
|
||||
DOMAIN as NUMBER_DOMAIN,
|
||||
SERVICE_SET_VALUE,
|
||||
)
|
||||
from homeassistant.const import ATTR_ENTITY_ID, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from . import build_mock_node, setup_integration
|
||||
|
||||
from tests.common import MockConfigEntry, snapshot_platform
|
||||
|
||||
|
||||
async def test_set_value(
|
||||
hass: HomeAssistant,
|
||||
mock_homee: MagicMock,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
) -> None:
|
||||
"""Test set_value service."""
|
||||
mock_homee.nodes = [build_mock_node("numbers.json")]
|
||||
mock_homee.get_node_by_id.return_value = mock_homee.nodes[0]
|
||||
await setup_integration(hass, mock_config_entry)
|
||||
|
||||
await hass.services.async_call(
|
||||
NUMBER_DOMAIN,
|
||||
SERVICE_SET_VALUE,
|
||||
{ATTR_ENTITY_ID: "number.test_number_down_position", ATTR_VALUE: 90},
|
||||
blocking=True,
|
||||
)
|
||||
number = mock_homee.nodes[0].attributes[0]
|
||||
mock_homee.set_value.assert_called_once_with(number.node_id, number.id, 90)
|
||||
|
||||
|
||||
async def test_set_value_not_editable(
|
||||
hass: HomeAssistant,
|
||||
mock_homee: MagicMock,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
) -> None:
|
||||
"""Test set_value if attribute is not editable."""
|
||||
mock_homee.nodes = [build_mock_node("numbers.json")]
|
||||
mock_homee.get_node_by_id.return_value = mock_homee.nodes[0]
|
||||
await setup_integration(hass, mock_config_entry)
|
||||
|
||||
await hass.services.async_call(
|
||||
NUMBER_DOMAIN,
|
||||
SERVICE_SET_VALUE,
|
||||
{ATTR_ENTITY_ID: "number.test_number_motion_alarm_delay", ATTR_VALUE: 10000},
|
||||
blocking=True,
|
||||
)
|
||||
assert not mock_homee.set_value.called
|
||||
assert not hass.states.async_available("number.test_number_motion_alarm_delay")
|
||||
|
||||
|
||||
async def test_number_snapshot(
|
||||
hass: HomeAssistant,
|
||||
mock_homee: MagicMock,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test the multisensor snapshot."""
|
||||
mock_homee.nodes = [build_mock_node("numbers.json")]
|
||||
mock_homee.get_node_by_id.return_value = mock_homee.nodes[0]
|
||||
with patch("homeassistant.components.homee.PLATFORMS", [Platform.NUMBER]):
|
||||
await setup_integration(hass, mock_config_entry)
|
||||
|
||||
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
|
Loading…
Reference in New Issue