Deprecate StarLine engine switch attributes (#133958)

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
Nikolay Vasilchuk 2025-01-09 12:24:04 +03:00 committed by GitHub
parent 2f892678f6
commit 0184d8e954
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 19 additions and 6 deletions

View File

@ -180,6 +180,7 @@ class StarlineAccount:
"online": device.online, "online": device.online,
} }
# Deprecated and should be removed in 2025.8
@staticmethod @staticmethod
def engine_attrs(device: StarlineDevice) -> dict[str, Any]: def engine_attrs(device: StarlineDevice) -> dict[str, Any]:
"""Attributes for engine switch.""" """Attributes for engine switch."""

View File

@ -43,8 +43,13 @@ BINARY_SENSOR_TYPES: tuple[BinarySensorEntityDescription, ...] = (
), ),
BinarySensorEntityDescription( BinarySensorEntityDescription(
key="run", key="run",
translation_key="is_running", translation_key="ignition",
device_class=BinarySensorDeviceClass.RUNNING, entity_registry_enabled_default=False,
),
BinarySensorEntityDescription(
key="r_start",
translation_key="autostart",
entity_registry_enabled_default=False,
), ),
BinarySensorEntityDescription( BinarySensorEntityDescription(
key="hfree", key="hfree",

View File

@ -13,8 +13,11 @@
"moving_ban": { "moving_ban": {
"default": "mdi:car-off" "default": "mdi:car-off"
}, },
"is_running": { "ignition": {
"default": "mdi:speedometer" "default": "mdi:key-variant"
},
"autostart": {
"default": "mdi:auto-mode"
} }
}, },
"button": { "button": {

View File

@ -64,8 +64,11 @@
"moving_ban": { "moving_ban": {
"name": "Moving ban" "name": "Moving ban"
}, },
"is_running": { "ignition": {
"name": "Running" "name": "Ignition"
},
"autostart": {
"name": "Autostart"
} }
}, },
"device_tracker": { "device_tracker": {

View File

@ -72,6 +72,7 @@ class StarlineSwitch(StarlineEntity, SwitchEntity):
def extra_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes of the switch.""" """Return the state attributes of the switch."""
if self._key == "ign": if self._key == "ign":
# Deprecated and should be removed in 2025.8
return self._account.engine_attrs(self._device) return self._account.engine_attrs(self._device)
return None return None