This commit is contained in:
Johannes
2022-10-31 19:49:14 +01:00
parent c0c395c7dd
commit c98e47562e
2 changed files with 20 additions and 7 deletions

View File

@@ -393,3 +393,9 @@ class LuiController(object):
entity = apis.ha_api.get_entity(entity_id) entity = apis.ha_api.get_entity(entity_id)
option = entity.attributes.options[int(value)] option = entity.attributes.options[int(value)]
entity.call_service("select_option", option=option) entity.call_service("select_option", option=option)
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)

View File

@@ -676,10 +676,13 @@ class LuiPagesGen(object):
color = "enable" color = "enable"
else: else:
color = "disable" color = "disable"
effect_supported = False
if "effect_list" in entity.attributes:
effect_supported = True
color_translation = "Color" color_translation = "Color"
brightness_translation = get_translation(self._locale, "frontend.ui.card.light.brightness") brightness_translation = get_translation(self._locale, "frontend.ui.card.light.brightness")
color_temp_translation = get_translation(self._locale, "frontend.ui.card.light.color_temperature") color_temp_translation = get_translation(self._locale, "frontend.ui.card.light.color_temperature")
self._send_mqtt_msg(f"entityUpdateDetail~{entity_id}~~{icon_color}~{switch_val}~{brightness}~{color_temp}~{color}~{color_translation}~{color_temp_translation}~{brightness_translation}") self._send_mqtt_msg(f"entityUpdateDetail~{entity_id}~~{icon_color}~{switch_val}~{brightness}~{color_temp}~{color}~{color_translation}~{color_temp_translation}~{brightness_translation}~{effect_supported}")
def generate_shutter_detail_page(self, entity_id): def generate_shutter_detail_page(self, entity_id):
entity = apis.ha_api.get_entity(entity_id) entity = apis.ha_api.get_entity(entity_id)
@@ -801,12 +804,16 @@ class LuiPagesGen(object):
def generate_input_select_detail_page(self, entity_id): def generate_input_select_detail_page(self, entity_id):
entity = apis.ha_api.get_entity(entity_id) entity = apis.ha_api.get_entity(entity_id)
icon_color = self.get_entity_color(entity, ha_type="input_select") options = []
icon_color = 0
options = entity.attributes.get("options", []) ha_type = entity_id.split(".")[0]
icon_color = self.get_entity_color(entity, ha_type=ha_type)
if ha_type == "input_select":
options = entity.attributes.get("options", [])
if ha_type == "light":
options = entity.attributes.get("effect_list", [])
options = "?".join(options) options = "?".join(options)
self._send_mqtt_msg(f"entityUpdateDetail~{entity_id}~~{icon_color}~{ha_type}~{entity.state}~{options}~")
self._send_mqtt_msg(f"entityUpdateDetail~{entity_id}~~{icon_color}~input_select~{entity.state}~{options}~")
def send_message_page(self, ident, heading, msg, b1, b2): def send_message_page(self, ident, heading, msg, b1, b2):
self._send_mqtt_msg(f"pageType~popupNotify") self._send_mqtt_msg(f"pageType~popupNotify")