mirror of
https://github.com/home-assistant/core.git
synced 2025-11-10 03:19:34 +00:00
Minor deCONZ clean up (#76323)
* Rename secondary_temperature with internal_temperature * Prefix binary and sensor descriptions matching on all sensor devices with COMMON_ * Always create entities in the same order Its been reported previously that if the integration is removed and setup again that entity IDs can change if not sorted in the numerical order * Rename alarmsystems to alarm_systems * Use websocket enums * Don't use legacy pydeconz constants * Bump pydeconz to v103 * unsub -> unsubscribe
This commit is contained in:
@@ -159,7 +159,7 @@ ENTITY_DESCRIPTIONS = {
|
||||
],
|
||||
}
|
||||
|
||||
BINARY_SENSOR_DESCRIPTIONS = [
|
||||
COMMON_BINARY_SENSOR_DESCRIPTIONS = [
|
||||
DeconzBinarySensorDescription(
|
||||
key="tampered",
|
||||
value_fn=lambda device: device.tampered,
|
||||
@@ -215,7 +215,8 @@ async def async_setup_entry(
|
||||
sensor = gateway.api.sensors[sensor_id]
|
||||
|
||||
for description in (
|
||||
ENTITY_DESCRIPTIONS.get(type(sensor), []) + BINARY_SENSOR_DESCRIPTIONS
|
||||
ENTITY_DESCRIPTIONS.get(type(sensor), [])
|
||||
+ COMMON_BINARY_SENSOR_DESCRIPTIONS
|
||||
):
|
||||
if (
|
||||
not hasattr(sensor, description.key)
|
||||
@@ -283,8 +284,8 @@ class DeconzBinarySensor(DeconzDevice[SensorResources], BinarySensorEntity):
|
||||
if self._device.on is not None:
|
||||
attr[ATTR_ON] = self._device.on
|
||||
|
||||
if self._device.secondary_temperature is not None:
|
||||
attr[ATTR_TEMPERATURE] = self._device.secondary_temperature
|
||||
if self._device.internal_temperature is not None:
|
||||
attr[ATTR_TEMPERATURE] = self._device.internal_temperature
|
||||
|
||||
if isinstance(self._device, Presence):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user