mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-21 23:14:25 +01:00
added inital support for media card in appdeamon app
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.
@@ -145,7 +145,9 @@ class NsPanelLovelanceUI:
|
|||||||
|
|
||||||
if item_type == "delete":
|
if item_type == "delete":
|
||||||
return "entityUpd,{0},{1}".format(item_nr, item_type)
|
return "entityUpd,{0},{1}".format(item_nr, item_type)
|
||||||
|
|
||||||
|
if not self.api.entity_exists(item):
|
||||||
|
return
|
||||||
entity = self.api.get_entity(item)
|
entity = self.api.get_entity(item)
|
||||||
name = entity.attributes.friendly_name
|
name = entity.attributes.friendly_name
|
||||||
|
|
||||||
@@ -187,10 +189,17 @@ class NsPanelLovelanceUI:
|
|||||||
def generate_media_page(self, item):
|
def generate_media_page(self, item):
|
||||||
entity = self.api.get_entity(item)
|
entity = self.api.get_entity(item)
|
||||||
heading = entity.attributes.friendly_name
|
heading = entity.attributes.friendly_name
|
||||||
icon = 5
|
if "media_content_type" in entity.attributes:
|
||||||
title = "test_title"
|
if entity.attributes.media_content_type == "music":
|
||||||
author = "test_author"
|
icon = 5
|
||||||
volume = 75
|
else:
|
||||||
|
icon = 5
|
||||||
|
if "media_title" in entity.attributes:
|
||||||
|
title = entity.attributes.media_title
|
||||||
|
if "media_artist" in entity.attributes:
|
||||||
|
author = entity.attributes.media_artist
|
||||||
|
if "volume_level" in entity.attributes:
|
||||||
|
volume = int(entity.attributes.volume_level*100)
|
||||||
|
|
||||||
return "entityUpd,{0},{1},{2},{3},{4},{5}".format(item, heading, icon, title, author, volume)
|
return "entityUpd,{0},{1},{2},{3},{4},{5}".format(item, heading, icon, title, author, volume)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user