I implemented a custom driver for switches and exposed them to Alexa using the Alexa Echo Skill. Everything worked fine. I did not have to enable the "Respond Immediately without waiting for device" in the Amazon Echo Skill app.
I re-implemented the driver to use a parent/child architecture. With this implementation, I have to enable the "Respond immediately..." , else the Echo doesn't speak the normal "OK".
The switches turn on/off correctly, but after several seconds, the Echo says something like "I don't know what went wrong".
So, there must be some sort of reply needed from my driver or the Amazon Skill immediately after receiving the message from the echo. But, I didn't (knowingly) do anything like that in the original implementation. Here's the "off" implementation in the one that results in the "OK":
def off() {
if (logEnable) log.debug "Sending off request to [${settings.ip}, station ${settings.station}]"
sendEvent(name: "switch", value: "off", isStateChange: true)
interfaces.rawSocket.sendMessage("rf ${settings.station} off\n")
pauseExecution(2000)
//refresh()
}
Here's the componentOff implementation in the parent/child implementation. It is in the parent, not the child.
void componentOff(cd){
station = cd.getDataValue("station")
if (logEnable) log.debug "Sending off request to [${settings.ip} ${station}]"
interfaces.rawSocket.sendMessage("rf ${station} off\n")
log.info "before pause"
pauseExecution(2000)
log.info "after pause"
sendEvent(name: "switch", value: "off", isStateChange: true)
}
I tried moving the sendEvent before doing the write (so it would occur before the 2 second delay) but that didn't change anything.
Is it possible that it's because the sendEvent is issued from the parent instead of the child?
Alexa knows nothing about the parent--only the child devices were added to the Amazon Echo Skill.
Or, is the sendEvent event even relevant? Is there something else in a driver that must be done for Alexa to get the expected response? Or, should the Amazon Echo Skill (in Hubitat) take care of that?