1 """Support for ZHA AnalogOutput cluster."""
3 from __future__
import annotations
16 from .entity
import ZHAEntity
17 from .helpers
import (
19 async_add_entities
as zha_async_add_entities,
20 convert_zha_error_to_ha_error,
24 _LOGGER = logging.getLogger(__name__)
29 config_entry: ConfigEntry,
30 async_add_entities: AddEntitiesCallback,
32 """Set up the Zigbee Home Automation Analog Output from config entry."""
34 entities_to_create = zha_data.platforms[Platform.NUMBER]
40 zha_async_add_entities, async_add_entities, ZhaNumber, entities_to_create
43 config_entry.async_on_unload(unsub)
47 """Representation of a ZHA Number entity."""
50 def name(self) -> str | UndefinedType | None:
51 """Return the name of the number entity."""
52 if (description := self.entity_data.entity.description)
is None:
58 return f
"{super().name} {description}"
62 """Return the current value."""
63 return self.entity_data.entity.native_value
67 """Return the minimum value."""
68 return self.entity_data.entity.native_min_value
72 """Return the maximum value."""
73 return self.entity_data.entity.native_max_value
77 """Return the value step."""
78 return self.entity_data.entity.native_step
82 """Return the unit the value is expressed in."""
83 return self.entity_data.entity.native_unit_of_measurement
85 @convert_zha_error_to_ha_error
87 """Update the current value from HA."""
88 await self.entity_data.entity.async_set_native_value(value=value)
None async_set_native_value(self, float value)
float native_max_value(self)
float|None native_step(self)
float|None native_value(self)
str|None native_unit_of_measurement(self)
float native_min_value(self)
str|UndefinedType|None name(self)
None async_write_ha_state(self)
HAZHAData get_zha_data(HomeAssistant hass)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)
Callable[[], None] async_dispatcher_connect(HomeAssistant hass, str signal, Callable[..., Any] target)