WebCore not obtaining current light status (on or off)

Hi all,

I’m trying to use a motion sensor to control lights. I also control the lights using Alexa voice commands.

Scenario A: If motion is detected, my bedroom lights are on and my downstairs lights are off, the status should flip (downstairs turns on, bedroom turns off).
Scenario B: the reverse is if bedroom lights are off and downstairs lights are on, the bedroom lights should turn on and the downstairs lights should turn off.

Let’s say I engage scenario A: the result is downstairs is on, bedroom is off. If I then tell Alexa to turn on the bedroom lights, nothing should happen if I pass the motion sensor because both downstairs and bedroom lights are on. Instead, WebCore still thinks the bedroom lights are off, and Scenario B is fired.

How do obtain the actual current light status in the piston?

Thank you!

Two things.

  1. Are your global variables @BedroomLights and @DownstairsLights acted on by any other process (piston, routine, scene, etc.)?
  2. I would pull all of the lower IF statements out by themselves and under the FIRST IF trigger and see if that works. Essentially nothing in the ELSE blocks.

Hi Pantheon,

  1. No, but Alexa and SmartThings don’t talk to eachother (they talk to the lights independently I suppose - could that be the issue?)
  2. This didn’t seem to help : (

Yes, If your global variables are not updated by your Alexa command, then webcore will not know that Alexa turned them on/off. Are your variables visible to the Alexa app?

I think this is it - no, they are not visible. I generally use voice commands to execute Scenes I built in the LiFX app.

Here is how I do this.
I use virtual switches created in my ST account, say…Bedroom_Lights_VS, Downstairs_Lights_VS and I add them to my Alexa app and webcore. I create a routine in the Alexa app the changes those switches based on what I say. For instance, I say “Alexa, turn off the bedroom lights” and in the routine I flip the Bedroom_Lights_VS off and turn off the lights (either within the Alexa app or in a small webcore piston). THEN, webcore will know if the virtual switch has changed and can trigger accordingly. You probably have your lights in an Alexa Group and are controlling them that way?

I don’t know anything about the LIFX app so I cannot help you there. But what you have now can EASILY be modified to do what you desire.

You may also want to post your piston on the webcore forum and ask for assistance with editing it. In the current form you have it, I am not certain the last two Else blocks will evaluate properly. :slight_smile:

1 Like

One question - you are using the Lifx integration through the new app?