1) Give a description of the problem
In our nursery, I have a single light, a two-button aqara switch, and a a motion detector. The idea is that our baby takes naps at various times of the day and night. I’m trying to set up a situation where our lights can be controlled by the switch, as well as set the lighting automation to either an “awake” or “asleep” mode. Asleep mode would be dim automation, Awake mode would level based on changing lux readings from the motion detector. This is so we can keep our lights automated, but be able to manually control both current and automated lighting levels, regardless of time of day.
I have one piston that handles the on/off and mode setting functions (flips a “mode” switch), and another that handles the motion automation based on mode (reads the “mode” switch). Probably an unnecessarily complicated setup. Open to suggestions
2) What is the expected behavior?
So… I want to be able to use the left button to:
- with a single click (“button 1” in WC) turn lights ON to 100% either from OFF, or from ON and any level under 100%. If the light is already on at 100%, the single click will turn it off.
- with a double click (“button 4” in WC) turn lights ON to 100% and flip the “nursery mode” switch to ON (“awake” mode)
With the right button:
- single click (button 2 in WC) turn lights on to 1% either from OFF, or from ON and any level above 1%. If the light is already at 1%, the single click will turn it off.
- with a double click (“button 5” in WC) turn lights on to 1% and flip the “nursery mode” switch to OFF (“asleep” mode)
If in “awake” mode, motion will turn on lights and set level based on changing lux settings and time out after 8 minutes. If in “asleep” mode, motion will turn on lights to 1% and time out at 6 minutes.
3) What is happening/not happening?
Bolded items are malfunctioning:
So… I want to be able to use the left button to:
- with a single click (“button 1” in WC) turn lights ON to 100% either from OFF, or ON and any level under 100%. If the light is already on at 100%, the single click will turn it off.
- with a double click (“button 4” in WC) turn lights ON to 100% and flip the “nursery mode” switch to ON (“awake” mode)
With the right button:
- single click (button 2 in WC) turn lights on to 1% either from OFF, or from ON and any level above 1%. If the light is already at 1%, the single click will turn it off.
- with a double click (“button 5” in WC) turn lights on to 1% and flip the “nursery mode” switch to OFF (“asleep” mode)
If in “awake” mode, motion will turn on lights and set level based on lux settings and time out after 8 minutes. If in “asleep” mode, motion will turn on lights to 1% and time out at 6 minutes.
Basically, when lights are supposed to come ON at 1% with the light OFF- either manually with a single click or from the motion sensor- they instead come on at 100%. If the light is already on, it behaves in response to the switch as expected
4) Post a Green Snapshot of the piston
Switch and mode setting piston:
Motion-activation piston:
**5) Attach any logs (From
(PASTE YOUR LOGS HERE BETWEEN THE MARKS THEN HIGHLIGHT ALL OF THE LOGS SND CLICK ON THE </> ICON TO FORMAT THEM)
Can provide logs on request. I’m guessing the issue is my poor coding and code structure…