I have Alexa controlling a smart relay, which is part of a two way circuit with a regular light switch. It works well bar one thing: if the relay is "off" and the manual switch is on, telling Alexa to turn the light off does not work; she says OK, but as the relay is already in the "off" state, she does nothing. I want her to toggle the relay when ever I say Off or On , irrespective of what Alexa sees as the 'current state' of that relay.

Is this possible?

EDIT (in response to questions)

The relay is a Sonoff brand WiFi switch

The wiring diagram is (as best I can show here) as follows

Power fed into "1" or N.O. of both wall switch and relay. Then the Common of both the wall switch and the relay are linked, then the "2" is linked to "N.C" and the lights.

enter image description here

  • Also include a description of how your relay is linked to Alexa, what is the flow of commands from the smart home skill? And what type of relay are you using.
    – hardillb
    Aug 24, 2019 at 5:50
  • Please use Stack Exchanges image hosting when uploading images so they can be easily in lined. Also what firmware is the Sonoff running? I'm going to guess it's something that means it's emulating a Wemo socket if you are not using a specific smart home skill to control it.
    – hardillb
    Aug 26, 2019 at 6:56

1 Answer 1


If the device is emulating a WeMo socket or a Hue Lighting hub to be directly controlled by an Alexa device then you can only turn it on/off not toggle the current state.

Since the Alexa device has no way to be updated when the physical switch is tripped it can't pick the right thing to do when you ask it to control the lights.

If you want to build a custom skill and have a Sonoff device that is capable of measuring power usage then it might be possible to build a skill that would report state back to Alexa then it could also send the same right commands based on the state.

Also the Sonoff-Tasmota firmware supports a Toggle command which will flip the state of the relay to the opposite of what ever it's current state is. Looking at the doc this appears to only be available via direct control (e.g. HTTP or MQTT) so you could put together something that just sent the Toggle command for either and On or Off request.

  • OK, so I need it to toggle state when told to turn on or off, and I cannot see where to tell it to do this. I need something like an "IF" statement. The Alexa app that you set it up with does not have toggle as an option (that I can see).
    – Bevan
    Aug 27, 2019 at 19:54
  • I'm saying is not possible in the mode you are using (with wemo or hue). The only way to do this is to use a custom smart home skill
    – hardillb
    Aug 27, 2019 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.