How to connect generic PIRs to OpenHAB?

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

That is true of all relays to a certain extent.

1 Like

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.

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

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ā€¦
1 Like

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

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

3 Likes

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!

To install KNX just to connect some sensor to openHAB is total overkill and bad advice.
You might consider to install a KNX bus when youā€™re (re)building your home, but even there itā€™s just one option, and usually the most expensive one. Flexibility is also limited because you will need the bus wiring to be where you want the sensors to be.

@gr1nch
Sonoff w/ Tasmota firmware is a reasonable proposal if you donā€™t want to go with Arduinos (BTW: a Sonoff essentially is just another Arduino packaged as a product).
Another option would be a ZWave actuator to connect light and PIR to.
Theyā€™re more expensive than Sonoffs plus you need a ZWave controller in your openHAB server, yet still cheaper and more flexible than KNX. A ZWave subsystem also provides advantages similar to KNX such as that they can keep working when the (WiFi) network or server are down.

Some general advice since you mentioned to be new to Home Automation:
Donā€™t design your HA setup starting with a particular device (such as your PIR) to have partial functionality.
Thatā€™ll quickly (if not to say only ever) lead to incomprehensive and often expensive solutions. Sometimes itā€™s better or even cheaper to replace existing equipment rather than to reuse it.
Do it the other way round:
Collect your requirements, i.e. write down what functionality you will want to be available where and only ever start selecting technologies and devices when you have a more or less complete picture of your needs.
Go wired and install centralized wiring wherever you can without too much effort, but also think of combining wired and wireless.
Select the best-suited/cheapest technology/sensor/actuator for each and every location and task, throw in what you already have (PIRs etc), then consolidate to use no more than 2 or 3 different technologies and types of devices in total.
Finally, take advantage of openHABā€™s capabilities to bring it all together, i.e. to connect to and control everything in parallel.

1 Like

True!

Not true!

For clarity:
In terms of TCO, knx is similar to the other technologies around, not considering brainpower involved!
Maintaining a KNX implementation with regards to costs (sorry for being cost oriented) is close to zero compared to other protocols (especially Wi-Fi based devices)!

My 2 cents!

Iā€™ll second ā€œreview your requirementsā€. For example, does/will this setting need a security intruder alarm? OpenHAB can extract info (like PIR triggers) from a separate system and use it for other purposes e.g. lighting control.

Of course, OpenHAB can be made to act as an intruder alarm itself when used with sensors etc. But that is not its primary role, and there is good reason to doubt the integrity of such an arrangement compared to a purpose made system. ā€œHorses for coursesā€ is a good rule of thumb, specialist systems or sub-systems working together can be easier to set up and maintain.

Decisions, decisions :slight_smile:

2 Likes

Youā€™re probably right when it comes to the professional market but your statement is clearly disputable in the private home sector, and highly dependent on the existing building infrastructure and what you as the home owner are capable of throwing into the game yourself in terms of work and brainpower. Paying the TGA planner [not sure if thereā€™s a corresponding English term] and electrician to do every little change is mandatory for the most part in KNX (thus quite some CAPEX) while in the other technologies it is rather not. I tend to agree on high (hidden) cost & risk to maintain WiFi but would rather disagree when it comes to ZWave.
Either way, I bet most home owners donā€™t know what TCO actually is or how to properly do the calculation, and we can easily have a dispute over that. But weā€™re getting off-topic, letā€™s rather have another beer, George (and maybe some cheesecake :cheese: :pie: :yum:).

1 Like

@mstormi
Good point about collecting requirements - youā€™ve got me thinking about writing them down from the gushing stream of thought as Iā€™m learning what people have done, what products are available, can be adapted and finding out how powerful OpenHAB is and bridges to things. I donā€™t presume anyone is interested, but it is good for me to get it down in writing and also maybe other future newbies. Here goes:

Background: I am in the midst of completely and professionally rewiring my very outdated house (some electrical cabling is original, over 90 years old!).

General goal The intersection of these :wink:
The words fast, cheap and good in coloured circles

Constraints

  • Quality: top priority. This is important to me. From a home automation perspective I believe Iā€™ve hit the motherlode with OpenHAB :smile:. Components top quality, but I have a bias towards open source (Red Hat was my life and work for 7 years) ,though that could be the software on them, e.g. Tasmota.
  • Time: not important. I am working full time as an assistant to professional tradesman on my home renovations and upgrade. I can spend a lot of my time on implementing HA.
  • Scope: limited only my own imagination and that of the home automation community.
  • Cost: relatively large budget, but I prefer hackable, open source stuff if its good. e.g. I have not skimped on cabling: end to end, all data connections structure, patch, panels, plugs are Cat6A. Iā€™ve gone with Tradfri lights, Raspberry Pii and seriously considering Sonoff/Tasmota (as well as KNX).

Requirements

  • OpenHAB to monitor and (additionally) control, where possible and preferable, every house system.
  • Very reliable internet and WIFi - PoE APs, internet failover (at a minimum, to phoneā€™s hotspot)
  • Very reliable, secure security system. Wired PIRs (must permit lighting control).
  • Very reliable external security lighting. Wired PIRs. (must initiate a security event, must have manual override)
  • Reasonably reliable internal lighting controllers to lots of dimming LEDs (I like IKEAā€™s Tradfri tech of Zigbee dimmers inside the lamps and have fitted them extensively in downlights, pendants, stands and uplighting).
  • Reliable wireless boiler control.
  • Reasonably reliable wireless per-radiator control.
  • Reliable power socket control (including all high load sockets and those that feed devices that may need hard resets)
  • PoE video cameras, mostly external
  • Smart energy meters. SSE (local energy company) are installing them next month for both gas and electricity.
  • Voice control on two floors (experimenting with Google Home)
  • Automated geo-location control
  • Lights on/off dependent on activity for some locations
  • Secure and high performance environment for control and data equipment
  • Scenes/moods involving multiple things.
  • All data centralised and backed up at home - also replicated in the cloud (I have accounts for this).
  • Very reliable OpenHAB mobile app/client.

Non-requirements

  • Garden maintenance - at a later date
  • Garage door, blinds, etc.

User stories
I want my home toā€¦

  • be very enjoyable and convenient to live in
  • be welcoming to guests
  • be a deterrent to intruders

Wherever my wife and I are, I want us toā€¦

  • quickly control all heating, lighting and high load power sockets, automatically whenever deisred.
  • receive immediate alerts of intruders
  • monitor inside and outside the house
  • monitor energy usage

I think thatā€™s covered most of it!

1 Like

Here is a thought check out my tutorial

No, itā€™s not disputable in any case! Of course there are infrastructure differences between any setups! I was only defending the Total Cost of Ownership, aka TCO! Whatever infrastructure chosen, for me is of no importance as long as QoS/price ratio is meaningful!
Again, just my 2 cents!
PS: I will always be available for a beer with Markus! Stuttgart was really nice!

As per any experience with technology, you will find yourself in a choosing position in terms of what and how to use!
You have started this post wondering how to integrate some PIRā€™s sensors into openHAB, which is really cool, but totally inappropriate with what this framework is really about (I am just pointing the obvious)!
What you have found here after asking a ā€œwrongā€ question is nothing more than making your own decision based on the communityā€™s experience!
This, IMHO, is great!

Markus you are absolutely right. I was not advising that using one KNX sensor as a standalone item with openHAB is a good idea! I was only explaining to @gr1nch the items required to get the sensor running and to interface to another system. You make a lot of good points.

@gr1nch
KNX is certainly going to cost more than some inexpensive parts that allow you to implement your own firmware. KNX devices are finished products that are ready to use out of the box after simple configuration via the ETS. In general the KNX products we sell are extremely reliable with low failure rates and most people value reliability very highly where building functions are concerned.

KNX is reasonably priced compared to most of the proprietary automation systems out there e.g. Lutron, Crestron, C4 etc because there is no expensive central processor required and there are a large range of manufacturers/products available to choose from. Also, a capable amateur can buy KNX products and the ETS configuration software. With proprietary solutions the products are only sold and installed through official dealers and usually the configuration software is not made available to the end user.

KNX RF (wireless) is also available. There are not so many products available currently but the number is growing. As @mstormi mentioned, ZWave is another open wireless system that also offers distributed control and does not necessarily rely on a central controller. KNX RF and ZWave operate at around 868MHz so you get more reliable communication/farther transmission range than products in the 2.4 GHz band.
Another thing to consider with wireless transmitting devices is whether they are specifically approved for use in your area of the world. Some countries are very strict about use of the RF spectrum and you can get into trouble with the relevant authority if you are transmitting on unauthorised frequencies.

Wireless options are good for retrofit but ideally I would have a wired system which brings me back to KNX over the Twisted Pair bus cable.

1 Like

A little off topic, but I am wondering on the practicality of letting Z-Wave devices control each other directly without relying on the central controller. An example of this is the room occupancy sensor to turn on the light. We can configure a Z-Wave motion sensor to ask the Z-Wave light switch to turn on the light. That works for simple case, but it would not be possible if you add more complicated logic such as turn on the light after sunset but do not turn on the light pass midnight. This scenario is not possible with Z-Wave sensor association or scene, am I correct?

Mostly yes, but depends on the devices. You have a fairly limited set of functions available inside these, and any logic this does not cover would need to be implemented on the controller side (inside openHAB rules, that is).
But that functionality varies depending on the product. For example, Iā€™m using ZWave (multi)sensors that can be configured to alert on movement only when light intensity is below or above a configurable limit.
For ZWave (and KNX, too, as well as any other subsystem to provide command & control features), Iā€™d refrain from distributing your overall logic (in)to disparate devices, though.
That complicates things a lot when it comes to programming and debugging.
Iā€™d configure and consider this to be more of a backup for emergency operations (i.e. server down) where you might not have a direct wire connection between switch and load.

That is what openHAB is for after all!!