New question relationship between standardtile and create event FIXED

Update: Funny when you finally reach out and try to get help you review your code enough to try something different. Change the Value of my send event to ledone. And it worked.


What I am trying to do seem simple. I have two two that control two GPIO pins on the raspberry. I have them triggering the GPIO off and on and was that happens the NextState of each button turns the tile to reflect the state. This works great.

But two issues. If both pins are on dragging the device down in the IOS app (refreshing I assume) reset both tiles to the off color. I am not sure where to program the device type to go out and check the pin status.

That being side I have another tile that control a refresh routine that does go out and check the status of both pins. The status is returned correctly stating that both pins are on. How do I tell my tile, switch to the state that represents ON. I see the notification pop up in the device so I know that code is executing. But nothing is happening with my tile.

Here is my standardtile
standardTile(“Led1Trigger”, “device.ledone”, width: 1, height: 1, decoration: “flat” ){
state (“ledoneoff”, label:‘LED 1’ , action: “led1on”, icon: “st.contact.contact.open”, backgroundColor:"#53a7c0", nextState: “ledoneon”)
state (“ledoneon”, label: ‘LED 1’, action: “led1off”, icon: “st.contact.contact.close”, backgroundColor: “#FF6600”, nextState: “ledoneoff”)
}
Here is the code to turn it off an on. What am I missing.

if (result.gpio_value_17.contains(“0”)){
log.debug "gpio_value_17: off"
sendEvent(name: “Led1Trigger”, value: “ledoneoff”,isStateChange: true)
} else {
log.debug "gpio_value_17: on"
sendEvent(name: “Led1Trigger”, value: “ledoneon”,isStateChange: true)
}

1 Like