I wanted to have a smart floodlight that would turn on at night with movement, but that could control; I also want to use the motion and light data for other automatons.
So I bought a cheap floodlight on amazon, gutted it and made it smart!
I used a spare tyw3s module I re-purposed from a dimmer I fried as the brain. I added a PIR module, a tsl256 light sensor, and a bme280 and a relay.
Forpower i used a stepdown and a regulator.
It took a bit of dremeling to get things to fit snug, but it all fit!
I made a small holes to allow access to the Tx Rx V G and GPIO0 through the housing, (on the underside to avoid water getting to the holes) and put some tape over them to protect from weather.
The tricky part was mitigating false positives. After closing it all up, the pir was reporting motion every minute or so, some times more frequently.
I solved this by re-routing the signal wire of the pir ad wrapping it with tinfoil and attaching the foil to ground. After that works like a charm.
I’m using esphome (was debating if I should use tasmota, but esphome seems easier; also like to have automations self contained in case the network goes down and this is not as easy to do for me in tasmota).
Here’s my yaml:
esphome:
name: floodlight01
platform: ESP8266
board: esp01_1m
wifi:
ssid:
password:
manual_ip:
static_ip: 192.168.x.xxx
gateway: 192.168.x.x
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Floodlight01"
password: "xxxx"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
password: "xxxx"
ota:
password: "xxxx"
i2c:
sda: 12
scl: 14
# scan: True
binary_sensor:
- platform: gpio
pin:
number: GPIO13
name: "Floodlight pir"
device_class: motion
filters:
# on_press:
# then:
# - switch.toggle: relay
# on_release:
# then:
# - delay: 5s
# - switch.turn_off: relay
switch:
- platform: gpio
name: "Floodlight"
id: relay
pin:
number: GPIO16
mode: OUTPUT
- platform: gpio
name: "Floodlight led"
pin: GPIO4
id: white_led
inverted: yes
- platform: restart
name: "Floodligh resatrt"
id: floodlight_restart
status_led:
pin:
number: GPIO5
inverted: yes
sensor:
- platform: tsl2561
name: "Floodlight Brightness"
address: 0x39
update_interval: 60s
- platform: bme280
temperature:
name: "Floodlight Temperature"
id: Floodlight_temperature
filters:
- lambda: return (x * (9.0/5.0) + 32.0) -10;
unit_of_measurement: "°F"
pressure:
name: "Floodlight Pressure"
id: Floodlight_pressure
humidity:
name: "Floodlight Humidity"
id: Floodlight_humidity
filters:
- lambda: return x +10;
address: 0x76
update_interval: 30s
Hope this helps someone looking to do the same.
Can anyone help me with writing a lambda so that this funtions like a traditional motion light (turns on only if dark and motion is sensed, with the ability to turn on /off the light via HA without interrupting the automatons).
Thanks in advance!