Virtual switch, works in IDE, not in ST App, any ideas?


(Mike Maxwell) #1

Going on day two with this issue and getting very annoyed, any help would be appreciated.
Simple virtual switch with two standard tiles
Main tile is your standard on/off, works fine.
Detail tile calls custom command, this works in the IDE, but not from the App, not on android, not on iOs.

I can call the custom command from a smart app, works fine.
There just is no firing the second tile from the App.
Bug?, Feature? Me?
WTH…

metadata {
	definition (name: "superState switch", namespace: "mmaxwell", author: "Mike Maxwell") {
		capability "Switch"
	    command "snap"
    }
	simulator {
	}
	tiles {
		standardTile("button", "device.switch", width: 2, height: 2, canChangeIcon: true, canChangeBackground: true) {
			state "off", label: 'Off', action: "switch.on", icon: "st.illuminance.illuminance.dark", backgroundColor: "#ffffff", nextState: "on"
			state "on", label: 'On', action: "switch.off", icon: "st.illuminance.illuminance.dark", backgroundColor: "#79b821", nextState: "off"
        }
        standardTile("snap", "device.switch", width: 1, height: 1, canChangeIcon: false,decoration: "flat") {
            state "default", label: 'Snap', action: "snap.snap", icon: "st.camera.take-photo", backgroundColor: "#ffffff" 
		}
		main "button"
		details "button","snap"
	}
}
def parse(String description) {
}
def snap(){
	log.debug "snap request"
    on(true)
}
def on(action) {
	def isSnap = action ?: false
	log.debug "isSnap:${isSnap}"
    log.debug "superState ${device.displayName}:on"
	return sendEvent(name: "switch", value: "on", data: [isSnap: "${isSnap}"])
}
def off() {
	log.debug "superState ${device.displayName}:off"
	return sendEvent(name: "switch", value: "off")
}

(Todd Wackford) #2

try changing the action called from the tile to just “snap” instead of “snap.snap”.

HTH


(Mike Maxwell) #3

Well I’ll BaSOB, that worked. Thanks man, makes no sense but worked.