mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Add StarLine flex logic and panic buttons (#130819)
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
parent
65a64ff7c4
commit
9e4368cfd4
@ -16,6 +16,20 @@ BUTTON_TYPES: tuple[ButtonEntityDescription, ...] = (
|
|||||||
key="poke",
|
key="poke",
|
||||||
translation_key="horn",
|
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": {
|
"button": {
|
||||||
"horn": {
|
"horn": {
|
||||||
"default": "mdi:bullhorn-outline"
|
"default": "mdi:bullhorn-outline"
|
||||||
|
},
|
||||||
|
"flex": {
|
||||||
|
"default": "mdi:star-circle-outline"
|
||||||
|
},
|
||||||
|
"panic": {
|
||||||
|
"default": "mdi:alarm-note"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"device_tracker": {
|
"device_tracker": {
|
||||||
@ -63,9 +69,6 @@
|
|||||||
"on": "mdi:access-point-network"
|
"on": "mdi:access-point-network"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"horn": {
|
|
||||||
"default": "mdi:bullhorn-outline"
|
|
||||||
},
|
|
||||||
"service_mode": {
|
"service_mode": {
|
||||||
"default": "mdi:car-wrench",
|
"default": "mdi:car-wrench",
|
||||||
"state": {
|
"state": {
|
||||||
|
@ -124,6 +124,12 @@
|
|||||||
"button": {
|
"button": {
|
||||||
"horn": {
|
"horn": {
|
||||||
"name": "Horn"
|
"name": "Horn"
|
||||||
|
},
|
||||||
|
"flex": {
|
||||||
|
"name": "Flex logic {num}"
|
||||||
|
},
|
||||||
|
"panic": {
|
||||||
|
"name": "Panic mode"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -78,8 +78,6 @@ class StarlineSwitch(StarlineEntity, SwitchEntity):
|
|||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
"""Return True if entity is on."""
|
"""Return True if entity is on."""
|
||||||
if self._key == "poke":
|
|
||||||
return False
|
|
||||||
return self._device.car_state.get(self._key)
|
return self._device.car_state.get(self._key)
|
||||||
|
|
||||||
def turn_on(self, **kwargs: Any) -> None:
|
def turn_on(self, **kwargs: Any) -> None:
|
||||||
@ -88,6 +86,4 @@ class StarlineSwitch(StarlineEntity, SwitchEntity):
|
|||||||
|
|
||||||
def turn_off(self, **kwargs: Any) -> None:
|
def turn_off(self, **kwargs: Any) -> None:
|
||||||
"""Turn the entity off."""
|
"""Turn the entity off."""
|
||||||
if self._key == "poke":
|
|
||||||
return
|
|
||||||
self._account.api.set_car_state(self._device.device_id, self._key, False)
|
self._account.api.set_car_state(self._device.device_id, self._key, False)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user