mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-20 06:27:01 +01:00
implemented speaker control on media page
This commit is contained in:
@@ -129,7 +129,7 @@ The following message can be used to update the content on the cardEntities Page
|
|||||||
|
|
||||||
### cardMedia Page
|
### cardMedia Page
|
||||||
|
|
||||||
`entityUpd,|*internalNameEntiy*|*heading*|*icon*|*title*|*author*|*volume*|*playpauseicon*`
|
`entityUpd,|*internalNameEntiy*|*heading*|*icon*|*title*|*author*|*volume*|*playpauseicon*|currentSpeaker|speakerList-seperated-by-?`
|
||||||
|
|
||||||
### cardAlarm Page
|
### cardAlarm Page
|
||||||
|
|
||||||
|
|||||||
BIN
HMI/nspanel.HMI
BIN
HMI/nspanel.HMI
Binary file not shown.
BIN
HMI/nspanel.tft
BIN
HMI/nspanel.tft
Binary file not shown.
@@ -178,13 +178,13 @@ class LuiController(object):
|
|||||||
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":
|
||||||
self._ha_api.get_entity(entity_id).call_service("media_play_pause")
|
self._ha_api.get_entity(entity_id).call_service("media_play_pause")
|
||||||
if button_type == "hvac_action":
|
|
||||||
self._ha_api.get_entity(entity_id).call_service("set_hvac_mode", hvac_mode=value)
|
|
||||||
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
|
||||||
pos = pos/100
|
pos = pos/100
|
||||||
self._ha_api.get_entity(entity_id).call_service("volume_set", volume_level=pos)
|
self._ha_api.get_entity(entity_id).call_service("volume_set", volume_level=pos)
|
||||||
|
if button_type == "speaker-sel":
|
||||||
|
self._ha_api.get_entity(entity_id).call_service("select_source", source=value)
|
||||||
|
|
||||||
# for light detail page
|
# for light detail page
|
||||||
if button_type == "brightnessSlider":
|
if button_type == "brightnessSlider":
|
||||||
@@ -207,3 +207,5 @@ class LuiController(object):
|
|||||||
if button_type == "tempUpd":
|
if button_type == "tempUpd":
|
||||||
temp = int(value)/10
|
temp = int(value)/10
|
||||||
self._ha_api.get_entity(entity_id).call_service("set_temperature", temperature=temp)
|
self._ha_api.get_entity(entity_id).call_service("set_temperature", temperature=temp)
|
||||||
|
if button_type == "hvac_action":
|
||||||
|
self._ha_api.get_entity(entity_id).call_service("set_hvac_mode", hvac_mode=value)
|
||||||
|
|||||||
@@ -265,7 +265,13 @@ class LuiPagesGen(object):
|
|||||||
if "media_content_type" in entity.attributes:
|
if "media_content_type" in entity.attributes:
|
||||||
if entity.attributes.media_content_type == "music":
|
if entity.attributes.media_content_type == "music":
|
||||||
icon = get_icon_id("music")
|
icon = get_icon_id("music")
|
||||||
command = f"entityUpd,|{item}|{heading}|{icon}|{title}|{author}|{volume}|{iconplaypause}"
|
source = entity.attributes.get("source", "")
|
||||||
|
speakerlist = entity.attributes.get("source_list","")
|
||||||
|
if source in speakerlist:
|
||||||
|
speakerlist.remove(source)
|
||||||
|
speakerlist.append(source)
|
||||||
|
speakerlist = "?".join(speakerlist)
|
||||||
|
command = f"entityUpd,|{item}|{heading}|{icon}|{title}|{author}|{volume}|{iconplaypause}|{source}|{speakerlist}"
|
||||||
self._send_mqtt_msg(command)
|
self._send_mqtt_msg(command)
|
||||||
|
|
||||||
def render_page(self, page, send_page_type=True):
|
def render_page(self, page, send_page_type=True):
|
||||||
|
|||||||
@@ -64,8 +64,8 @@ class NsPanelLovelaceUIManager(hass.Hass):
|
|||||||
|
|
||||||
controller = LuiController(self, cfg, send_mqtt_msg)
|
controller = LuiController(self, cfg, send_mqtt_msg)
|
||||||
|
|
||||||
desired_display_firmware_version = 19
|
desired_display_firmware_version = 20
|
||||||
desired_display_firmware_url = "http://nspanel.pky.eu/lovelace-ui/github/nspanel-v1.8.3.tft"
|
desired_display_firmware_url = "http://nspanel.pky.eu/lovelace-ui/github/nspanel-v1.9.0.tft"
|
||||||
desired_tasmota_driver_version = 3
|
desired_tasmota_driver_version = 3
|
||||||
desired_tasmota_driver_url = "https://raw.githubusercontent.com/joBr99/nspanel-lovelace-ui/main/tasmota/autoexec.be"
|
desired_tasmota_driver_url = "https://raw.githubusercontent.com/joBr99/nspanel-lovelace-ui/main/tasmota/autoexec.be"
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 269 KiB After Width: | Height: | Size: 270 KiB |
Reference in New Issue
Block a user