Skip to content

Instantly share code, notes, and snippets.

@Resinchem
Created September 16, 2022 16:46
Show Gist options
  • Save Resinchem/b56296f7d645e477f7eeada13d986f39 to your computer and use it in GitHub Desktop.
Save Resinchem/b56296f7d645e477f7eeada13d986f39 to your computer and use it in GitHub Desktop.
ESPHome Code for Multi-sensor
esphome:
name: garage-multisensor
esp8266:
board: nodemcuv2
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "your-auto-generated-key-here"
ota:
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Garage-Multisensor"
password: !secret ap_password
captive_portal:
# Device config
i2c: #AHT20 is i2c
scan: true
sensor:
# Temperatue / Humidity
- platform: aht10 #Also for AHT20
temperature:
name: "Garage Temperature2"
device_class: temperature
humidity:
name: "Garage Humidity2"
device_class: humidity
update_interval: 120s
# Analog Light Level
- platform: adc
pin: A0
name: "Garage Analog Light Level"
unit_of_measurement: lux
device_class: illuminance
update_interval: 10s
filters:
# this is a relative value - not true lux - adjust as needed for your install
- lambda: |-
return (2800/x) - 2700;
binary_sensor:
# RCWL-0516 Motion
- platform: gpio
pin: D6
name: "Garage Motion Front"
device_class: motion
# Photoresistor module DO light level
- platform: gpio
pin: D7
name: "Garage Digital Light Level"
# RGB LED
light:
- platform: rgb
id: light_1
name: "Garage Sensor LED2"
default_transition_length: 100ms
red: output_component1
green: output_component2
blue: output_component3
# LED output
output:
- platform: esp8266_pwm
id: output_component1
pin: D3
max_power: 80%
- platform: esp8266_pwm
id: output_component2
pin: D4
max_power: 80%
- platform: esp8266_pwm
id: output_component3
pin: D5
max_power: 80%
switch:
- platform: restart
name: "Garage Multisensor Restart"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment