implement effect fav list

This commit is contained in:
joBr99
2023-02-01 21:25:50 +01:00
parent ff338fdd71
commit 0ca1982ebc
2 changed files with 31 additions and 19 deletions

View File

@@ -194,6 +194,9 @@ class LuiController(object):
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} ")
if entity_id.startswith('uuid'):
entity_config = self._config._config_entites_table.get(entity_id)
entity_id = entity_config.entityId
# internal buttons
if entity_id == "screensaver" and button_type == "bExit":
# get default card if there is one
@@ -226,14 +229,6 @@ class LuiController(object):
if button_type == "bExit":
self._pages_gen.render_card(self._current_card)
#if button_type == "bHome":
# if self._previous_cards:
# self._current_card = self._previous_cards[0]
# self._previous_cards.clear()
# else:
# self._current_card = self._config.getCard(0)
# self._pages_gen.render_card(self._current_card)
elif entity_id == "updateDisplayNoYes" and value == "no":
self._pages_gen.render_card(self._current_card)
@@ -275,10 +270,6 @@ class LuiController(object):
if button_type == "button":
if entity_id.startswith('uuid'):
le = self._config._config_entites_table.get(entity_id)
entity_id = le.entityId
if entity_id.startswith('navigate'):
# internal navigation for next/prev
if entity_id.startswith('navigate.uuid'):
@@ -320,7 +311,7 @@ class LuiController(object):
else:
apis.ha_api.get_entity(entity_id).call_service("return_to_base")
elif entity_id.startswith('service'):
apis.ha_api.call_service(entity_id.replace('service.', '', 1).replace('.','/', 1), **le.data)
apis.ha_api.call_service(entity_id.replace('service.', '', 1).replace('.','/', 1), **entity_config.data)
# for media page
if button_type == "media-next":
@@ -419,8 +410,12 @@ class LuiController(object):
if button_type == "mode-light":
entity = apis.ha_api.get_entity(entity_id)
option = entity.attributes.effect_list[int(value)]
entity.call_service("select_effect", option=option)
options_list = entity_config.entity_input_config.get("effectList")
if options_list is not None:
option = options_list[int(value)]
else:
option = entity.attributes.effect_list[int(value)]
entity.call_service("turn_on", effect=option)
if button_type == "mode-media_player":
entity = apis.ha_api.get_entity(entity_id)