Having Sonos largely integrated into Dashtiz, the last fun part is still missing: AlbumArt
I have the (dynamic) URL to the current AlbumArt in a Domoticz variable (As I have for album, artist and title).
In Domoitcz Events, I have:
Code: Select all
json = (loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()
local sonos=assert(io.popen('curl http://192.168.178.55:5005/Woonkamer/state'))
local status = sonos:read('*all')
sonos:close()
local jsonStatus = json:decode(status)
local sonos_woonkamer = 'Sonos Woonkamer'
playerstate = jsonStatus['playbackState']
artist = jsonStatus['currentTrack']['artist']
title = jsonStatus['currentTrack']['title']
nexttitle = jsonStatus['nextTrack']['title']
album = jsonStatus['currentTrack']['album']
albumart = jsonStatus['currentTrack']['absoluteAlbumArtUri']
Code: Select all
commandArray['Variable:Sonos_album'] = album
commandArray['Variable:Sonos_artist'] = artist
commandArray['Variable:Sonos_title'] = title
commandArray['Variable:Sonos_nexttitle'] = nexttitle
commandArray['Variable:Sonos_album_art'] = albumart
url : sonos_album_art
Also I noticed the images vary in size, do they need to get scaled somehow to be placed properly into a frame?
Thanks - Jeroen