From f77327cf7b912fa4062cba6ba475a934ce6dfb23 Mon Sep 17 00:00:00 2001 From: Matthijs Date: Mon, 7 Mar 2022 19:16:17 +0100 Subject: [PATCH] Added support for scenes Perhaps you want to use a different icon? I choose the musical notes because yeah that is sometimes used :) But hey at least this works for me! We can also add another button type ('scene') to get rid of the `startswith` method but then I'll need to look into the Nextion editor I guess. --- apps/nspanel-lovelance-ui/nspanel-lovelance-ui.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/nspanel-lovelance-ui/nspanel-lovelance-ui.py b/apps/nspanel-lovelance-ui/nspanel-lovelance-ui.py index e99ba5c2..713028e9 100644 --- a/apps/nspanel-lovelance-ui/nspanel-lovelance-ui.py +++ b/apps/nspanel-lovelance-ui/nspanel-lovelance-ui.py @@ -167,6 +167,9 @@ class NsPanelLovelanceUI: self.api.get_entity(entity_id).call_service("close_cover") if(btype == "button"): + if(entity_id.startswith('scene')): + self.api.get_entity(entity_id).call_service("turn_on") + else: self.api.get_entity(entity_id).call_service("press") if(btype == "media-next"): @@ -290,6 +293,9 @@ class NsPanelLovelanceUI: if item_type == "button" or item_type == "input_button": return "entityUpd,{0},{1},{2},{3},{4},{5}".format(item_nr, "button", item, 3, name, "PRESS") + + if item_type == "scene": + return "entityUpd,{0},{1},{2},{3},{4},{5}".format(item_nr, "button", item, 5, name, "ACTIVATE") def generate_thermo_page(self, item): entity = self.api.get_entity(item)