reset pir  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
pvklink
Posts: 822
Joined: Wednesday 12 November 2014 15:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest b
Contact:

reset pir

Post 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...
Raspberry (raspbian on rpi 3) , Domoticz Beta, dzVents , RFXtrx433e, P1, Hue, Yeelight, Zwave+, X10, ESP(easy), MQTT,Weather Underground, System Alive Checker, Domoticz Remote Server to RPI with Google Assistant,
Jablotron connection, Ikea
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: reset pir

Post 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
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
pvklink
Posts: 822
Joined: Wednesday 12 November 2014 15:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest b
Contact:

Re: reset pir

Post 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 
Raspberry (raspbian on rpi 3) , Domoticz Beta, dzVents , RFXtrx433e, P1, Hue, Yeelight, Zwave+, X10, ESP(easy), MQTT,Weather Underground, System Alive Checker, Domoticz Remote Server to RPI with Google Assistant,
Jablotron connection, Ikea
pvklink
Posts: 822
Joined: Wednesday 12 November 2014 15:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest b
Contact:

Re: reset pir

Post 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)
Raspberry (raspbian on rpi 3) , Domoticz Beta, dzVents , RFXtrx433e, P1, Hue, Yeelight, Zwave+, X10, ESP(easy), MQTT,Weather Underground, System Alive Checker, Domoticz Remote Server to RPI with Google Assistant,
Jablotron connection, Ikea
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: reset pir  [Solved]

Post 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.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
pvklink
Posts: 822
Joined: Wednesday 12 November 2014 15:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest b
Contact:

Re: reset pir

Post by pvklink »

ok, thanks, i will!
Raspberry (raspbian on rpi 3) , Domoticz Beta, dzVents , RFXtrx433e, P1, Hue, Yeelight, Zwave+, X10, ESP(easy), MQTT,Weather Underground, System Alive Checker, Domoticz Remote Server to RPI with Google Assistant,
Jablotron connection, Ikea
pvklink
Posts: 822
Joined: Wednesday 12 November 2014 15:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest b
Contact:

Re: reset pir

Post by pvklink »

Indeed, this did the job (better than pushing a url)!
Thanks @waaren

Solution
dz.devices('pir_aanbouw_small').setState('No Motion')
Raspberry (raspbian on rpi 3) , Domoticz Beta, dzVents , RFXtrx433e, P1, Hue, Yeelight, Zwave+, X10, ESP(easy), MQTT,Weather Underground, System Alive Checker, Domoticz Remote Server to RPI with Google Assistant,
Jablotron connection, Ikea
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest