Support for Variables in Media Tiles

My particular use case for this requirement is probably not as widespread in this forum BUT, I think it opens up a world of possibilities for dashboards. I’ll start with a couple of screen-shots so I can explain my scenario - together with a link to a thread where I discuss the issue in detail.

In Rule Manager, I have created a string variable called albumArtUri and this is populated from a device attribute in Hubitat. In this case, it’s querying album art for Sonos from a custom driver (as Hubitat doesn’t expose it to SharpTools natively).

Screen Shot 2021-01-30 at 7.30.46 AM

So with the albumArtUri being automatically populated now, I would like the ability to create a media tile to display the contents of this variable as shown below:

Screen Shot 2021-01-30 at 7.30.05 AM

The idea here is when the value of the albumArtUri variable changes, so does the image displayed in the media tile. It sounds redundant because SharpTools has a media tile feature already but as I said, the Sonos/Hubitat integration doesn’t expose the album art like SmartThings does.

Taking this one stage further. Again taking an example from my own setup. If you look at the dashboard below which is primarily Sonos driven, I have 20x station presets. These are media tiles with static images on them that point to a web host via some http URL. One of my long time goals is to have the button that represents the station being played to change color to show it’s been selected.

So if I pressed the button for Vinyl Classic Rock, the button would change to a dark blue (as a simple example) but keep the image for the station. Because buttons don’t have an on/off state, it’s not possible to set an active status as you can with a switch. But you could achieve something similar for a station that’s playing; a variable called VinylClassicRock could be entered for the media tile and the value for it controlled with logic. Like, if the Office Sonos is playing Vinyl Classic Rock, change the value of the Vinyl Classic Rock variable to “somewebserver.com”. Otherwise, when it’s NOT playing, point the variable to “somewebserver.com”.

Excellent write-up, description, and examples! I cast a vote as I could see other cool use-cases enabled by this. I don’t have anything specific in mind, but since this would enable the ability to dynamically change media from rules, it provides a lot of flexibility.

Piggybacking on your active radio station idea, it could be used to reflect the status of a device or an aggregated status of multiple devices. And since it’s powered by the Rule Engine, it could be more than binary states… it could really be any number of states - for example, having an image of your house on your dashboard that changes with the weather.

Edit: Don’t forget to scroll to the top of the post and cast a vote yourself! :smiley:

3 Likes

Posted this yesterday to Hubitat since it is currently specific to that platform. Josh pointed out it could be a workaround for this feature request. I am still trying to figure out what I plan on doing with it.

Thanks for the heads up! Let me kick the tires and see how it works out. I’ll keep you posted…

While dynamically changing a media tile would open up a world of possibilities (keep the votes coming)… you could however achieve the scenario:

by using a Variable(s), Rule(s) and some CSS.


1)Create a True/False Variable (Note: Set initial value to false).
2)Create a Rule to execute the variable (play station).


Note: Change ‘Delay’ based on your environment/preference.

3)Create a Theme/Add Style and some CSS to indicate the default/active state.

CSS Examples
Default (Off) / Active (Playing) States

4)Add the variable to your Dashboard and change the Style states to reflect the custom style reference (i.e ex1, ex2, …)

3 Likes

Would be good for generating maps with POIs on it that could be fed by attributes of things mapped from HE / ST

Michael, this looks interesting - and creative! I’m with you all the way until I get to the applying of the example CSS. I’ve created a custom theme and added CSS to it but how do I apply the style to the variable that I’ve added to the dashboard?

Gary,
If you haven’t already… be sure to create add_style a style reference for each example: ex1, ex2, ex3.

Then enter ‘Edit’ Mode for the dashboard > Click ‘Edit’ for the Variable Tile > Check the ‘Style’ feature > Click ‘Style States’ > Click ‘Style’ for each state (True/False) and select the custom style (e.g. ex1)

2 Likes

Got it, thanks Michael!

+1 bump for this. I am back to needing periodic refresh of background images, so hopefully variables could be applied to media tiles and backgrounds with a specified interval for refresh

1 Like

I made a post requesting this same capability and Josh reminded me of this one.

I would like to add my +1 and also my reason for the request.

  1. Weather. With my dashboard home page mostly weather centric, there are times of the year where some weather information is valid and others when it’s not. For example, Winter Weather advisories are front and center Nov-Mar. But come April, I switch those out with Severe Storm Warnings. If my “Weather Warnings” media tile was able to hold a variable, I could automatically switch the displayed media tile based on the date range. At the moment, I manually update the tiles.

  2. Camera. Another random thought for this would be a rotating security camera tile. If, for example, you have six security cameras, you could potentially rotate between all six camera feeds by updating the variable every few seconds or minutes. Perhaps it could be triggered based on motion? Perhaps the “Camera” tile shows the driveway until the doorbell rings and the feed switches to the doorbell camera?

1 Like