Add hazard lights binary sensor to Teslemetry (#144166)

This commit is contained in:
Brett Adams 2025-05-04 21:36:13 +10:00 committed by GitHub
parent cb37d4d36a
commit de496c693e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 75 additions and 0 deletions

View File

@ -391,6 +391,12 @@ VEHICLE_DESCRIPTIONS: tuple[TeslemetryBinarySensorEntityDescription, ...] = (
entity_registry_enabled_default=False,
streaming_firmware="2024.44.25",
),
TeslemetryBinarySensorEntityDescription(
key="lights_hazards_active",
streaming_listener=lambda x, y: x.listen_LightsHazardsActive(y),
entity_registry_enabled_default=False,
streaming_firmware="2025.2.6",
),
TeslemetryBinarySensorEntityDescription(
key="lights_high_beams",
streaming_listener=lambda x, y: x.listen_LightsHighBeams(y),

View File

@ -73,6 +73,12 @@
"on": "mdi:snowflake-melt"
}
},
"lights_hazards_active": {
"state": {
"off": "mdi:car-light-dimmed",
"on": "mdi:hazard-lights"
}
},
"lights_high_beams": {
"state": {
"off": "mdi:car-light-dimmed",

View File

@ -203,6 +203,9 @@
"defrost_for_preconditioning": {
"name": "Defrost for preconditioning"
},
"lights_hazards_active": {
"name": "Hazard lights"
},
"lights_high_beams": {
"name": "High beams"
},

View File

@ -1514,6 +1514,53 @@
'state': 'unknown',
})
# ---
# name: test_binary_sensor[binary_sensor.test_hazard_lights-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': None,
'entity_id': 'binary_sensor.test_hazard_lights',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Hazard lights',
'platform': 'teslemetry',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'lights_hazards_active',
'unique_id': 'LRW3F7EK4NC700000-lights_hazards_active',
'unit_of_measurement': None,
})
# ---
# name: test_binary_sensor[binary_sensor.test_hazard_lights-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Test Hazard lights',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.test_hazard_lights',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_binary_sensor[binary_sensor.test_high_beams-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
@ -3504,6 +3551,19 @@
'state': 'unknown',
})
# ---
# name: test_binary_sensor_refresh[binary_sensor.test_hazard_lights-statealt]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Test Hazard lights',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.test_hazard_lights',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
})
# ---
# name: test_binary_sensor_refresh[binary_sensor.test_high_beams-statealt]
StateSnapshot({
'attributes': ReadOnlyDict({