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.
@@ -146,6 +146,8 @@ class NsPanelLovelanceUI:
|
||||
if item_type == "delete":
|
||||
return "entityUpd,{0},{1}".format(item_nr, item_type)
|
||||
|
||||
if not self.api.entity_exists(item):
|
||||
return
|
||||
entity = self.api.get_entity(item)
|
||||
name = entity.attributes.friendly_name
|
||||
|
||||
@@ -187,10 +189,17 @@ class NsPanelLovelanceUI:
|
||||
def generate_media_page(self, item):
|
||||
entity = self.api.get_entity(item)
|
||||
heading = entity.attributes.friendly_name
|
||||
if "media_content_type" in entity.attributes:
|
||||
if entity.attributes.media_content_type == "music":
|
||||
icon = 5
|
||||
title = "test_title"
|
||||
author = "test_author"
|
||||
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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user