This is the 3rd part of my Home Automation light project. In the first part, I wrote about basic setup with basic Sonoff Wifi MQTT switches and setting them up. In the second one, we added some 433 MHz motion sensors and a 433 MHz to MQTT bridge. And finally in part 3, we are going to modify the 433 MHz motion sensors to only work when it is dark in the room.
Motion Sensor
The motion sensor I linked in part 2 is run by a common chip called a BISS0001. We are interested in pin 9. If voltage is below .2v it will not trigger a motion. This solves the problem discussed in part 2, when we have a gloomy day or if blinds are closed etc.
By adding an GL5537 LDR (Light Dependent Resistor) shown as R3 in the diagram above, you will achieve the desired effect. Extend the LDR with some wires and solder between ground and pin 9.
Home Assistant
Before modifying we had 2 automations one for before sunrise and one for after sunset:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
automation: - alias: Turn on generic after Sunset hide_entity: true trigger: platform: state entity_id: binary_sensor.generic_motion to: 'on' condition: condition: and conditions: - condition: sun after: sunset after_offset: "-1:00:00" - condition: time before: '20:00:00' action: service: homeassistant.turn_on entity_id: script.generic_timed_lamp - alias: Turn on generic before Sunrise hide_entity: true trigger: platform: state entity_id: binary_sensor.generic_motion to: 'on' condition: condition: and conditions: - condition: sun before: sunrise before_offset: "1:00:00" - condition: time after: '07:00:00' action: service: homeassistant.turn_on entity_id: script.generic_timed_lamp |
Now that we’ve added the logic for light and dark at the motion sensor itself, we can simplify these 2 down to one automation, and only specify the time. The rest of the home assistant configuration can be found in 2nd article here.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
automation: - alias: Turn on generic on Motion hide_entity: true trigger: platform: state entity_id: binary_sensor.generic_motion to: 'on' condition: condition: and conditions: - condition: time after: '07:00:00' - condition: time before: '22:00:00' action: service: homeassistant.turn_on entity_id: script.generic_timed_lamp |
That is all I have for now. If you have an idea or a product that you feel that meets the cheap and DIY criteria leave a comment below. I will test it out. I know you can do a ton of things with Home Assistant and a lot seem over the top. I want to focus on mundane things like turning off lights. I am also going to get some 433 MHz moisture sensors for my house to place in crawl spaces, and under the sink but that is pretty basic.
Continue reading “Part 4: MQTT Bridge Updated to Use YS-IRTM IR Receiver & Transmitter with NodeMCU“.
Karl is a technology enthusiast that contributes reviews of TV boxes, 3D printers, and other gadgets for makers.