Device Tile that can change text?

(Mark Harding) #1

Hi. New to all this so just looking for a couple of pointers to see if something is even possible.

Can you have a device type. Not sure what. That can display dynmic text. For example read a state/text of something or be passed a value and display that.

For example a switch but shows a state as in off. On. Standby or a value of high medium low. But these would need to change. So could be either cat dog rabbit or one day say cow.

Hopefully that makes sense!!!

(Allan) #2

Short answer is no. Long answer is you can get a result that is similar to what you want by having multiple different states for the tile, each state being the option that you want to display.


(Robin) #3

Check these out for inspiration:

(Mark Harding) #4

Food for thought. Is it possible to get a tile to show a jpg at all rather than txt???

Is it also possible to have multiple choices from a switch to send a value.

Sorry for all the questions

(Robin) #5

You can reference an image for each state via http address.

For example, this extract from the snooze button in my simulated alarm clock DTH uses a grey coloured bell when off and orange when on.

standardTile("Snooze", "device.Snooze", inactiveLabel: false, decoration: "flat", width: 3, height: 2) {
            state "on", label:"", action:"", icon:""
            state "off", label:"", action:"Snooze_On", icon:""

The images are saved in my git repository to keep them live with a constant URL

(Robin) #6

I don’t fully understand the question… but a single switch can only run one action per click, so will only toggle through states in a set order. It won’t bring up a selection list if that’s what you mean.

This is why I used individual tiles to select state in my dog feeding example.

(Mark Harding) #7

Yeah wasn’t the best explanation. Basically would need a number of say buttons within the device that sends a value of say 1 2 or 3 depending on what’s pressed. But these are what I would like to be dynamic. I’m rubbish at explaining things!!! I ideally need to read something in from a device ie 1 2 or 3 but could be 4. Then show the value in the tile. Then ideally say these values somewhere then allow me to recall the value at any time to send back?!?!?!

(Robin) #8

You’ve lost me… perhaps a use case would help?

(Mark Harding) #9

i have a app running on my raspberry Pi that looks at the state of my ps4. it then returns a value of either On, Off, Standby or playing a game. so that’s why i need the status of the switch kind of thing. it would only ever need to return 2 states thou either on on or off. i could then use the raspberry to do what’s needed.

If state was standby send the on command for example

if it was on or playing a game then send the off command. if it was off then there is nothing that can be done as the app cant awake the ps4 from fully off.

then what i would like ie either a text field showing what game is playing as i can then supply that to the app/tile.

ideally what would also be good but i’m guessing this is way out is some kind of list/table i could populate with game names and that would allow me to select a name and start that from a tile/list/what ever.

i did this on the PI using node red as it just looked at the names of the games and created a list and then i had a drop down field to select. i did steal the code and modified it slightly so not 100% sure how it worked but was quite handy.

(Robin) #10

Those aren’t dynamic states… you have for specified states that will never change from that list of 4.

Just use my example with the garage door attribute.

You assign an ‘action’ for each state (what action to occur on button press whilst in that state) so each defined action can send an off, etc.

Then add a valueTile which can display the current game being played.

I’m not familiar with Pi though, so specific incoming / outgoing events defined in the actions will be beyond me.

(Mark Harding) #11

Yeah was having a look at the hungry state you posted. With a little work etc looks like it could work great for the status. Just need on and off button added in and then. The title played which you said was a valuetile. So I’ll have a look into that.

(Edward Niedziejko) #12

I was able to create a dynamic button text for the Nanoleaf api I did some work on.

You can view the code here:

Look at the “standardtile scene 1” as an example.

(PPO16) #13

It seems your use case is basically what the player tile is doing but adapted to your raspberry information, Have a look at how this tile displays the song’s title at this link.

Hope it helps