How do you use HTTP switch with Alexa/Google Home

I have Broadlink RM Pro with RM Bridge/Plugin running to control my RF outlets, so I can make HTTP request to [IP]/lights_on to turn the lights on, and [IP]/lights_off to turn the lights off.

I use @CSC’s HTTP button creator to create a button that would make these HTTP requests. So I have one button: one for on, and one for off.

At first I named these “Lights On” and “Lights Off”. However, this doesn’t work too well since when I ask Alexa to turn lights on, it would complain that there are multiple devices called “lights”.

So I ended up naming these HTTP buttons X_On and X_Off. I then create another virtual switch Lights, with a smart light with a program that would turn on X_On on when Lights is turned on, and turn on X_Off when Lights is turned off. The result is ok. I have a virtual switch that I can turn on or off in my app, or through voice command.

The problem is when I turned the lights on without going through SmartThings. The status of Lights is still off, when the lights really are already on. When I ask Alexa to turn off the lights, SmartThings wouldn’t respond since it thought the lights are already off.

My question: is there another, easier way to work with HTTP button? If not, is there a way I could set my virtual switch so that it sends the command (say off) even though the status is already off?

Thanks!

Have you try the http switch? single switch to on / off just like normal switch.

HTTP Switch is great. What it lacks is the ability to “force” turning a switch on or off (in case, say, the switch was turned on by means other than ST.) @btrial’s solution was to create two momentary buttons (see here).

Now I’m trying to combine both. So basically 3 buttons. One to toggle on/off. The other two to “force” the switch to turn on/off regardless of the switch’s state. This is my first DTH, so any guidance would be appreciated. Here’s what I have so far:

I’m just abstracting from all the commands, etc. for now and try to focus on the interface. This is how I understand it works:

  • There’s a parameter switch that could take value “on” or “off”. The toggle tile reads this value and sets the background color, label, and action accordingly.
  • When on() is called, it sets this parameter to “on”… this should supposedly change the toggle and value_tile tiles… but somehow they don’t change.
  • The only change I see comes from putting in nextState.
  • The xxx is just there since I don’t know what to put there.

Thanks a lot!