mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2026-02-14 17:08:17 +01:00
fix media page/callbacks
This commit is contained in:
@@ -43,11 +43,10 @@ class Card(object):
|
|||||||
entityIds.append(self.entity.entityId)
|
entityIds.append(self.entity.entityId)
|
||||||
if self.entity.status is not None:
|
if self.entity.status is not None:
|
||||||
entityIds.append(self.entity.status)
|
entityIds.append(self.entity.status)
|
||||||
else:
|
for e in self.entities:
|
||||||
for e in self.entities:
|
entityIds.append(e.entityId)
|
||||||
entityIds.append(e.entityId)
|
if e.status is not None:
|
||||||
if e.status is not None:
|
entityIds.append(e.status)
|
||||||
entityIds.append(e.status)
|
|
||||||
|
|
||||||
# additional keys to check
|
# additional keys to check
|
||||||
add_ent_keys = ['weatherOverrideForecast1', 'weatherOverrideForecast2', 'weatherOverrideForecast3', 'weatherOverrideForecast4', 'statusIcon1', 'statusIcon2', 'alarmControl']
|
add_ent_keys = ['weatherOverrideForecast1', 'weatherOverrideForecast2', 'weatherOverrideForecast3', 'weatherOverrideForecast4', 'statusIcon1', 'statusIcon2', 'alarmControl']
|
||||||
|
|||||||
@@ -474,12 +474,14 @@ class LuiPagesGen(object):
|
|||||||
self._send_mqtt_msg(command)
|
self._send_mqtt_msg(command)
|
||||||
|
|
||||||
def generate_media_page(self, navigation, title, entity, entities, mediaBtn):
|
def generate_media_page(self, navigation, title, entity, entities, mediaBtn):
|
||||||
item = entity.entityId
|
entityId = entity.entityId
|
||||||
if not apis.ha_api.entity_exists(item):
|
if entity.status is not None:
|
||||||
command = f"entityUpd~Not found~{navigation}~{item}~{get_icon_id('alert-circle-outline')}~Please check your~apps.yaml in AppDaemon~~0~{get_icon_id('alert-circle-outline')}~~~disable"
|
entityId = entity.status
|
||||||
|
if not apis.ha_api.entity_exists(entityId):
|
||||||
|
command = f"entityUpd~Not found~{navigation}~{entityId}~{get_icon_id('alert-circle-outline')}~Please check your~apps.yaml in AppDaemon~~0~{get_icon_id('alert-circle-outline')}~~~disable"
|
||||||
else:
|
else:
|
||||||
media_icon = self.generate_entities_item(entity, "cardGrid")
|
media_icon = self.generate_entities_item(entity, "cardGrid")
|
||||||
entity = apis.ha_api.get_entity(item)
|
entity = apis.ha_api.get_entity(entityId)
|
||||||
heading = title if title != "unknown" else entity.attributes.friendly_name
|
heading = title if title != "unknown" else entity.attributes.friendly_name
|
||||||
title = get_attr_safe(entity, "media_title", "")
|
title = get_attr_safe(entity, "media_title", "")
|
||||||
author = get_attr_safe(entity, "media_artist", "")
|
author = get_attr_safe(entity, "media_artist", "")
|
||||||
@@ -504,7 +506,7 @@ class LuiPagesGen(object):
|
|||||||
for item in entities:
|
for item in entities:
|
||||||
item_str += self.generate_entities_item(item, "cardGrid")
|
item_str += self.generate_entities_item(item, "cardGrid")
|
||||||
|
|
||||||
command = f"entityUpd~{heading}~{navigation}~{item}~{title}~~{author}~~{volume}~{iconplaypause}~{onoffbutton}~{shuffleBtn}{media_icon}{item_str}"
|
command = f"entityUpd~{heading}~{navigation}~{entityId}~{title}~~{author}~~{volume}~{iconplaypause}~{onoffbutton}~{shuffleBtn}{media_icon}{item_str}"
|
||||||
self._send_mqtt_msg(command)
|
self._send_mqtt_msg(command)
|
||||||
|
|
||||||
def generate_alarm_page(self, navigation, entity, overwrite_supported_modes, alarmBtn):
|
def generate_alarm_page(self, navigation, entity, overwrite_supported_modes, alarmBtn):
|
||||||
|
|||||||
Reference in New Issue
Block a user