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