Add StarLine flex logic and panic buttons (#130819)

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
pull/125823/head^2
Nikolay Vasilchuk 2024-11-22 13:44:04 +03:00 committed by GitHub
parent 65a64ff7c4
commit 9e4368cfd4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 26 additions and 7 deletions

View File

@ -16,6 +16,20 @@ BUTTON_TYPES: tuple[ButtonEntityDescription, ...] = (
key="poke",
translation_key="horn",
),
ButtonEntityDescription(
key="panic",
translation_key="panic",
entity_registry_enabled_default=False,
),
*[
ButtonEntityDescription(
key=f"flex_{i}",
translation_key="flex",
translation_placeholders={"num": str(i)},
entity_registry_enabled_default=False,
)
for i in range(1, 10)
],
)

View File

@ -20,6 +20,12 @@
"button": {
"horn": {
"default": "mdi:bullhorn-outline"
},
"flex": {
"default": "mdi:star-circle-outline"
},
"panic": {
"default": "mdi:alarm-note"
}
},
"device_tracker": {
@ -63,9 +69,6 @@
"on": "mdi:access-point-network"
}
},
"horn": {
"default": "mdi:bullhorn-outline"
},
"service_mode": {
"default": "mdi:car-wrench",
"state": {

View File

@ -124,6 +124,12 @@
"button": {
"horn": {
"name": "Horn"
},
"flex": {
"name": "Flex logic {num}"
},
"panic": {
"name": "Panic mode"
}
}
},

View File

@ -78,8 +78,6 @@ class StarlineSwitch(StarlineEntity, SwitchEntity):
@property
def is_on(self):
"""Return True if entity is on."""
if self._key == "poke":
return False
return self._device.car_state.get(self._key)
def turn_on(self, **kwargs: Any) -> None:
@ -88,6 +86,4 @@ class StarlineSwitch(StarlineEntity, SwitchEntity):
def turn_off(self, **kwargs: Any) -> None:
"""Turn the entity off."""
if self._key == "poke":
return
self._account.api.set_car_state(self._device.device_id, self._key, False)