Lighting Control, PIR Sensors and Occupation

Tags: #<Tag:0x00007f7392f9ec20> #<Tag:0x00007f7392f9eb08> #<Tag:0x00007f7392f9e9f0>

[LIGHTING] | IRRIGATION | INPUT | TREATMENT | FILTRATION | SOLIDS

AQUAPONIC | PLC | SCREENS | SONOFF | myHome-Assistant Project

PLC + HA

Automated lighting control for outside areas has been in place via my PLC’S using PIR Sensors, local wall switches, light relays and the ‘occupied entity’ for a fair while. All sensors and wall switches used on the PLC system are wired to digital inputs on the PLC. The Function Block Diagram (FBD) Program on the PLC provides ALL control logic. To monitor and control the PLC I use a wired ethernet connection to Home-Assistant. This ensures a very robust system. The PLC program is very reliable as long as there is 24VDC which is fed from a UPS PROTECTED SUPPLY. The PLC program is designed to be aware of the status of 240VAC to power the lights. The system is also wired to ensure local switches are working normally if remote control should fail.

Remote control fails if my router and/or HA server should fail however these systems are also on a UPS PROTECTED SUPPLY.

MQTT + WIFI + HA

I have a newer lighting system (which is still evolving) in my rumpus room which is based on sonoff basics performing the functions of local wall switches, light relays, PIR sensors and the 'occupied entity. To ensure reliability, I use a wired switch to the sonoff acting as the light relay of selected lights. As long as there is 240v power, then selected lights continue to work locally.

For automation I use various Tasmota Rules residing on the applicable sonoff basic’s. This provides ALL control logic with communications between devices relying on MQTT and WIFI. Remote control also fails without MQTT, WIFI and HA server however these systems are also on a UPS PROTECTED SUPPLY.

Auto with local control and occupation

Using an automation system based on ‘occupation’ is working out very well for me. I have plans to progress rolling this out throughout the rest of the house as time permits.

Lighting can be turned on or off anytime by either local switches or by HA. Movement (PIR sensors often several within the area) will trigger an ‘occupied’ status once detected. The ‘occupied’ state remains active for a set interval of time unless more movement is detected.

Further movement detection always resets the time interval. Once there is no further movement and the ‘occupied’ state is changed to ‘unoccupied’ an automation turns off all lights within the area.

Automation for both ‘PLC + HA’ and ‘MQTT + WIFI + HA’ systems also uses a daylight sensor which constantly monitors light levels. The state of the daylight sensor changes around sunset or during overcast conditions which causes an area which becomes ‘occupied’ to trigger an automation to turn on the required lights. Lights remain on until the room or area becomes ‘unoccupied’ OR are turned off either locally or remotely. At sunrise or when overcast conditions clear lights will not be triggered.

PIR Sensors

I started with some security grade, Quad Band devices but they are VERY expensive.

So I have become a fan of these HC-SR501 very cheap but seemingly good quality ones for around $3 delivered from China. see here

If I want to use it as an input for my PLC’s I just use the relay contacts on the sonoff (modded to be no volt contacts). Otherwise I just set it up as a movement sensor in HA config. I mount them in either boxes outside.

Or in standard switch plates on the wall inside.

Home-Assistant screenshot


myHome-Assistant Project

1 Like

I’m curious, how are you detecting pool occupancy?

1 Like

@jon102034050 I have a PIR sensor at my pool fence gate atm. Planning to add a second inside the gated area but time has been hard to find for that one.

Cool, what are you using for an exterior motion sensor? If you have any cameras back there, you should checkout Local realtime person detection for RTSP cameras
I’ve switched my exterior motion sensing over to this and it’s been working extremely well

1 Like

@jon102034050 Back a while I had some of the security grade Quad Band Anti Ghosting type devices (very expensive to buy) but these days I have moved on to these fitted in neat boxes with a sonoff basic connected. If I want to use it as an input for my PLC’s I just use the relay contacts (modded to be no volt contacts). Otherwise I just set it up as a movement sensor in HA.

I’ll add some photos in this post soon.

I just added some photos of sensors in the post.