Page 1 of 1
Override motion sensor
Posted: Wednesday 14 October 2020 16:21
by Cndiann
Hello,
I have a blockly script (see image)

- script.JPG (45.49 KiB) Viewed 1189 times
for my stairway (1 motion sensor and 1 fibaro switch).
When the event is active I would like to override the event by pressing the physical button so the light stays on even when there is no motion detected. And when I turn off the lamp by pressing the physical button it will activate the script again.
Is this possibile?
Regards
Re: Override motion sensor
Posted: Wednesday 14 October 2020 17:57
by waaren
Cndiann wrote: ↑Wednesday 14 October 2020 16:21
When the event is active I would like to override the event by pressing the physical button so the light stays on even when there is no motion detected. And when I turn off the lamp by pressing the physical button it will activate the script again.
Is this possibile?
If the physical button is known in domoticz it should be possible by adding an and in your Blockly
Re: Override motion sensor
Posted: Wednesday 14 October 2020 23:21
by Cndiann
Where do I need to put this 'and' function? Is it not necessary to do it in dzvents or lua?
Re: Override motion sensor
Posted: Thursday 15 October 2020 9:38
by waaren
Cndiann wrote: ↑Wednesday 14 October 2020 23:21
Where do I need to put this 'and' function?
In blockly: Change
[Else if] [PIR trap motion] =[Off]
to
[Else if] [PIR trap motion] =[Off] and [physical button] = [Off]
Re: Override motion sensor
Posted: Saturday 17 October 2020 0:39
by Cndiann
Thanks but I didn't get it to work. The physical switch is called Lamp Trap.
When the lights go on and I press the switch, the lights go out.
It's a momentary switch.
Re: Override motion sensor
Posted: Saturday 17 October 2020 8:39
by waaren
Cndiann wrote: ↑Saturday 17 October 2020 0:39
Thanks but I didn't get it to work. The physical switch is called Lamp Trap.
When the lights go on and I press the switch, the lights go out.
It's a momentary switch.
Not sure I understand. Can you please describe it with some details so I can try to replicate it?
- what device type sybtypes are Lamp trap and Lamp Trap in domoticz as seen on the devices tab?
- do these devices have an action defined in the On action or Off action (in the edit window of the device from the switch tab)?
- are there any other Blockly's or script involved then the one you posted?
Re: Override motion sensor
Posted: Saturday 17 October 2020 13:00
by Cndiann
Sorry, I have a Fibaro dimmer 2. The light switch of this dimmer I called Lamp trap. So in my blockly Lamp trap is a name for the dimmer/switch.
When I do your script the light stays on.
Re: Override motion sensor
Posted: Saturday 17 October 2020 23:59
by Cndiann
So I have a motion sensor and a Fibaro dimmer. The fibaro dimmer is connect to a physical momentary switch. I have called the Fibaro light switch in domoticz to Lamp trap.
So when I push the momentary switch Lamp trap will be turned on.
When the script is active and motion is on the Lamp trap will turn on.
Now I want to override the script so that the light will stay on when I press the momentary switch(Lamp trap).
I have activated scene, so I have set a scene with double click and triple click. But I think did doesn't involved the blockly event.
Re: Override motion sensor
Posted: Sunday 18 October 2020 7:08
by waaren
Cndiann wrote: ↑Saturday 17 October 2020 23:59
So I have a motion sensor and a Fibaro dimmer. The fibaro dimmer is connect to a physical momentary switch. I have called the Fibaro light switch in domoticz to Lamp trap.
Can you please share these devices as shown on the devices tab [setup][devices]
like this example

- devices.png (112.66 KiB) Viewed 1058 times
and (if any) the On / Off actions of the switches [switches][edit button on the switch]
like this example

- On,Off.png (55.75 KiB) Viewed 1058 times
I have activated scene, so I have set a scene with double click and triple click. But I think did doesn't involved the blockly event.
Don't know what this means. Maybe it becomes clear if you share a screenshot
Re: Override motion sensor
Posted: Sunday 18 October 2020 9:49
by Cndiann
See below.
ID 22 till 26 are extra because I have activated scene option.
I use Lamp trap (id1, idx 293) for the blockly script.

- lamp trap.JPG (72.69 KiB) Viewed 1052 times

- device trap.JPG (140.67 KiB) Viewed 1052 times

- scenes.JPG (33.08 KiB) Viewed 1052 times
Re: Override motion sensor
Posted: Sunday 25 October 2020 19:38
by Cndiann
It's still not working right now.
I see in the log 2 events triggered. The blockly script is called Trap verlichting.
Code: Select all
2020-10-25 19:32:00.290 EventSystem: Event triggered: Trap verlichting_1
2020-10-25 19:32:00.321 OpenZWave: Domoticz has send a Switch command!, Level: 1, NodeID: 25 (0x19)
2020-10-25 19:32:00.324 (OpenZWave) Light/Switch (Lamp trap)
2020-10-25 19:32:04.510 (Buienradar) General/Custom Sensor (Next Rainshower Leadtime)
2020-10-25 19:32:04.514 (Buienradar) General/Custom Sensor (Next Rainshower Duration)
2020-10-25 19:32:04.518 (Buienradar) General/Custom Sensor (Next Rainshower Avg Rainrate)
2020-10-25 19:32:04.522 (Buienradar) General/Custom Sensor (Next Rainshower Max Rainrate)
2020-10-25 19:32:04.525 (Buienradar) General/Percentage (Rain Intensity)
2020-10-25 19:32:04.529 (Buienradar) General/Custom Sensor (Rainfall next Hour)
2020-10-25 19:32:05.531 (OpenZWave) Usage (Lamp trap vermogen)
2020-10-25 19:32:05.534 (OpenZWave) General/kWh (Lamp trap kWh Meter)
2020-10-25 19:32:40.137 EventSystem: Event triggered: Trap verlichting_2
2020-10-25 19:32:40.170 OpenZWave: Domoticz has send a Switch command!, Level: 0, NodeID: 25 (0x19)
2020-10-25 19:32:40.172 (OpenZWave) Usage (Lamp trap Unknown)
2020-10-25 19:32:40.175 (OpenZWave) General/kWh (Lamp trap kWh Meter)
2020-10-25 19:32:40.181 (OpenZWave) Light/Switch (Lamp trap)
2020-10-25 19:32:40.553 (OpenZWave) Usage (Lamp trap vermogen)
2020-10-25 19:32:40.555 (OpenZWave) General/kWh (Lamp trap kWh Meter)
2020-10-25 19:32:50.560 (OpenZWave) Usage (Lamp trap vermogen)
2020-10-25 19:32:50.564 (OpenZWave) General/kWh (Lamp trap kWh Meter)
When the script is not active during daylight I also get the event Trap verlichting_2 log. And if I press the lightswitch the lamp will turn on only for several seconds (seems when the motion decection is OFF) the light automaticaly will be turned off even when the script is not running.
If I dissable the script and press the lightswitch the lamp stays on until I press the lightswitch again.
Re: Override motion sensor
Posted: Wednesday 28 October 2020 17:45
by Cndiann
Hello,
I have a motion sensor in the hallway and a FGD212 Dimmer 2. I connected 2 physical momentary switches on it. So If I press once the light 'Lamp trap' goes on.
In blocky I had this event:

- blockly.JPG (32.42 KiB) Viewed 968 times
It does the job but when I switch the light with the physical switch it trigger the blockly event so the 'Lamp trap' goes out when the motion detector is off even If I do this at 10:00.
And I didn't get manual override to work, so I can switch the physical switch for example on 10:00 and 'Lamp trap' stay on even if there is no motion detected.
I tried in dzVents but only got so far;
Code: Select all
return
{
on =
{
devices =
{
['PIR trap motion'] = { 'between 15:00 and 10:00' }, --only turns on after 15:00 and before 11:00
},
},
logging =
{
level = domoticz.LOG_DEBUG,
marker = 'Trap',
},
execute = function(dz, item)
local light = dz.devices('Lamp trap')
local offDelay = 120
if item.active then -- state == 'On'
light.cancelQueuedCommands()
light.switchOn()
light.switchOff().afterSec(offDelay)
end
end
}
What I want to archieve;
-Set timer to activate between 15:00 and 11:00
- Set level % of 'Lamp trap'
- Set duration time or when motion is off turn 'Lamp trap' off
- Override the script when I press the physical button
Hope I can get some help! Thanks