Toggle standardTile's state from another tile's action

New ST user and programmer here. I’m trying to modify one of the custom device types I’ve found on the forums for the GE Fan controller. What I would like is three tiles under the primary control to say LOW, MED, HIGH and to be highlighted to which one the controller is currently set to. Here is a sample of what I currently have tried but I appear to be missing something.

    //Speed control row
    standardTile("lowSpeed", "device.level", height: 2, width: 2, inactiveLabel: false, decoration: "flat") {
        state "lowSpeed", label:'LOW', action:"lowSpeed", icon:"st.Home.home30"
        state "off", label:'LOW', icon:"st.Home.home30", backgroundColor:"#79b821"
    }
    standardTile("medSpeed", "device.level", height: 2, width: 2, inactiveLabel: false, decoration: "flat") {
        state "medSpeed", label:'MED', action:"medSpeed", icon:"st.Home.home30"
    }
    standardTile("highSpeed", "device.level", height: 2, width: 2, inactiveLabel: false, decoration: "flat") {
        state "highSpeed", label:'HIGH', action:"highSpeed", icon:"st.Home.home30", backgroundColor:"#79b821"
        state "off", label:'HIGH', icon:"st.Home.home30", backgroundColor:"#ffffff"
    }

   def lowSpeed() {
        log.debug "Low speed settings"
        sendEvent(name:"highSpeed", value:"off")
        delayBetween ([zwave.basicV1.basicSet(value: 30).format(), zwave.switchMultilevelV1.switchMultilevelGet().format()], 5000)
   }

   def medSpeed() {
        log.debug "Medium speed settings"
        delayBetween ([zwave.basicV1.basicSet(value: 62).format(), zwave.switchMultilevelV1.switchMultilevelGet().format()], 5000)
   }

   def highSpeed() {
        log.debug "High speed settings"
        sendEvent(name:"lowSpeed", value:off)
        delayBetween ([zwave.basicV1.basicSet(value: 99).format(), zwave.switchMultilevelV1.switchMultilevelGet().format()], 5000)
   }

I hope I get this right for you…

  1. The 2nd parameter in the standard tile is the attribute that it monitors for state changes, so these tiles are currently looking at the device.level attribute, which is a number; but you’re trying to determine its state based on unrelated strings.

  2. The event you created named “highspeed” has no corresponding attribute, so this line won’t do anything. You need to add any custom attributes into the metadata like you see for currentSpeed. You can always hide the events, so it doesn’t add activity in the logs for something that is purely cosmetic.

I think the best way to do this is to change the “device.level” to “device.currentSpeed”, then base the state(s) off of the already implemented currentSpeed attribute. Each tile would need each of the 4 states, just the action and the background color for the chosen state would differ.

Here’s a sample of this version. It only required changing the tile code. It takes a moment for the currentSpeed attribute to be updated and the old speed to reflect that it’s no longer selected, but it works. You might want to play with icons and colors.

//Speed control row
        standardTile("lowSpeed", "device.currentSpeed", inactiveLabel: false, decoration: "flat") {
            state "LOW", label:'LOW', action:"lowSpeed", icon:"st.Home.home30", backgroundColor: "#79b821"
            state "MEDIUM", label: 'LOW', action: "lowSpeed", icon:"st.Home.home30", backgroundColor: "#ffffff"
            state "HIGH", label: 'LOW', action: "lowSpeed", icon:"st.Home.home30", backgroundColor: "#ffffff"
            state "OFF", label: 'LOW', action: "lowSpeed", icon:"st.Home.home30", backgroundColor: "#ffffff"
        }
        standardTile("medSpeed", "device.currentSpeed", inactiveLabel: false, decoration: "flat") {
            state "MEDIUM", label: 'MED', action: "medSpeed", icon:"st.Home.home30", backgroundColor: "#79b821"
            state "LOW", label: 'MED', action: "medSpeed", icon:"st.Home.home30", backgroundColor: "#ffffff"
            state "HIGH", label: 'MED', action: "medSpeed", icon:"st.Home.home30", backgroundColor: "#ffffff"
            state "OFF", label: 'MED', action: "medSpeed", icon:"st.Home.home30", backgroundColor: "#ffffff"
        }
        standardTile("highSpeed", "device.currentSpeed", inactiveLabel: false, decoration: "flat") {
            state "HIGH", label: 'HIGH', action: "highSpeed", icon:"st.Home.home30", backgroundColor: "#79b821"
            state "LOW", label: 'HIGH', action: "highSpeed", icon:"st.Home.home30", backgroundColor: "#ffffff"
            state "MEDIUM", label: 'HIGH', action: "highSpeed", icon:"st.Home.home30", backgroundColor: "#ffffff"
            state "OFF", label: 'HIGH', action: "highSpeed", icon:"st.Home.home30", backgroundColor: "#ffffff"
        }
1 Like

@Sticks18 Your code is what I’m basing my custom device type of all actually, just realized that.

So your suggestion of having all states under each mode somewhat works, it just isn’t consistent. Sometimes it toggles the highlight of the speed, other times it toggles the highlight on all three. Is there something I’m missing (most likely).

Also, how would I go about having the appropriate level tile being highlighted when Thing tile is opened? Right now if I change the mode physically it isn’t reflected in the tile.

Are you using Android? And did you use the code block I posted or did you make any changes? I’m on iOS, and sometimes there are differences. Just trying to make sure we’re working with the same scenario. I only did a very quick test, but I can test it more tomorrow.

As for physical state changes. It should reflect them correctly. It may take it a little while to pick up on the physical change because these switches don’t instantly report the change back to ST. Lutron holds a patent on instant reporting, so most switch makers don’t include it to keep cost down. Does pressing the ‘Refresh’ button update the correct state?

I’m on iOS and I was able to use your code block directly as I didn’t have anything else I wanted to do for the icon or background.

I’ll have to test with the refresh and get back to you.

hello, i’m new in ST user and programming. i’m working on a project that determines the level of fluid in a tank. An ARDUINO UNO + ThingShield + ultrasonic sensor + 4x4 keypad +16x2 LCD.
here are the requirements for what the user should do:

  1. Enter the width value of the tank
  2. Enter the Length value of the tank
  3. Enter the height value of the tank
    first three inputs are entered manually by the keypad, then the maximum volume will be saved (WxLxH)
  4. the ultrasonic sensor measures the distance “D” and then the actual volume will be (WxLX(H-D))
  5. the actual volume will be displayed on the LCD

So what i’m facing is that HOW TO DISPLAY THE ACTUAL VOLUME ON A TILE IN ST

NOTE: I THINK THE BEST WAY TO DO IS TO CREATE A REFRESH BUTTON, AND WHENEVER I PRESS THE REFRESH, THE CURRENT ACTUAL VOLUME SHOULD BE DISPLAYED IN ANOTHER TILE.
i really appreciate your help if possible