How to override motion sensor light?


#44

How do I check the value of the variable? I removed the variable in the second piston and the light does turn off. So, it’s has something to do with the value for sure. I tried the Test but I wasn’t sure how the debug work.


#45

If you look at your piston on line 17, there should be either true or false at the end.


Without that variable in place, you will no longer be overriding the motion sensor.
(I would go back to using import code ‘tb64’)


The TEST button will do nothing on this piston. Your piston only fires when something happens in your motion sensor and/or White bulb. (notice the lightning bolts in the left largin… Those are your triggers)


#46

Is this after I clicked on the Test button? I do not see anything after the variable or line 17.


#47

Well, line 17 in your screenshot may not be exactly line 17 inside your piston. (but it’s the only visual reference I have) The true/false should be right after “boolean lightStatus” at the top.

If there is nothing displayed after that, then your piston has not run even once successfully. (remember the TEST button does nothing in this piston. You have to actually walk in front of Motion Sensor 2 and/or toggle White Bulb 1’s switch for your piston to do anything)


#48

If you’re referring to /* false */ at the end of line 12? If so, that explains why it’s not turning off the light after 2 minutes.


#49

So the question is, why is line 27 not executed after the light turns on?


#50

I would start by manually turning Kitchen Lights switch off… leaving the room for 5 minutes (so the motion changes to inactive)… and then walk in front of the Kitchen Sensor.

Hopefully, the light comes on.

Then walk back to your computer, and the variable should be /* true */ for the next two minutes.


#51

If I manually turned off the light, the variable value does turn to true. However, when I walked back into the room and motion sensor detected me, the variable value turns to false again. Is this normal behavior?


#52

I just scrolled back thru this thread, and it seems that none of us have mentioned a key element.

98% of devices make no distinction between “physical” changes and “programmatic” changes.
(Because of this, I am now in the habit of simply choosing “any interaction”)

In all fairness, the coding is there and functional in webCoRE, but the device and/or the device handler either reports it, or most often the case, does not.

So, for most devices, walking into the room turns on the switch and sets the variable. When the switch comes on, your other trigger turns on the light, and resets the variable.

I think there is another thread here with a piston that works around this somehow…


#53

So, I swap line 26 and 27. I move the set variable lightStatus before the turn on and it’s still not set the variable to true. As soon as the sensor detects the motion, the value of the variable turns to false.


#54

I think this is the thread you would benefit from reading.


EDIT
I just realized that I already posted this link. I would import the appropriate piston found there, and test it as is. You can always tweak it afterwards to better suit your house.

(make sure you PAUSE this piston when testing the other piston)


#55

How do I load someone else’s piston by the code?


#56

From your Dashboard, click on + New Piston, and then
temp

Just make sure you import the right version.
One is for smart switch/dumb bulb… and one is for dumb switch/smart bulb


#57

I am using a piston that does just what you are trying to do.


#58

Xraywinedrinker, thanks for the help! I’ll give that a try tonight.


#59

@ xraywinedrinker, what is the Key Pad2?


#60

That’s interesting, I hadn’t noticed that the generic device type is a keypad. This is my xiaomi button that I use to turn off or on the bedroom light which is connected to a wemo mini smart plug. When I turn on the light with the button (keypad 2) it sets the variable {viamotion} to false. In the earlier statement, the light will only turn on with the motion sensor if the variable {viamotion} is true.


#61

@xraywinedrinker what happens with your piston if you turn on the light via the switch while it is turned on via motion?
I am trying to figure out how to override the motion detection by operating the light switch while the light is already on.


#62

If the light is triggered to turn on by motion and you want to keep it on, you have to push the button twice, once to turn off and then to turn back on to stay on.
If the light is off and the motion sensor is inactive by a change in mode or timeframe, then pushing the button will turn on the light and stay on.


#63

I’m doing that very same thing, but with scheduled lights:

I created a simulated button and called it “Auto Lights HOLD”. If I turn this button ON, then all Time Scheduled lights will not execute.

I added the button to the ‘IF’ statements as “Auto Lights HOLD is OFF”

This works great when I want to interrupt the scheduling of the lights.

You may be able to use something like this.

Example:

image