Smart PIR Shelly 1 HA

I managed to add Shelly 1 to my Garden PIR Light, So now I can monitor the motion in all day and turn on the light in night.

I had this idea in my mind for a while, but didn’t have the courage to do, but after seeing the following video i too managed to put shelly 1 inside the PIR Light and it works.


ESPHome: Config

esphome:
  name: garden
  platform: ESP8266
  board: esp01_1m

wifi:
  networks:
  - ssid: "wifi"
    password: "wifipassword"

  - ssid: "wifi2"
    password: "wifipassword2"

output:
  - platform: gpio
    pin: GPIO4
    id: gpio_4

light:
  - platform: binary
    name: "Garden Light"
    output: gpio_4
    
binary_sensor:
  - platform: gpio
    pin:
      number: GPIO5
    name: "Garden"

Automation:

- id: 'YYYYYYYY'
  alias: garden_light_ON
  description: ''
  trigger:
  - entity_id: binary_sensor.garden
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - after: '18:00:00'
    before: 06:00:00
    condition: time
  action:
  - data:
      entity_id: light.garden_light
    service: light.turn_on

- id: 'XXXXXXXXX'
  alias: garden_light_OFF
  description: ''
  trigger:
  - entity_id: binary_sensor.garden
    from: 'on'
    platform: state
    to: 'off'
  condition: []
  action:
  - data:
      entity_id: light.garden_light
    service: light.turn_off

Does it mean: During the day you monitor any motion - meaning the motion detector sends a signal (binary sensor in Home Assistant says state on (knows if motion is detected) but does not turn on the lights. (could be used as an alarm sensor). And during the night if motion is detected the binary sensor says ON and the lights turn on. What Motion Sensor are you using? Could you please share the video link of the video you mentioned? I assume you flashed the Shelly 1 with ESPhome?

Yes, the switch was decoupled from the relay control, which is now reported as a light.

If motion is detected during the night the light turns on.
If motion is undetected (PIR off) at any time the light turns off.
The motion detection sensor still reports motion during the day, but the time range prevents the lights from activating

I assume any contact-relay type PIR running on mains voltage will work