Super Tiles: multiple attributes for thing icon states

Would it be possible to add the option to use multiple attributes in the “thing icon” states on Super Tiles? Adding states to the tile itself from a dashboard allows you to choose the device and attribute for each state, but there’s no option to hide an icon from there, only animate.

Some of my appliances don’t change ‘operating state’ when the ‘switch’ state changes, and I can’t seem to figure out a way to make a thing icon disappear when the icon is based on operating state (I’d like to use different icons per mode, not just ‘on’ or ‘off’).

Sorry if these are poor quality- new user limited to 1 embedded image…

Thanks for sharing the example use cases and screenshots!

As a workaround, you could create SharpTools rule that would combine the two states into a variable, then you could use that variable for the icon.

Example Rules

One approach would be to have a trigger for each attribute changing, then in the rule you could use an expression to combine the states.

Here’s an example expression that always combines the status into a format of switch:operatingState in a text variable.

original = 'on:cool'      #//YourVariable
eventAttribute = 'switch' #//context.event.attribute
eventValue = 'off'        #//context.event.value

oParts = split(original, ':')
oSwitch = equalText(eventAttribute, 'switch') ? eventValue : oParts[0]
oState = equalText(eventAttribute, 'thermostatOperatingState') ? eventValue : oParts[1]

concat(oSwitch, ':', oState)

Of course in your actual rule, it you would swap out the first three lines with references to the real variables… I just used static values in the example above as it’s easier to test the rule concept.

In the example above, it’s simulating:

  • Switch changing from on to off
  • Thermostat Operating State remains in a cool state.
  • Output: off:cool
Expression with Variables Replaced (tap to expand)
original = $YourVariable
eventAttribute = $context.event.attribute
eventValue = $context.event.value

oParts = split(original, ':')
oSwitch = equalText(eventAttribute, 'switch') ? eventValue : oParts[0]
oState = equalText(eventAttribute, 'thermostatOperatingState') ? eventValue : oParts[1]

concat(oSwitch, ':', oState)

Alternative: Operating State or Off

Alternatively, if you only wanted a single generic off state otherwise you wanted it to report the current Thermostat Operating Mode, you could add a second separate expression after the first which is basically the same expression but with the last line changed to only output the simplified state to a different variable.

So the first expression in the sample above might be a Set Variable $thermostatCombinedState action. Then the second would be a Set Variable $thermostatState or whatever naming is intuitive to you.

original = 'on:cool'      #//YourVariable
eventAttribute = 'switch' #//context.event.attribute
eventValue = 'off'        #//context.event.value

oParts = split(original, ':')
oSwitch = equalText(eventAttribute, 'switch') ? eventValue : oParts[0]
oState = equalText(eventAttribute, 'thermostatOperatingState') ? eventValue : oParts[1]

equalText(oSwitch, 'off') ? 'off' : oState