ByronSX PIR

Others (MiLight, Hue, Toon etc...)

Moderator: leecollings

fisics
Posts: 10
Joined: Friday 12 July 2013 15:51
Target OS: -
Domoticz version:
Contact:

ByronSX PIR

Post by fisics »

Hi guys,

It seems over the past few days quite a few of us in the UK have gone out and bought lots of Siemens ByronSX PIR Chimes as they are very cheap!

http://www.diy.com/nav/fix/electrical/d ... d=11858210

They work great with Domoticz (RFXCOM Firmware 71) and you can have up to 16 thanks to the dip switches.

My understanding is that they don't send an OFF command.

Is it possible to automatically tell Domoticz to set as off after 10 seconds?

I notice there's an "On Action" script, could I use this somehow?

Thanks
User avatar
mbliek
Posts: 194
Joined: Friday 12 July 2013 14:08
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: the Netherlands
Contact:

Re: ByronSX PIR

Post by mbliek »

With my marmitek ms13 I can set off after xx sec in domoticz. So is probably possible for this PIR also
spiderrob
Posts: 13
Joined: Saturday 13 July 2013 8:28
Target OS: -
Domoticz version:
Contact:

Re: ByronSX PIR

Post by spiderrob »

I think the problem is that Domoticz sees it as a 'Chime' type regardless of the switch type you actually define. I guess a chime isn't really on or off...

So, Is there anyway us guys in the UK with these Siemens PIRs can define them in Domoticz with the ability to have an 'On' or 'Off' State. They are recognised as ByronSX, Type 'Chime' but as such are always 'On' if you try and change the 'Switch type' to something else.
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: ByronSX PIR

Post by simonrg »

I don't think there is a problem with Domoticz, as I believe the Siemens PIRs only send a "detected signal", they don't send a "not detected signal". So Domoticz just detects a series of "detected signals" which it reports as On. Some PIRs do send a "not detected signal" after a set length of time which is set on the PIR itself, you can use blocky to simulate a more complex PIR - as niki_lauda demonstrates in the "Timed motion sensor" thread.

I have found it best to set the PIRs as on/off switches and then use a piece of blocky to control the actions - the PIR sends an "detected signal" (On) which triggers blocky to turn the PIR Off and then turn something on for a length of time, the example below turns my study light on for 1 minute, so the light will go off 1 minute after the last motion is detected by the PIR.
Blocky code example for a PIR.
Blocky code example for a PIR.
PIRblocky.jpg (11.93 KiB) Viewed 9735 times
PIRs for only £5 are a real steal and so far work really well.
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
spiderrob
Posts: 13
Joined: Saturday 13 July 2013 8:28
Target OS: -
Domoticz version:
Contact:

Re: ByronSX PIR

Post by spiderrob »

Simon - Are you using the Siemens PIRs? Even if I set them as on/off switches, they do not turn off - Ie you can't even turn them off by clicking the device.
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: ByronSX PIR

Post by simonrg »

Rob - I am using the Siemens PIRs - I can't switch them off either, however what counts is not getting a "detected signal" - I have now left the PIR1 = Off line out of the blocky script and still works. It appears that Domoticz is smart enough to know that this is PIR and can only send a "detected signal", so doesn't respond. However, I can confirm that the blocky script does what it says on the can, i.e. if I either activate the PIR or click on the on/off icon then my study light comes on and goes out 1 minute after the green light on the PIR goes out. I have now set the PIR as a motion sensor in Domoticz, this seems to make most sense.
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: ByronSX PIR

Post by Derik »

Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: ByronSX PIR

Post by simonrg »

The Siemens PIR sensors seems to well behaved, using the ByronSX protocol rather than AC. They appear to only send a short signal, as I get multiple events in a few seconds and still get other signals detected:
  • Fri Jan 10 15:57:10 2014 (RFXCOM) Temperature (Understairs)
    Fri Jan 10 15:57:10 2014 (RFXCOM) Humidity (Understairs)
    Fri Jan 10 15:57:11 2014 (RFXCOM) Current Meter (Owl)
    Fri Jan 10 15:57:11 2014 (RFXCOM) Temperature (Attic)
    Fri Jan 10 15:57:12 2014 (RFXCOM) Humidity (Attic)
    Script event triggered: /home/pi/domoticz/scripts/lua/script_device_alwayson.lua
    Fri Jan 10 15:57:30 2014 (System) Temperature (RaspberryPi)
    Fri Jan 10 15:57:31 2014 (RFXCOM) Lighting 5 (Router)
    Fri Jan 10 15:57:32 2014 (RFXCOM) Receiver/Transmitter Message
    subtype = Transmitter Response
    Sequence nbr = 174
    response = ACK, data correct transmitted
    UI Event triggered: PIRTest_1
    Fri Jan 10 15:57:33 2014 (RFXCOM) Chime (Bath PIR)
    Fri Jan 10 15:57:34 2014 (RFXCOM) Lighting 5 (Bathroom)
    Fri Jan 10 15:57:35 2014 (RFXCOM) Receiver/Transmitter Message
    subtype = Transmitter Response
    Sequence nbr = 175
    response = ACK, data correct transmitted
    Fri Jan 10 15:57:37 2014 (RFXCOM) Chime (Bath PIR)
    Fri Jan 10 15:57:41 2014 (RFXCOM) Current Meter (Owl)
    Fri Jan 10 15:57:41 2014 (RFXCOM) Chime (Bath PIR)
    Fri Jan 10 15:57:45 2014 (RFXCOM) Chime (Bath PIR)
    Script event triggered: /home/pi/domoticz/scripts/lua/script_device_alwayson.lua
    Fri Jan 10 15:58:00 2014 (System) Temperature (RaspberryPi)
    Fri Jan 10 15:58:01 2014 (RFXCOM) Receiver/Transmitter Message
    subtype = Transmitter Response
    Sequence nbr = 176
    response = ACK, data correct transmitted
    Fri Jan 10 15:58:08 2014 (RFXCOM) Humidity (Understairs)
    Fri Jan 10 15:58:09 2014 (RFXCOM) Temperature (Attic)
    Fri Jan 10 15:58:09 2014 (RFXCOM) Humidity (Attic)
    Fri Jan 10 15:58:11 2014 (RFXCOM) Current Meter (Owl)
    Fri Jan 10 15:58:14 2014 (RFXCOM) Temperature (Verandah)
So don't seem to block RF reception for 10s of seconds as the AC protocol based detectors do.
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: ByronSX PIR

Post by simonrg »

I have a couple of practical challenges with using these PIRs with Domoticz, am I missing, is there a better way to set these up.

Basically, because Domoticz knows it has already turned on a light on for x minutes, if the PIR is activated within the x minutes, then Domoticz ignores the Set On For command as the light is already on. Fine in principle.

However, if the PIR is activated at x minutes minus 1 second, then the light will still go out at x minutes, and will not come back on again until the PIR is reactivated. What I had hoped would happen is that light would stay on for x minutes after last activation, not first within x minutes.

Other challenge is using LightwaveRF switches, means that if the light is switched off manually, then you want the PIR to turn the light on within the x minutes, it won't as Domoticz thinks the light is still on and so won't send a further on signal until the x minutes is finished.

Is there a way I can achieve the behaviour I want, light stays on for x minutes after last PIR activation and Domoticz sends the On Signal whenever the PIR is activated so that it turns the light again within the x minutes if switched off manually?
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
User avatar
Keptenkurk
Posts: 103
Joined: Wednesday 21 August 2013 17:24
Target OS: -
Domoticz version:
Location: Waalre, The Netherlands
Contact:

Re: ByronSX PIR

Post by Keptenkurk »

Simon,
I think that a Lua script is the way to go at this moment.
This example appears to do at least some of what you're trying to do.

[offtopic] I ran into this same requirement: the need for "On for x minutes" with retrigger.
I found out that the pump of my floor heating runs 7x24 at 60W even if there is no heating at all.
Now i want the pump to run only 60 minutes after the thermostat has last switched on (and 15 minutes every day). Will put it into Lua like the example mentioned.
And the calculated savings of € 50/yr go straight into the Domoticz Business Case :-)
/paul
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: ByronSX PIR

Post by simonrg »

Thanks for pointers, a little bit different as the Siemens pir only ever return detected, they don't return not detected.

Compared to Blocky, LUA will turn devices on again, when they have been manually turned off and the light finally goes off a time after last activation, not a time after first activation.

So, using LUA I have managed to achieve what I wanted to, I have written two general scripts which interact with the Siemens wirefree pirs named as "PIR room name" and control light switches called "room name".

The first script waits for any devices called "PIR room name" to change when seen then "room name" will switch on:

Code: Select all

commandArray = {}

tc=next(devicechanged)
v=tostring(tc)
if (v:sub(1,3) == 'PIR') then
   c=tostring(v):sub(5)
   commandArray[c] = 'On'
   tmess = c..' Light On - time 0'
   print(tmess)
end

return commandArray
Fairly simiple, checks to see if the device changed starts with PIR, if so then strips off "PIR " and turns on "room name" and prints a little message to say that that light has switched on.

The second script is a timer script which checks through each device to find all the Siemens pirs to see how long ago each pir was last turned on and switches the light off if more than 4 minutes ago:

Code: Select all

function timedifference(s)
   year = string.sub(s, 1, 4)
   month = string.sub(s, 6, 7)
   day = string.sub(s, 9, 10)
   hour = string.sub(s, 12, 13)
   minutes = string.sub(s, 15, 16)
   seconds = string.sub(s, 18, 19)
   t1 = os.time()
   t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=se$
   difference = os.difftime (t1, t2)
   return difference
end

commandArray = {}

for i, v in pairs(otherdevices) do
   tc = tostring(i)
   v = i:sub(1,3)
   if (v == 'PIR') then
      difference = timedifference(otherdevices_lastupdate[tc])
      if (difference > 239 and difference < 320) then
         tempdiff = tostring(difference)
         c = i:sub(5)
         tempmessage = c.." Light Off - at least 240 secs up - actually - " .. $
         print(tempmessage)
         commandArray[c] = 'Off'
      end
   end
end

return commandArray
A little bit more complex script, firstly time difference function taken from previous posts (thanks). Then test each other device and see if it is a PIR, if it is then see if it changed between 4 and 5 minutes ago, if so then switch off "room name" and put a message in the log.

Current final bit is to have pirs PIR Bathroom, PIR Shower and light switches Bathroom, Shower which work fine, then when I get more I just add Siemens pir PIR Utility and light switch Utility which will just magically work.

I am not sure this is the best way to do it, but it works, any suggestions for a simpler, less resource intensive or just smarter way would be most welcome.
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
commodore white
Posts: 63
Joined: Sunday 14 July 2013 11:19
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Ipswich, UK
Contact:

Re: ByronSX PIR

Post by commodore white »

I managed to nab 8 of these beauties. Perfect for the new house. Though they report chime, I've configured them as motion sensors. I also configured them to turnoff after 30 but this doesn't work. Is this as expected?
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: ByronSX PIR

Post by simonrg »

How did you configure them to turn off after 30 minutes, did you set the "Off Delay" in Domoticz? I think this means that after a "not detected" signal is recieved then wait x seconds before switching off. The problem is the Siemens wirefree pirs don't send a "not detected" signal, hence the need to write the scripts I posted in the previous post.
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
kylegordon
Posts: 26
Joined: Thursday 31 October 2013 23:58
Target OS: Linux
Domoticz version: Trunk
Contact:

Re: ByronSX PIR

Post by kylegordon »

I'm not sure what the "Off Delay" is supposed to do. Maybe it's the length of time Domoticz waits before considering the Motion Sensor as "Off" - but that's not the case as I've tried setting it to 30 seconds, and although the light has gone off on the PIR, Domoticz still says it's "On" 12 hours later :-) It might be an internal timer that's used to send the Off command to devices that are actioned by it.

I use the following Blockly snippets to turn a real PIR (PIR1_Device) into a "virtual" PIR (PIR1) that's on for 1 minute. The PIR1_Device has "Off Delay" set to 0, and PIR1 Device is on a Dummy transceiver.
Blockly PIR Auto Off.png
Blockly PIR Auto Off.png (12.39 KiB) Viewed 9525 times
And the following Blockly is a light that relies on the PIR
Blockly PIR Action.png
Blockly PIR Action.png (13.26 KiB) Viewed 9525 times
It all seems to work :-)
1 x HP DL380 & KVM
1 x RPI
1 x RFXtrx433 V78
11 x LWRF Switches
1 x LIFX
2 x Echo Dots
6 x Byron PIRs
2 x Nexa PIRs
2 x Kodi
2 x ESP8266 MQTT
1 x GPIO/MQTT PIR
1 x GPIO(PWM)/MQTT LEDs
1 x GPIO(SPI)/MQTT LPD6803 LEDs
Lots of Node-Red glue
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: ByronSX PIR

Post by simonrg »

Great nice approach to overcome the limitation of the Siemen's pirs and how Blockly works.

I think you are correct the "Off Delay" is the time Domoticz would wait after it recieved an "off signal", to give you time to leave the room before being plunged into darkness. The problem is that the Siemen's pirs don't send an off signal, they only send an on signal, then don't send anything until they next send an on signal, so the log in Domoticz shows each on signal recieved, but never shows an off signal.

I like the way you have used a virtual PIR to simulate what a more intelligent PIR would do, i.e. send an off signal if not activated for a set length of time.

The problem I was having combining the Siemen's PIRs with LightwaveRF lights using Blockly was that the LightwaveRF lights can be turned off mechanically by the switch, so Domoticz still thinks the light is on and Blockly won't send another on signal until the 1 minute is up even though the light is now physically off.

The other issue was for a shower room setting the time to 5 minutes, with Blockly the 5 minutes was from when you first entered the room, not from when movement was last detected, so the light always goes out before Blockly turns it back on. With LUA I have managed to set it up so the light stays on for 5 minutes after last movement detected.
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
User avatar
CopyCatz
Developer
Posts: 123
Joined: Thursday 11 July 2013 17:28
Target OS: -
Domoticz version:
Location: Outer Heaven
Contact:

Re: ByronSX PIR

Post by CopyCatz »

Image

I use the off delay on my kaku sensors, they go to "off" just fine. I guess what it doesn't do is switch an associated lamp, it's more of a status reset. If you set the off delay to 0, the sensor status will stay on and domoticz will probably not regard the next trigger as such (from on to on is not a change).
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: ByronSX PIR

Post by simonrg »

Either the Kaku PIRs work differently to the Siemens PIRs or there is something broken in the ByronSX protocol. I know that the standard LightwaveRF pir has a timer on it that sends an off signal after the set time and hence can switch off a light directly. My hypothesis was that the Siemens PIRs were unique in only sending On signals as they are designed to be paired with a doorbell and hence only signal on to the doorbell to make it ring. I had assumed that all other pirs sent an off signal and hence the delay time was to give a delay before status change to off having recieved the off signal.

Forgetting about switching any light and just focussing on the functionality of the PIRs, as you can see in the screen capture below, I seem to have the same settings as you for the pir, but as the graph at the bottom shows the pir status never goes to Off.
140115PIRLogs.jpg
140115PIRLogs.jpg (46.79 KiB) Viewed 9501 times
For the Kaku sensors does the log show Off signals recieved or is it just the graph that shows a status change to off?

Luckily as Domoticz / LUA spots each activation of the PIR as a device change, I am able to use the PIR, so please don't change that behaviour.
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
fisics
Posts: 10
Joined: Friday 12 July 2013 15:51
Target OS: -
Domoticz version:
Contact:

Re: ByronSX PIR

Post by fisics »

Hi guys,

I thought my solution to turning these off could have been to make a simple "On Action" script that after 10 seconds sends a JSON URL to Domoticz with the off command.


#!/bin/bash

sleep 10

http://10.0.1.20:8080/json.htm?type=com ... tchcmd=Off


However, it seems that as they are setup as "Chimes" there is no ON/OFF just ON state.

How can we allow Domoticz to allow these "BryonSX Chimes" as ON or OFF?

Thanks
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: ByronSX PIR

Post by simonrg »

I don't think it is appropriate for Domoticz to make a special case for these, the ByronSX PIRs only send an "on" signal, so really act as doorbells rather than classic pirs which send both "off" and "on" signals.

So use of Blockly, LUA or a Bash script connecting the ByronSX PIRs to lights / other devices seem the correct way to go.
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
windriverski
Posts: 1
Joined: Sunday 19 January 2014 21:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: ByronSX PIR

Post by windriverski »

simonrg wrote:

Code: Select all

   t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=se$



         tempmessage = c.." Light Off - at least 240 secs up - actually - " .. $
@simonrg -- Great bit of code, the first script works well, but I think the 2nd script has issues with wordwrap on here ($) at end of line
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest