How to connect generic PIRs to OpenHAB?

pir
generic
Tags: #<Tag:0x00007fe063547860> #<Tag:0x00007fe063547720>

(George Erhan) #9

Hi,
The problem with a standalone PIR (providing a contact) is that you only get the contact status, you can not modify brightness parameters, delay times and/or re-triggering conditions (the standalone PIR’s have this settings provided on themselves without a possibility to remotely modify them). If you do not wish to ever modify this settings remotely, then you need to use an input module (to monitor the contact of the PIR), which AFAIK does not exist in the sonoff world yet! The only workaround is to use the sonoff TH and provide a different resistance for when the PIR contact is closed or open. Of course isolation from mains power is required!
Try other ESP based devices that have inputs.


(Vincent Regaud) #10

This is incorrect.
Your can flash the sonoff and connect the PIR output to the spare pin on the board and monitor the input. Tasmota does that very well.


(Kiat Huang) #11

Thanks!

In your first suggestion, to be clear, do you mean an Arduino (+ non-Sonoff hardware bits) would achieve this in the electrical cabinet?

I was thinking about the network topology too, whether a dedicated, strong WiFi network - seperate from the normal WiFi/wired non-HA network - is a good idea.


(Vincent Regaud) #12

The other problem with the sonoff solution, if your PIRs are outside is that the sonoff are NOT rated for external work and would have to be put in a weather proof box.


(Kiat Huang) #13

Yep, I should have said, this set of PIRs will be outside. The power feed is from the loft, so each basic Sonoff could be inside the loft - or maybe outside in one of the Sonoff IP66 boxes.

The range of Sonoff devices is fabulous and reasonably priced: very exciting.


(Vincent Regaud) #14

OK, it seems that you have decided to go with the sonoff solution.
I recommend that you flash that Tasmota firmware on them.

But make sure that you have a good Wifi router in the house. Poor wifi connections reduces the sonoff lifetime and they will fail.

Read the MQTT for openhab docs and 101:

And finally this one:


(Kiat Huang) #15

Thank you very much for those set of links. It is good to be advised on a set of docs to start with (there are so many to choose from, when you don’t know!).

Yes, the Sonoff solution would allow me to switch on all the lights manually if needed, which is part of my user requirements. Thanks again.


(Danny mullen) #16

@gr1nch may I suggest you also watch some youtube videos on the topic. Look at youtube for Sonoff and openhab. Plus MQTT. For example here is a great mqtt tutorial i ran across yesterday.

An overide switch. Similiar to how I was originally talking hooking up your pir. https://www.youtube.com/watch?v=XLonB_Vhplw


(Stephen) #17

BEG Luxomat make a KNX version of the sensor that you mentioned. There are also many others.
https://www.beg-luxomat.com/en/products/luxomatnet/knx/knx-v5/rc-plus-next-230-knx/

All you would need is the KNX bus cable at the sensor position. The relay actuator would be located elsewhere.


(SiHui) #18

I guess he is after some cheap stuff … otherwise he would have bought some smart sensors/actors and not tinker around with generic ones :grinning:


(Aaron) #19

Do you have evidence too back this up? why does it do that? are other devices effected like tp-smart WiFi sockets?


(Vincent Regaud) #20

A couple of my switches failed after a while. I think it is because of power demands on the WiFi transceiver in the sonoff. I don’t know if other devices are affected.
There are other posts about this.


(Aaron) #21

The only bad thing I have heard about wifi switches is if they are switched alot of times in a short period they can set on fire

Makes sense a poor connection and the sonoff has too compensate for it boost the signal and maby overheats


(Vincent Regaud) #22

That is true of all relays to a certain extent.


(Kiat Huang) #23

Stephen, thanks, I’d not heard of KNX before. Looking into it. It fits in with my electrician’s idea of bringing the PIR and security light cables back to a central location in the loft. From what I’ve read I think I’d need a KNX gateway. I see there is a KNX binding with OH which is great. I’m guessing this gear could be a lot more expensive (as sihui is suggesting) than the Sonoff gear.


(Stephen) #24

Hi Kiat,

No problem!

See https://knx.org for lots more information. KNX is "the worldwide standard for home and building control” and there are over 400 manufacturers making KNX products, including the really big guys (Siemens, Schneider Electric, Hager, Legrand, ABB). The new KNX configuration software, ETS Inside, may be useful for a project with up to 255 KNX devices and the software licence is (I think) €150. https://www.knx.org/knx-en/Landing-Pages/ETS-Inside/index.php

I am sure that there will be a lot of people already using openHAB that can help you with integrating KNX. KNX is hugely popular in Germany and this is where many of the manufacturers are located I am quite experienced with KNX (I work for a distributor of KNX products in New Zealand and am a KNX Tutor) but currently looking at openHAB as a low cost way to run the logic/visualisation for a house I may build in the next few years.

openHAB looks quite scary to me at this stage as I am not familiar with programming lines of code but I’m sure I will overcome the fear!

Yes, as a minimum you will need a KNX power supply to power the KNX twisted pair bus, some KNX devices (typically termed “sensors” (inputs) and “actuators” (outputs), and some kind of gateway between KNX and openHAB - could be IP, USB or RS-232.

I don’t know Sonoff so I can’t make a price comparison. There is a huge range of prices within the KNX world as there are many different manufacturers of similar products.

Best regards,

Stephen


(Kiat Huang) #26

Thanks Danny, both videos interesting. The override switch, I suppose, could be a PIR. Specifically, my use case* means that the PIR must be able to turn the light on and off as normal, except when I turn them on over WiFi when I don’t want the PIR turning them off

  • PIR works as normal. Sometimes I may want the lights turned on until I want them off : e.g. security event or clean up after party (:rofl:), etc…

(Kiat Huang) #27

Stephen, great to hear you have KNX expertise. It makes for a more diverse community and, from the looks of it, KNX is here to stay. Thanks for the links - its interesting you mention Hager as my electrician is very experienced with their gear and I’ll check with him on KNX. The gear generally looks a lot more expensive than Sonoff, but I guess you are paying for quality. I’ve been reading reviews of Sonoff gear and some of them don’t rate the build quality at all. Still, I’m fully prepared to get cheaper gear so I can spend my budget on the more expensive stuff that is more “mission critical”, ie. central controllers, storage, cabling quality, etc.

Like you I am totally new to OpenHAB, not a coder, but I have done some tinkering and minor hacking on gear.

Good luck with your home automation stuff!

Kiat


(Stephen) #28

Kiat,

One of the principal benefits of the KNX system is distributed control - the KNX devices communicate amongst each other to carry out the required functions. A KNX system, properly planned and configured, can do much of the control/automation without the requirement for a central controller (AKA central point of failure).

Generally a central controller working with a KNX installation will be carrying out supervisory control and data acquisition (SCADA)-type operations and possible providing remote access. If you run everything through a central controller and it breaks or goes offline the whole system is useless! Generally, the KNX bus devices chatter away among themselves to control lights, blinds, heating etc and if one device fails the rest of the system keeps working.

Hager KNX gear is generally very good but at the more expensive end of the scale.

Cheers,

Stephen


(George Erhan) #29

It is, but the reliability is incomparable to Sonoff.
IMHO, if you opt for KNX, although it is expensive, you are trouble free forever (my first knx setup was finalized in 2004, never heard any problems since)! I have commissioned thousands of knx devices, I’ve worked with many protocols apart from knx and I can state based on my experience that in terms of QoS/price ratio, knx is the most reliable solution for civil buildings on the market right now!