mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-21 23:14:25 +01:00
added on off button to media page
This commit is contained in:
BIN
HMI/nspanel.HMI
BIN
HMI/nspanel.HMI
Binary file not shown.
BIN
HMI/nspanel.tft
BIN
HMI/nspanel.tft
Binary file not shown.
@@ -181,10 +181,12 @@ class LuiController(object):
|
|||||||
if button_type == "media-back":
|
if button_type == "media-back":
|
||||||
self._ha_api.get_entity(entity_id).call_service("media_previous_track")
|
self._ha_api.get_entity(entity_id).call_service("media_previous_track")
|
||||||
if button_type == "media-pause":
|
if button_type == "media-pause":
|
||||||
player = self._ha_api.get_entity(entity_id)
|
self._ha_api.get_entity(entity_id).call_service("media_play_pause")
|
||||||
|
if button_type == "media-OnOff":
|
||||||
if player.state == "off":
|
if player.state == "off":
|
||||||
player.call_service("turn_on")
|
self._ha_api.get_entity(entity_id).call_service("turn_on")
|
||||||
player.call_service("media_play_pause")
|
else:
|
||||||
|
self._ha_api.get_entity(entity_id).call_service("turn_off")
|
||||||
if button_type == "volumeSlider":
|
if button_type == "volumeSlider":
|
||||||
pos = int(value)
|
pos = int(value)
|
||||||
# HA wants this value between 0 and 1 as float
|
# HA wants this value between 0 and 1 as float
|
||||||
|
|||||||
@@ -249,8 +249,14 @@ class LuiPagesGen(object):
|
|||||||
if len(speakerlist) == 1:
|
if len(speakerlist) == 1:
|
||||||
speakerlist = []
|
speakerlist = []
|
||||||
speakerlist = "?".join(speakerlist)
|
speakerlist = "?".join(speakerlist)
|
||||||
supported_features = entity.attributes.supported_features
|
bits = entity.attributes.supported_features
|
||||||
command = f"entityUpd,|{item}|{heading}|{icon}|{title}|{author}|{volume}|{iconplaypause}|{source}|{speakerlist}|{supported_features}"
|
onoffbutton = "disable"
|
||||||
|
if bits & 0b01000000:
|
||||||
|
if entity.state == "off"
|
||||||
|
onoffbutton = 1374
|
||||||
|
else:
|
||||||
|
onoffbutton = rgb_dec565([255,255,255])
|
||||||
|
command = f"entityUpd,|{item}|{heading}|{icon}|{title}|{author}|{volume}|{iconplaypause}|{source}|{speakerlist}|{onoffbutton}"
|
||||||
self._send_mqtt_msg(command)
|
self._send_mqtt_msg(command)
|
||||||
|
|
||||||
def generate_alarm_page(self, item):
|
def generate_alarm_page(self, item):
|
||||||
|
|||||||
Reference in New Issue
Block a user