Add entity translations to totalconnect (#115950)
This commit is contained in:
parent
bb2bd086bc
commit
b5bd25d4fb
7 changed files with 128 additions and 121 deletions
|
@ -92,17 +92,17 @@ class TotalConnectAlarm(TotalConnectLocationEntity, AlarmControlPanelEntity):
|
|||
Add _# for partition 2 and beyond.
|
||||
"""
|
||||
if partition_id == 1:
|
||||
self._attr_name = self.device.name
|
||||
self._attr_name = None
|
||||
self._attr_unique_id = str(location.location_id)
|
||||
else:
|
||||
self._attr_name = f"{self.device.name} partition {partition_id}"
|
||||
self._attr_translation_key = "partition"
|
||||
self._attr_translation_placeholders = {"partition_id": str(partition_id)}
|
||||
self._attr_unique_id = f"{location.location_id}_{partition_id}"
|
||||
|
||||
@property
|
||||
def state(self) -> str | None:
|
||||
"""Return the state of the device."""
|
||||
attr = {
|
||||
"location_name": self.name,
|
||||
"location_id": self._location.location_id,
|
||||
"partition": self._partition_id,
|
||||
"ac_loss": self._location.ac_loss,
|
||||
|
@ -112,6 +112,11 @@ class TotalConnectAlarm(TotalConnectLocationEntity, AlarmControlPanelEntity):
|
|||
"triggered_zone": None,
|
||||
}
|
||||
|
||||
if self._partition_id == 1:
|
||||
attr["location_name"] = self.device.name
|
||||
else:
|
||||
attr["location_name"] = f"{self.device.name} partition {self._partition_id}"
|
||||
|
||||
state: str | None = None
|
||||
if self._partition.arming_state.is_disarmed():
|
||||
state = STATE_ALARM_DISARMED
|
||||
|
@ -152,7 +157,7 @@ class TotalConnectAlarm(TotalConnectLocationEntity, AlarmControlPanelEntity):
|
|||
) from error
|
||||
except BadResultCodeError as error:
|
||||
raise HomeAssistantError(
|
||||
f"TotalConnect failed to disarm {self.name}."
|
||||
f"TotalConnect failed to disarm {self.device.name}."
|
||||
) from error
|
||||
await self.coordinator.async_request_refresh()
|
||||
|
||||
|
@ -171,7 +176,7 @@ class TotalConnectAlarm(TotalConnectLocationEntity, AlarmControlPanelEntity):
|
|||
) from error
|
||||
except BadResultCodeError as error:
|
||||
raise HomeAssistantError(
|
||||
f"TotalConnect failed to arm home {self.name}."
|
||||
f"TotalConnect failed to arm home {self.device.name}."
|
||||
) from error
|
||||
await self.coordinator.async_request_refresh()
|
||||
|
||||
|
@ -190,7 +195,7 @@ class TotalConnectAlarm(TotalConnectLocationEntity, AlarmControlPanelEntity):
|
|||
) from error
|
||||
except BadResultCodeError as error:
|
||||
raise HomeAssistantError(
|
||||
f"TotalConnect failed to arm away {self.name}."
|
||||
f"TotalConnect failed to arm away {self.device.name}."
|
||||
) from error
|
||||
await self.coordinator.async_request_refresh()
|
||||
|
||||
|
@ -209,7 +214,7 @@ class TotalConnectAlarm(TotalConnectLocationEntity, AlarmControlPanelEntity):
|
|||
) from error
|
||||
except BadResultCodeError as error:
|
||||
raise HomeAssistantError(
|
||||
f"TotalConnect failed to arm night {self.name}."
|
||||
f"TotalConnect failed to arm night {self.device.name}."
|
||||
) from error
|
||||
await self.coordinator.async_request_refresh()
|
||||
|
||||
|
@ -228,7 +233,7 @@ class TotalConnectAlarm(TotalConnectLocationEntity, AlarmControlPanelEntity):
|
|||
) from error
|
||||
except BadResultCodeError as error:
|
||||
raise HomeAssistantError(
|
||||
f"TotalConnect failed to arm home instant {self.name}."
|
||||
f"TotalConnect failed to arm home instant {self.device.name}."
|
||||
) from error
|
||||
await self.coordinator.async_request_refresh()
|
||||
|
||||
|
@ -247,7 +252,7 @@ class TotalConnectAlarm(TotalConnectLocationEntity, AlarmControlPanelEntity):
|
|||
) from error
|
||||
except BadResultCodeError as error:
|
||||
raise HomeAssistantError(
|
||||
f"TotalConnect failed to arm away instant {self.name}."
|
||||
f"TotalConnect failed to arm away instant {self.device.name}."
|
||||
) from error
|
||||
await self.coordinator.async_request_refresh()
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ def get_security_zone_device_class(zone: TotalConnectZone) -> BinarySensorDevice
|
|||
|
||||
SECURITY_BINARY_SENSOR = TotalConnectZoneBinarySensorEntityDescription(
|
||||
key=ZONE,
|
||||
name="",
|
||||
name=None,
|
||||
device_class_fn=get_security_zone_device_class,
|
||||
is_on_fn=lambda zone: zone.is_faulted() or zone.is_triggered(),
|
||||
)
|
||||
|
@ -64,14 +64,12 @@ NO_BUTTON_BINARY_SENSORS: tuple[TotalConnectZoneBinarySensorEntityDescription, .
|
|||
key=LOW_BATTERY,
|
||||
device_class=BinarySensorDeviceClass.BATTERY,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
name=" low battery",
|
||||
is_on_fn=lambda zone: zone.is_low_battery(),
|
||||
),
|
||||
TotalConnectZoneBinarySensorEntityDescription(
|
||||
key=TAMPER,
|
||||
device_class=BinarySensorDeviceClass.TAMPER,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
name=f" {TAMPER}",
|
||||
is_on_fn=lambda zone: zone.is_tampered(),
|
||||
),
|
||||
)
|
||||
|
@ -89,21 +87,18 @@ LOCATION_BINARY_SENSORS: tuple[TotalConnectAlarmBinarySensorEntityDescription, .
|
|||
key=LOW_BATTERY,
|
||||
device_class=BinarySensorDeviceClass.BATTERY,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
name=" low battery",
|
||||
is_on_fn=lambda location: location.is_low_battery(),
|
||||
),
|
||||
TotalConnectAlarmBinarySensorEntityDescription(
|
||||
key=TAMPER,
|
||||
device_class=BinarySensorDeviceClass.TAMPER,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
name=f" {TAMPER}",
|
||||
is_on_fn=lambda location: location.is_cover_tampered(),
|
||||
),
|
||||
TotalConnectAlarmBinarySensorEntityDescription(
|
||||
key=POWER,
|
||||
device_class=BinarySensorDeviceClass.POWER,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
name=f" {POWER}",
|
||||
is_on_fn=lambda location: location.is_ac_loss(),
|
||||
),
|
||||
)
|
||||
|
@ -161,7 +156,6 @@ class TotalConnectZoneBinarySensor(TotalConnectZoneEntity, BinarySensorEntity):
|
|||
"""Initialize the TotalConnect status."""
|
||||
super().__init__(coordinator, zone, location_id, entity_description.key)
|
||||
self.entity_description = entity_description
|
||||
self._attr_name = f"{zone.description}{entity_description.name}"
|
||||
self._attr_extra_state_attributes = {
|
||||
"zone_id": zone.zoneid,
|
||||
"location_id": location_id,
|
||||
|
@ -195,7 +189,6 @@ class TotalConnectAlarmBinarySensor(TotalConnectLocationEntity, BinarySensorEnti
|
|||
"""Initialize the TotalConnect alarm device binary sensor."""
|
||||
super().__init__(coordinator, location)
|
||||
self.entity_description = entity_description
|
||||
self._attr_name = f"{self.device.name}{entity_description.name}"
|
||||
self._attr_unique_id = f"{location.location_id}_{entity_description.key}"
|
||||
self._attr_extra_state_attributes = {
|
||||
"location_id": location.location_id,
|
||||
|
|
|
@ -12,6 +12,8 @@ from . import DOMAIN, TotalConnectDataUpdateCoordinator
|
|||
class TotalConnectEntity(CoordinatorEntity[TotalConnectDataUpdateCoordinator]):
|
||||
"""Represent a TotalConnect entity."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
|
||||
class TotalConnectLocationEntity(TotalConnectEntity):
|
||||
"""Represent a TotalConnect location."""
|
||||
|
@ -24,11 +26,11 @@ class TotalConnectLocationEntity(TotalConnectEntity):
|
|||
"""Initialize the TotalConnect location."""
|
||||
super().__init__(coordinator)
|
||||
self._location = location
|
||||
self.device = location.devices[location.security_device_id]
|
||||
self.device = device = location.devices[location.security_device_id]
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, self.device.serial_number)},
|
||||
name=self.device.name,
|
||||
serial_number=self.device.serial_number,
|
||||
identifiers={(DOMAIN, device.serial_number)},
|
||||
name=device.name,
|
||||
serial_number=device.serial_number,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -49,5 +49,12 @@
|
|||
"name": "Arm home instant",
|
||||
"description": "Arms Home with zero entry delay."
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"alarm_control_panel": {
|
||||
"partition": {
|
||||
"name": "Partition {partition_id}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
'domain': 'alarm_control_panel',
|
||||
'entity_category': None,
|
||||
'entity_id': 'alarm_control_panel.test',
|
||||
'has_entity_name': False,
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -23,7 +23,7 @@
|
|||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'test',
|
||||
'original_name': None,
|
||||
'platform': 'totalconnect',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': <AlarmControlPanelEntityFeature: 7>,
|
||||
|
@ -70,7 +70,7 @@
|
|||
'domain': 'alarm_control_panel',
|
||||
'entity_category': None,
|
||||
'entity_id': 'alarm_control_panel.test_partition_2',
|
||||
'has_entity_name': False,
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -81,11 +81,11 @@
|
|||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'test partition 2',
|
||||
'original_name': 'Partition 2',
|
||||
'platform': 'totalconnect',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': <AlarmControlPanelEntityFeature: 7>,
|
||||
'translation_key': None,
|
||||
'translation_key': 'partition',
|
||||
'unique_id': '123456_2',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
|
@ -98,7 +98,7 @@
|
|||
'code_arm_required': True,
|
||||
'code_format': None,
|
||||
'cover_tampered': False,
|
||||
'friendly_name': 'test partition 2',
|
||||
'friendly_name': 'test Partition 2',
|
||||
'location_id': '123456',
|
||||
'location_name': 'test partition 2',
|
||||
'low_battery': False,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
'domain': 'binary_sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'binary_sensor.fire',
|
||||
'has_entity_name': False,
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -23,7 +23,7 @@
|
|||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.SMOKE: 'smoke'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Fire',
|
||||
'original_name': None,
|
||||
'platform': 'totalconnect',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
|
@ -49,7 +49,7 @@
|
|||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_entity_registry[binary_sensor.fire_low_battery-entry]
|
||||
# name: test_entity_registry[binary_sensor.fire_battery-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
|
@ -61,8 +61,8 @@
|
|||
'disabled_by': None,
|
||||
'domain': 'binary_sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'binary_sensor.fire_low_battery',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'binary_sensor.fire_battery',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -73,7 +73,7 @@
|
|||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.BATTERY: 'battery'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Fire low battery',
|
||||
'original_name': 'Battery',
|
||||
'platform': 'totalconnect',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
|
@ -82,17 +82,17 @@
|
|||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_entity_registry[binary_sensor.fire_low_battery-state]
|
||||
# name: test_entity_registry[binary_sensor.fire_battery-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'battery',
|
||||
'friendly_name': 'Fire low battery',
|
||||
'friendly_name': 'Fire Battery',
|
||||
'location_id': '123456',
|
||||
'partition': '1',
|
||||
'zone_id': '2',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'binary_sensor.fire_low_battery',
|
||||
'entity_id': 'binary_sensor.fire_battery',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
|
@ -112,7 +112,7 @@
|
|||
'domain': 'binary_sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'binary_sensor.fire_tamper',
|
||||
'has_entity_name': False,
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -123,7 +123,7 @@
|
|||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.TAMPER: 'tamper'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Fire tamper',
|
||||
'original_name': 'Tamper',
|
||||
'platform': 'totalconnect',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
|
@ -136,7 +136,7 @@
|
|||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'tamper',
|
||||
'friendly_name': 'Fire tamper',
|
||||
'friendly_name': 'Fire Tamper',
|
||||
'location_id': '123456',
|
||||
'partition': '1',
|
||||
'zone_id': '2',
|
||||
|
@ -162,7 +162,7 @@
|
|||
'domain': 'binary_sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'binary_sensor.gas',
|
||||
'has_entity_name': False,
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -173,7 +173,7 @@
|
|||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.GAS: 'gas'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Gas',
|
||||
'original_name': None,
|
||||
'platform': 'totalconnect',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
|
@ -199,7 +199,7 @@
|
|||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_entity_registry[binary_sensor.gas_low_battery-entry]
|
||||
# name: test_entity_registry[binary_sensor.gas_battery-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
|
@ -211,8 +211,8 @@
|
|||
'disabled_by': None,
|
||||
'domain': 'binary_sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'binary_sensor.gas_low_battery',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'binary_sensor.gas_battery',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -223,7 +223,7 @@
|
|||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.BATTERY: 'battery'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Gas low battery',
|
||||
'original_name': 'Battery',
|
||||
'platform': 'totalconnect',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
|
@ -232,17 +232,17 @@
|
|||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_entity_registry[binary_sensor.gas_low_battery-state]
|
||||
# name: test_entity_registry[binary_sensor.gas_battery-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'battery',
|
||||
'friendly_name': 'Gas low battery',
|
||||
'friendly_name': 'Gas Battery',
|
||||
'location_id': '123456',
|
||||
'partition': '1',
|
||||
'zone_id': '3',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'binary_sensor.gas_low_battery',
|
||||
'entity_id': 'binary_sensor.gas_battery',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
|
@ -262,7 +262,7 @@
|
|||
'domain': 'binary_sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'binary_sensor.gas_tamper',
|
||||
'has_entity_name': False,
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -273,7 +273,7 @@
|
|||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.TAMPER: 'tamper'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Gas tamper',
|
||||
'original_name': 'Tamper',
|
||||
'platform': 'totalconnect',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
|
@ -286,7 +286,7 @@
|
|||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'tamper',
|
||||
'friendly_name': 'Gas tamper',
|
||||
'friendly_name': 'Gas Tamper',
|
||||
'location_id': '123456',
|
||||
'partition': '1',
|
||||
'zone_id': '3',
|
||||
|
@ -312,7 +312,7 @@
|
|||
'domain': 'binary_sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'binary_sensor.medical',
|
||||
'has_entity_name': False,
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -323,7 +323,7 @@
|
|||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.SAFETY: 'safety'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Medical',
|
||||
'original_name': None,
|
||||
'platform': 'totalconnect',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
|
@ -362,7 +362,7 @@
|
|||
'domain': 'binary_sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'binary_sensor.motion',
|
||||
'has_entity_name': False,
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -373,7 +373,7 @@
|
|||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.MOTION: 'motion'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Motion',
|
||||
'original_name': None,
|
||||
'platform': 'totalconnect',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
|
@ -399,7 +399,7 @@
|
|||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_entity_registry[binary_sensor.motion_low_battery-entry]
|
||||
# name: test_entity_registry[binary_sensor.motion_battery-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
|
@ -411,8 +411,8 @@
|
|||
'disabled_by': None,
|
||||
'domain': 'binary_sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'binary_sensor.motion_low_battery',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'binary_sensor.motion_battery',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -423,7 +423,7 @@
|
|||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.BATTERY: 'battery'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Motion low battery',
|
||||
'original_name': 'Battery',
|
||||
'platform': 'totalconnect',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
|
@ -432,17 +432,17 @@
|
|||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_entity_registry[binary_sensor.motion_low_battery-state]
|
||||
# name: test_entity_registry[binary_sensor.motion_battery-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'battery',
|
||||
'friendly_name': 'Motion low battery',
|
||||
'friendly_name': 'Motion Battery',
|
||||
'location_id': '123456',
|
||||
'partition': '1',
|
||||
'zone_id': '4',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'binary_sensor.motion_low_battery',
|
||||
'entity_id': 'binary_sensor.motion_battery',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
|
@ -462,7 +462,7 @@
|
|||
'domain': 'binary_sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'binary_sensor.motion_tamper',
|
||||
'has_entity_name': False,
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -473,7 +473,7 @@
|
|||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.TAMPER: 'tamper'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Motion tamper',
|
||||
'original_name': 'Tamper',
|
||||
'platform': 'totalconnect',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
|
@ -486,7 +486,7 @@
|
|||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'tamper',
|
||||
'friendly_name': 'Motion tamper',
|
||||
'friendly_name': 'Motion Tamper',
|
||||
'location_id': '123456',
|
||||
'partition': '1',
|
||||
'zone_id': '4',
|
||||
|
@ -512,7 +512,7 @@
|
|||
'domain': 'binary_sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'binary_sensor.security',
|
||||
'has_entity_name': False,
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -523,7 +523,7 @@
|
|||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.DOOR: 'door'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Security',
|
||||
'original_name': None,
|
||||
'platform': 'totalconnect',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
|
@ -549,7 +549,7 @@
|
|||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
# name: test_entity_registry[binary_sensor.security_low_battery-entry]
|
||||
# name: test_entity_registry[binary_sensor.security_battery-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
|
@ -561,8 +561,8 @@
|
|||
'disabled_by': None,
|
||||
'domain': 'binary_sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'binary_sensor.security_low_battery',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'binary_sensor.security_battery',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -573,7 +573,7 @@
|
|||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.BATTERY: 'battery'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Security low battery',
|
||||
'original_name': 'Battery',
|
||||
'platform': 'totalconnect',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
|
@ -582,17 +582,17 @@
|
|||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_entity_registry[binary_sensor.security_low_battery-state]
|
||||
# name: test_entity_registry[binary_sensor.security_battery-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'battery',
|
||||
'friendly_name': 'Security low battery',
|
||||
'friendly_name': 'Security Battery',
|
||||
'location_id': '123456',
|
||||
'partition': '1',
|
||||
'zone_id': '1',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'binary_sensor.security_low_battery',
|
||||
'entity_id': 'binary_sensor.security_battery',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
|
@ -612,7 +612,7 @@
|
|||
'domain': 'binary_sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'binary_sensor.security_tamper',
|
||||
'has_entity_name': False,
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -623,7 +623,7 @@
|
|||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.TAMPER: 'tamper'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Security tamper',
|
||||
'original_name': 'Tamper',
|
||||
'platform': 'totalconnect',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
|
@ -636,7 +636,7 @@
|
|||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'tamper',
|
||||
'friendly_name': 'Security tamper',
|
||||
'friendly_name': 'Security Tamper',
|
||||
'location_id': '123456',
|
||||
'partition': '1',
|
||||
'zone_id': '1',
|
||||
|
@ -662,7 +662,7 @@
|
|||
'domain': 'binary_sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'binary_sensor.temperature',
|
||||
'has_entity_name': False,
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -673,7 +673,7 @@
|
|||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.PROBLEM: 'problem'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Temperature',
|
||||
'original_name': None,
|
||||
'platform': 'totalconnect',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
|
@ -699,7 +699,7 @@
|
|||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_entity_registry[binary_sensor.temperature_low_battery-entry]
|
||||
# name: test_entity_registry[binary_sensor.temperature_battery-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
|
@ -711,8 +711,8 @@
|
|||
'disabled_by': None,
|
||||
'domain': 'binary_sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'binary_sensor.temperature_low_battery',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'binary_sensor.temperature_battery',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -723,7 +723,7 @@
|
|||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.BATTERY: 'battery'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Temperature low battery',
|
||||
'original_name': 'Battery',
|
||||
'platform': 'totalconnect',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
|
@ -732,17 +732,17 @@
|
|||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_entity_registry[binary_sensor.temperature_low_battery-state]
|
||||
# name: test_entity_registry[binary_sensor.temperature_battery-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'battery',
|
||||
'friendly_name': 'Temperature low battery',
|
||||
'friendly_name': 'Temperature Battery',
|
||||
'location_id': '123456',
|
||||
'partition': '1',
|
||||
'zone_id': 7,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'binary_sensor.temperature_low_battery',
|
||||
'entity_id': 'binary_sensor.temperature_battery',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
|
@ -762,7 +762,7 @@
|
|||
'domain': 'binary_sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'binary_sensor.temperature_tamper',
|
||||
'has_entity_name': False,
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -773,7 +773,7 @@
|
|||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.TAMPER: 'tamper'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Temperature tamper',
|
||||
'original_name': 'Tamper',
|
||||
'platform': 'totalconnect',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
|
@ -786,7 +786,7 @@
|
|||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'tamper',
|
||||
'friendly_name': 'Temperature tamper',
|
||||
'friendly_name': 'Temperature Tamper',
|
||||
'location_id': '123456',
|
||||
'partition': '1',
|
||||
'zone_id': 7,
|
||||
|
@ -799,7 +799,7 @@
|
|||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_entity_registry[binary_sensor.test_low_battery-entry]
|
||||
# name: test_entity_registry[binary_sensor.test_battery-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
|
@ -811,8 +811,8 @@
|
|||
'disabled_by': None,
|
||||
'domain': 'binary_sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'binary_sensor.test_low_battery',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'binary_sensor.test_battery',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -823,7 +823,7 @@
|
|||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.BATTERY: 'battery'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'test low battery',
|
||||
'original_name': 'Battery',
|
||||
'platform': 'totalconnect',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
|
@ -832,15 +832,15 @@
|
|||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_entity_registry[binary_sensor.test_low_battery-state]
|
||||
# name: test_entity_registry[binary_sensor.test_battery-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'battery',
|
||||
'friendly_name': 'test low battery',
|
||||
'friendly_name': 'test Battery',
|
||||
'location_id': '123456',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'binary_sensor.test_low_battery',
|
||||
'entity_id': 'binary_sensor.test_battery',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
|
@ -860,7 +860,7 @@
|
|||
'domain': 'binary_sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'binary_sensor.test_power',
|
||||
'has_entity_name': False,
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -871,7 +871,7 @@
|
|||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.POWER: 'power'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'test power',
|
||||
'original_name': 'Power',
|
||||
'platform': 'totalconnect',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
|
@ -884,7 +884,7 @@
|
|||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'power',
|
||||
'friendly_name': 'test power',
|
||||
'friendly_name': 'test Power',
|
||||
'location_id': '123456',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
|
@ -908,7 +908,7 @@
|
|||
'domain': 'binary_sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'binary_sensor.test_tamper',
|
||||
'has_entity_name': False,
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -919,7 +919,7 @@
|
|||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.TAMPER: 'tamper'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'test tamper',
|
||||
'original_name': 'Tamper',
|
||||
'platform': 'totalconnect',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
|
@ -932,7 +932,7 @@
|
|||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'tamper',
|
||||
'friendly_name': 'test tamper',
|
||||
'friendly_name': 'test Tamper',
|
||||
'location_id': '123456',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
|
@ -956,7 +956,7 @@
|
|||
'domain': 'binary_sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'binary_sensor.unknown',
|
||||
'has_entity_name': False,
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -967,7 +967,7 @@
|
|||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.DOOR: 'door'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Unknown',
|
||||
'original_name': None,
|
||||
'platform': 'totalconnect',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
|
@ -993,7 +993,7 @@
|
|||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_entity_registry[binary_sensor.unknown_low_battery-entry]
|
||||
# name: test_entity_registry[binary_sensor.unknown_battery-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
|
@ -1005,8 +1005,8 @@
|
|||
'disabled_by': None,
|
||||
'domain': 'binary_sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'binary_sensor.unknown_low_battery',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'binary_sensor.unknown_battery',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -1017,7 +1017,7 @@
|
|||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.BATTERY: 'battery'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Unknown low battery',
|
||||
'original_name': 'Battery',
|
||||
'platform': 'totalconnect',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
|
@ -1026,17 +1026,17 @@
|
|||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_entity_registry[binary_sensor.unknown_low_battery-state]
|
||||
# name: test_entity_registry[binary_sensor.unknown_battery-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'battery',
|
||||
'friendly_name': 'Unknown low battery',
|
||||
'friendly_name': 'Unknown Battery',
|
||||
'location_id': '123456',
|
||||
'partition': '1',
|
||||
'zone_id': '6',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'binary_sensor.unknown_low_battery',
|
||||
'entity_id': 'binary_sensor.unknown_battery',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
|
@ -1056,7 +1056,7 @@
|
|||
'domain': 'binary_sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'binary_sensor.unknown_tamper',
|
||||
'has_entity_name': False,
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
|
@ -1067,7 +1067,7 @@
|
|||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.TAMPER: 'tamper'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Unknown tamper',
|
||||
'original_name': 'Tamper',
|
||||
'platform': 'totalconnect',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
|
@ -1080,7 +1080,7 @@
|
|||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'tamper',
|
||||
'friendly_name': 'Unknown tamper',
|
||||
'friendly_name': 'Unknown Tamper',
|
||||
'location_id': '123456',
|
||||
'partition': '1',
|
||||
'zone_id': '6',
|
||||
|
|
|
@ -17,9 +17,9 @@ from .common import RESPONSE_DISARMED, ZONE_NORMAL, setup_platform
|
|||
from tests.common import snapshot_platform
|
||||
|
||||
ZONE_ENTITY_ID = "binary_sensor.security"
|
||||
ZONE_LOW_BATTERY_ID = "binary_sensor.security_low_battery"
|
||||
ZONE_LOW_BATTERY_ID = "binary_sensor.security_battery"
|
||||
ZONE_TAMPER_ID = "binary_sensor.security_tamper"
|
||||
PANEL_BATTERY_ID = "binary_sensor.test_low_battery"
|
||||
PANEL_BATTERY_ID = "binary_sensor.test_battery"
|
||||
PANEL_TAMPER_ID = "binary_sensor.test_tamper"
|
||||
PANEL_POWER_ID = "binary_sensor.test_power"
|
||||
|
||||
|
@ -49,7 +49,7 @@ async def test_state_and_attributes(hass: HomeAssistant) -> None:
|
|||
)
|
||||
assert state.attributes.get("device_class") == BinarySensorDeviceClass.DOOR
|
||||
|
||||
state = hass.states.get(f"{ZONE_ENTITY_ID}_low_battery")
|
||||
state = hass.states.get(f"{ZONE_ENTITY_ID}_battery")
|
||||
assert state.state == STATE_OFF
|
||||
state = hass.states.get(f"{ZONE_ENTITY_ID}_tamper")
|
||||
assert state.state == STATE_OFF
|
||||
|
@ -58,7 +58,7 @@ async def test_state_and_attributes(hass: HomeAssistant) -> None:
|
|||
state = hass.states.get("binary_sensor.fire")
|
||||
assert state.state == STATE_OFF
|
||||
assert state.attributes.get("device_class") == BinarySensorDeviceClass.SMOKE
|
||||
state = hass.states.get("binary_sensor.fire_low_battery")
|
||||
state = hass.states.get("binary_sensor.fire_battery")
|
||||
assert state.state == STATE_ON
|
||||
state = hass.states.get("binary_sensor.fire_tamper")
|
||||
assert state.state == STATE_OFF
|
||||
|
@ -67,7 +67,7 @@ async def test_state_and_attributes(hass: HomeAssistant) -> None:
|
|||
state = hass.states.get("binary_sensor.gas")
|
||||
assert state.state == STATE_OFF
|
||||
assert state.attributes.get("device_class") == BinarySensorDeviceClass.GAS
|
||||
state = hass.states.get("binary_sensor.gas_low_battery")
|
||||
state = hass.states.get("binary_sensor.gas_battery")
|
||||
assert state.state == STATE_OFF
|
||||
state = hass.states.get("binary_sensor.gas_tamper")
|
||||
assert state.state == STATE_ON
|
||||
|
@ -76,7 +76,7 @@ async def test_state_and_attributes(hass: HomeAssistant) -> None:
|
|||
state = hass.states.get("binary_sensor.unknown")
|
||||
assert state.state == STATE_OFF
|
||||
assert state.attributes.get("device_class") == BinarySensorDeviceClass.DOOR
|
||||
state = hass.states.get("binary_sensor.unknown_low_battery")
|
||||
state = hass.states.get("binary_sensor.unknown_battery")
|
||||
assert state.state == STATE_OFF
|
||||
state = hass.states.get("binary_sensor.unknown_tamper")
|
||||
assert state.state == STATE_OFF
|
||||
|
@ -85,7 +85,7 @@ async def test_state_and_attributes(hass: HomeAssistant) -> None:
|
|||
state = hass.states.get("binary_sensor.temperature")
|
||||
assert state.state == STATE_OFF
|
||||
assert state.attributes.get("device_class") == BinarySensorDeviceClass.PROBLEM
|
||||
state = hass.states.get("binary_sensor.temperature_low_battery")
|
||||
state = hass.states.get("binary_sensor.temperature_battery")
|
||||
assert state.state == STATE_OFF
|
||||
state = hass.states.get("binary_sensor.temperature_tamper")
|
||||
assert state.state == STATE_OFF
|
||||
|
|
Loading…
Add table
Reference in a new issue