Add discovery rule for a Z-Wave Basic CC sensor (#105134)

This commit is contained in:
Raman Gupta 2024-06-22 05:22:32 -04:00 committed by GitHub
parent 77edc149ec
commit d9e26077c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 146 additions and 4 deletions

View file

@ -689,6 +689,23 @@ class ZwaveSensor(ZWaveBaseEntity, SensorEntity):
class ZWaveNumericSensor(ZwaveSensor):
"""Representation of a Z-Wave Numeric sensor."""
def __init__(
self,
config_entry: ConfigEntry,
driver: Driver,
info: ZwaveDiscoveryInfo,
entity_description: SensorEntityDescription,
unit_of_measurement: str | None = None,
) -> None:
"""Initialize a ZWaveBasicSensor entity."""
super().__init__(
config_entry, driver, info, entity_description, unit_of_measurement
)
if self.info.primary_value.command_class == CommandClass.BASIC:
self._attr_name = self.generate_name(
include_value_name=True, alternate_value_name="Basic"
)
@callback
def on_value_update(self) -> None:
"""Handle scale changes for this value on value updated event."""