Add separate battery sensors for Overkiz smoke sensors (#174365)

This commit is contained in:
Mick Vleeshouwer
2026-06-21 07:48:08 +02:00
committed by GitHub
parent 957c24fcd7
commit 324f08d00f
3 changed files with 145 additions and 0 deletions
@@ -79,6 +79,26 @@ SENSOR_DESCRIPTIONS: list[OverkizSensorDescription] = [
options=["good", "medium", "low", "critical"],
translation_key="battery",
),
# SmokeSensor with separate batteries for the radio and sensor parts,
# e.g. the Somfy smoke sensor (9V radio block + 3V CR123 sensor cell).
OverkizSensorDescription(
key=OverkizState.IO_MAINTENANCE_RADIO_PART_BATTERY,
name="Radio battery",
entity_category=EntityCategory.DIAGNOSTIC,
icon="mdi:battery",
device_class=SensorDeviceClass.ENUM,
options=["low", "normal"],
translation_key="battery",
),
OverkizSensorDescription(
key=OverkizState.IO_MAINTENANCE_SENSOR_PART_BATTERY,
name="Sensor battery",
entity_category=EntityCategory.DIAGNOSTIC,
icon="mdi:battery",
device_class=SensorDeviceClass.ENUM,
options=["absence", "low", "normal"],
translation_key="battery",
),
OverkizSensorDescription(
key=OverkizState.CORE_RSSI_LEVEL,
name="RSSI level",
@@ -147,6 +147,7 @@
"sensor": {
"battery": {
"state": {
"absence": "Absent",
"critical": "Critical",
"full": "[%key:common::state::full%]",
"good": "Good",
@@ -3010,6 +3010,67 @@
'state': 'good',
})
# ---
# name: test_sensor_entities_snapshot[cloud_nexity_rail_din_europe.json][sensor.maple_residence_living_room_smoke_detector_radio_battery-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': dict({
'options': list([
'low',
'normal',
]),
}),
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
'entity_id': 'sensor.maple_residence_living_room_smoke_detector_radio_battery',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Radio battery',
'options': dict({
}),
'original_device_class': <SensorDeviceClass.ENUM: 'enum'>,
'original_icon': 'mdi:battery',
'original_name': 'Radio battery',
'platform': 'overkiz',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'battery',
'unique_id': 'io://1234-5678-1698/8907539-io:MaintenanceRadioPartBatteryState',
'unit_of_measurement': None,
})
# ---
# name: test_sensor_entities_snapshot[cloud_nexity_rail_din_europe.json][sensor.maple_residence_living_room_smoke_detector_radio_battery-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'enum',
'friendly_name': 'Living Room Smoke Detector Radio battery',
'icon': 'mdi:battery',
'options': list([
'low',
'normal',
]),
}),
'context': <ANY>,
'entity_id': 'sensor.maple_residence_living_room_smoke_detector_radio_battery',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'normal',
})
# ---
# name: test_sensor_entities_snapshot[cloud_nexity_rail_din_europe.json][sensor.maple_residence_living_room_smoke_detector_rssi_level-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
@@ -3065,6 +3126,69 @@
'state': '100',
})
# ---
# name: test_sensor_entities_snapshot[cloud_nexity_rail_din_europe.json][sensor.maple_residence_living_room_smoke_detector_sensor_battery-entry]
EntityRegistryEntrySnapshot({
'aliases': list([
None,
]),
'area_id': None,
'capabilities': dict({
'options': list([
'absence',
'low',
'normal',
]),
}),
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
'entity_id': 'sensor.maple_residence_living_room_smoke_detector_sensor_battery',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'Sensor battery',
'options': dict({
}),
'original_device_class': <SensorDeviceClass.ENUM: 'enum'>,
'original_icon': 'mdi:battery',
'original_name': 'Sensor battery',
'platform': 'overkiz',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'battery',
'unique_id': 'io://1234-5678-1698/8907539-io:MaintenanceSensorPartBatteryState',
'unit_of_measurement': None,
})
# ---
# name: test_sensor_entities_snapshot[cloud_nexity_rail_din_europe.json][sensor.maple_residence_living_room_smoke_detector_sensor_battery-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'enum',
'friendly_name': 'Living Room Smoke Detector Sensor battery',
'icon': 'mdi:battery',
'options': list([
'absence',
'low',
'normal',
]),
}),
'context': <ANY>,
'entity_id': 'sensor.maple_residence_living_room_smoke_detector_sensor_battery',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'normal',
})
# ---
# name: test_sensor_entities_snapshot[cloud_nexity_rail_din_europe.json][sensor.maple_residence_living_room_smoke_detector_sensor_defect-entry]
EntityRegistryEntrySnapshot({
'aliases': list([