Add StarLine flex logic and panic buttons (#130819)
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>pull/125823/head^2
parent
65a64ff7c4
commit
9e4368cfd4
|
@ -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)
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -124,6 +124,12 @@
|
|||
"button": {
|
||||
"horn": {
|
||||
"name": "Horn"
|
||||
},
|
||||
"flex": {
|
||||
"name": "Flex logic {num}"
|
||||
},
|
||||
"panic": {
|
||||
"name": "Panic mode"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue