Getting player state of sonos device on update

Hi,

I have various Sonos devices in my home which I'm controlling using the contrib-sonos-plus nodes and everything works just fine.

Up to now I'm getting the player status (like playback status and volume) by querying a Universal node at regular intervals (1 second), whenever a dashboard tab that displays those values is "active", i.e. someone is viewing the tab. To achieve this I have a flow that sets a global variable (global.media_tab_active) based on the output of an ui_control node. On the media tab I have a configurable interval node that "pings" every second, passing through a switch node, which acts like a gate checking whether the global variable is set. If the message passes the gate the Universal nodes is triggered and the dashboard is updated. When the viewer leaves the tab global.media_tab_active is set to false and the gate closes.

Since this is not optimal (the interval continues to send messages) I think I will change that to a message based method in the way that when the media tab is viewed a MQTT message is send to the "player state" flow that enables the interval node.

However, thinking about this I was wondering if there might be a better way to achieve this functionality? Many devices send their status when they chage. Maybe I'm missing something in the sonos nodes?

As a side question: How low can you go when triggering the universal sonos node? 1 second works, but having a little less "lag" would be nice.

Thanks in advance for your thoughts.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.