basic backend implementation for timer popup

This commit is contained in:
joBr99
2022-12-20 20:30:57 +01:00
parent 7c82dd9db9
commit 67c38d998c
2 changed files with 53 additions and 2 deletions

View File

@@ -173,6 +173,8 @@ class LuiController(object):
self._pages_gen.generate_input_select_detail_page(entity)
if entity.startswith("media_player"):
self._pages_gen.generate_input_select_detail_page(entity)
if entity.startswith("timer"):
self._pages_gen.generate_timer_detail_page(entity)
if self._current_card.cardType == "cardThermo":
if entity.startswith("climate"):
self._pages_gen.generate_thermo_detail_page(entity)
@@ -189,7 +191,8 @@ class LuiController(object):
self._pages_gen.generate_thermo_detail_page(entity_id)
if detail_type == "popupInSel":
self._pages_gen.generate_input_select_detail_page(entity_id)
if detail_type == "popupTimer":
self._pages_gen.generate_timer_detail_page(entity_id)
def button_press(self, entity_id, button_type, value):
apis.ha_api.log(f"Button Press Event; entity_id: {entity_id}; button_type: {button_type}; value: {value} ")
# internal buttons
@@ -414,4 +417,17 @@ class LuiController(object):
if button_type == "mode-media_player":
entity = apis.ha_api.get_entity(entity_id)
option = entity.attributes.source_list[int(value)]
entity.call_service("select_source", source=option)
entity.call_service("select_source", source=option)
# timer detail page
if button_type == "timer-start":
if value is not None:
apis.ha_api.get_entity(entity_id).call_service("start", duration=value)
else:
apis.ha_api.get_entity(entity_id).call_service("start")
if button_type == "timer-cancel":
apis.ha_api.get_entity(entity_id).call_service("cancel")
if button_type == "timer-pause":
apis.ha_api.get_entity(entity_id).call_service("pause")
if button_type == "timer-finish":
apis.ha_api.get_entity(entity_id).call_service("finish")