mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-22 15:34:26 +01:00
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.
This commit is contained in:
@@ -167,6 +167,9 @@ class NsPanelLovelanceUI:
|
|||||||
self.api.get_entity(entity_id).call_service("close_cover")
|
self.api.get_entity(entity_id).call_service("close_cover")
|
||||||
|
|
||||||
if(btype == "button"):
|
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")
|
self.api.get_entity(entity_id).call_service("press")
|
||||||
|
|
||||||
if(btype == "media-next"):
|
if(btype == "media-next"):
|
||||||
@@ -290,6 +293,9 @@ class NsPanelLovelanceUI:
|
|||||||
|
|
||||||
if item_type == "button" or item_type == "input_button":
|
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")
|
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):
|
def generate_thermo_page(self, item):
|
||||||
entity = self.api.get_entity(item)
|
entity = self.api.get_entity(item)
|
||||||
|
|||||||
Reference in New Issue
Block a user