Skip to content

Instantly share code, notes, and snippets.

@skandragon
Created December 18, 2022 15:29
Show Gist options
  • Save skandragon/198874e8fd9f04c6ae4506e379d53249 to your computer and use it in GitHub Desktop.
Save skandragon/198874e8fd9f04c6ae4506e379d53249 to your computer and use it in GitHub Desktop.
ESPHome sensor for my 3d case
esphome:
name: radar-01
esp8266:
board: d1_mini
logger:
level: INFO
ota:
password: !secret ota_password
api:
encryption:
key: !secret api_key
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
time:
- platform: sntp
servers:
- 10.42.255.254
output:
- platform: esp8266_pwm
pin:
number: D2
mode: output
id: LED
- platform: gpio
pin:
number: D4
inverted: true
mode: output
id: B_LED
light:
- platform: binary
output: B_LED
id: B_LED_LIGHT
- platform: monochromatic
output: LED
id: LED_LIGHT
effects:
- strobe:
name: Flash
interval:
- interval: 2sec
then:
if:
condition:
and:
- api.connected:
- binary_sensor.is_off: motion_1
- light.is_off: LED_LIGHT
then:
- light.turn_on:
id: LED_LIGHT
transition_length: 0ms
- delay: 10ms
- light.turn_off:
id: LED_LIGHT
transition_length: 0ms
binary_sensor:
- name: radar-01
id: motion_1
platform: gpio
pin:
number: D1
mode:
input: true
pullup: false
device_class: motion
publish_initial_state: true
on_state:
then:
- if:
condition:
binary_sensor.is_on: motion_1
then:
- light.turn_on: LED_LIGHT
else:
- light.turn_off: LED_LIGHT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment