Page 1 of 1

reset pir

Posted: Thursday 05 March 2020 14:08
by pvklink
I added a few pirs to my network that can be read by rfxcom.

They work wonderfull within my alarm system, all made with domoticz and iot devices.

After an alarm i can reset all my devices and smoke detectors but not de pirs.

I defined them as motion detectorsand i cant find a command to reset them (tried reset(), switchodd, close etc.)

@waaren, few months ago, you added a reset for my smoke detectors, and they work great!
Can you do that for PIRs also?

When i push the pir manually it dos go off and gives

0-03-05 13:58:18.201 Status: User: Admin initiated a switch command (2227/pir_aanbouw_small/No Motion)
2020-03-05 13:58:18.461 Status: dzVents: Debug: - Device: pir_aanbouw_small
2020-03-05 13:58:18.516 Status: dzVents: Info: Handling events for: "pir_aanbouw_small", value: "No Motion"

when i do a
http://192.168.20.35:82/json.htm?type=c ... &passcode=

it also works...

Re: reset pir

Posted: Thursday 05 March 2020 14:40
by waaren
pvklink wrote: Thursday 05 March 2020 14:08 I defined them as motion detectors and i cant find a command to reset them (tried reset(), switchodd, close etc.)
can you run this script before switching the PIRs off and after ?
That might help in identifying what command is required to switchOff the device using a native dzVents command.

Code: Select all

return 
{
	on = 
	{
		devices = 
		{
			'motionTrigger', -- Rename to a test / development trigger
		},
	},
	
	logging = 
	{
	    level = domoticz.LOG_INFO,
	    marker = motion,
	},
	
	execute = function(dz)
        local motionDevices = dz.devices().filter(function(dv)
              return dv.switchType == 'Motion Sensor'
        end)
        motionDevices.forEach(function(dv)
            dz.log(dv.name .. ', state: ' .. dv.state .. ', sValue: '  .. dv.sValue .. ', nValue: ' .. dv.nValue)
        end)	
    end
}

Re: reset pir

Posted: Thursday 05 March 2020 15:51
by pvklink
Is this what you are looking for?

Code: Select all

 2020-03-05 15:53:59.681 (rfxcom) Security (xxx_aanbouw_small)
2020-03-05 15:53:59.674 Status: User: Admin initiated a switch command (2227/xxx_aanbouw_small/No Motion)
2020-03-05 15:54:00.021 Status: dzVents: Debug: - Device: xxx_aanbouw_small
2020-03-05 15:54:00.106 Status: dzVents: Info: Handling events for: "xxx_aanbouw_small", value: "No Motion"
2020-03-05 15:54:00.107 Status: dzVents: Info: ------ Start internal script: testscript: Device: "xxx_aanbouw_small (rfxcom)", Index: 2227
2020-03-05 15:54:00.390 Status: dzVents: Info: xxx_aanbouw_small, state: No Motion, sValue: No Motion, nValue: 5 

Re: reset pir

Posted: Thursday 05 March 2020 15:56
by pvklink
i updated the previous message, i was playing around with different sort of devices (smoke etc,) to see if i can solve this..
For your script i changed back to motion type, and the outcome is above (in the previous post)

Re: reset pir  [Solved]

Posted: Thursday 05 March 2020 16:15
by waaren
pvklink wrote: Thursday 05 March 2020 15:56 i updated the previous message, i was playing around with different sort of devices (smoke etc,) to see if i can solve this..
For your script i changed back to motion type, and the outcome is above (in the previous post)
I have no PIR with these options so kind of hard to test, You could try with

setState() or setValues() methods (see dzVents wiki for syntax)
If that does not work, the domoticz.openURL() will.

Re: reset pir

Posted: Thursday 05 March 2020 16:44
by pvklink
ok, thanks, i will!

Re: reset pir

Posted: Thursday 05 March 2020 16:55
by pvklink
Indeed, this did the job (better than pushing a url)!
Thanks @waaren

Solution
dz.devices('pir_aanbouw_small').setState('No Motion')