Motion sensors override switch for light control

Hi community!

It’s my first post here. I looked for solutions for my problem but couldn’t find anything, so I start this new thread now. In case I missed something, please be patient. Okay, here’s my problem:

I want to use a switch and 2 motion sensor to control the lights in a room. The switch is used as long as we are awake to turn on the lights at full brightness. The lights should not turn off automatically when switched on by the switch. The motion sensors shall operate when we go to bed. Then, i.e. if motion is detected, lights are turned on with minimum brightness (night light).
My problem is (and it’s driving me crazy) that the motion sensors dimm and eventually turn off the lights that were turned on by the switch. I followed this description on phoscon.de but without success. Whenever motion is detected and lights are at full brightness, the lights are getting dimmed and then turned off. What is the root cause and how do I fix it?

My system:
deCONZ 2.21.01 running on a Raspberry Pi with Conbee II stick
Motion sensors and lights from Ikea

Thanks
Nils

I believe you won’t be able to do this with Phoscon.

You need to save the trigger somewhere , and then have the motion sensors evaluate the status. Node red or home assistant should be able to do this.

Thanks for the fast reply - much appreciated! I’m a little surprised though because I thought that was exactly what the Phoscon guys were having in mind when they wrote “To prevent the lights from being switched off if no motion is detected despite presence, the best solution is to combine motion sensors with a switch.”. I mean they show this figure of the guy in the shower getting angry because the lights are turned of. Isn’t that what I plan to implement?

Oh in that case, @de_employees should be able to answer :slight_smile:

Yes it should indeed work as Nils explained. I will make a test to see if I can reproduce the error.
@Nils you could also help by providing some API data from the Phoscon App. In the Phoscon App go to “Help” → “API Informations” and then choose “Rules”, select “all” and copy paste the API informations (use pastebin or so). The “Sensors” and “Switches” Informations may be also usefull.

I have just the same behaviour in my test. I tried different settings in the Phoscon App sensor control but all show the same wrong result. The group goes off after switching it on with a switch and after triggering a motion sensor even both are added to the sensor control page.

I have spotted a rule in the Rest API that causes this misbehaviour. I will look deeper into it and see if it needs to be fixed in deconz or the Phoscon App.

I think this is going to be fixed in the next or after the next beta release.
For a quick “do it yourself” solution you can add a rule and change a rule with the help of an RestAPI client (if you are firm with RestAPI: Rules - deCONZ REST-API)

Here’s a HowTo:

First you have to search for a rule with the name “pir-fsm-reset-after-off-master”
Note the id Then update the Rule conditon

PUT <ip>:<port>/api/<apikey>/rules/<id>

with Body:

{
"conditions": [
        {
            "address": "/groups/<gid>/state/any_on",
            "operator": "eq",
            "value": "true"
        },
        {
            "address": "/sensors/<sid>/state/status",
            "operator": "eq",
            "value": "-3"
        }
    ]
}

<gid> and<sid> are the same ids that already exist in the rule.

And then you have to add a new rule:

POST <ip>:<port>/api/<apikey>/rules

with Body:

{
        "actions": [
            {
                "address": "/sensors/<vsid>/state",
                "body": {
                    "presence": false
                },
                "method": "PUT"
            },
            {
                "address": "/sensors/<sid>/state",
                "body": {
                    "status": -2
                },
                "method": "PUT"
            }
        ],
        "conditions": [
            {
                "address": "/groups/<gid>/state/any_on",
                "operator": "eq",
                "value": "false"
            },
            {
                "address": "/sensors/<sid>/state/status",
                "operator": "eq",
                "value": "-3"
            }
        ],
        "name": "pir-fsm-block-motion-events",
        "periodic": 0,
        "status": "enabled"
}

with the same <gid> and <sid>
and <vsid> is the same id as in the “actions” section of the first rule that got updated (pir-fsm-reset-after-off-master).

see:

"name": "pir-fsm-reset-after-off-master",
"actions": [
        {
            "address": "/sensors/<vsid>/state",
            "body": {
                "presence": false
            },
            "method": "PUT"
        }
...

Thanks for the info and the quick-fix.

Hi All, has this been fixed in the beta or released version yet?

Yes this has already been fixed