ESP01 D1 mini Motion sensor + photoresistor + grid of led +
Flash the esp-D1-mini to install Tasmota
Flash Tasmota using a Chrome based browser for ESP82XX and ESP32
GPIO on a ESP-D1-mini
Configuration of MQTT
Change : Host, User, Passwd and topic parameters.
A new entity is automatically added to the MQTT list of entities already found (+1 in the number of entities)
Add the LED grid - WS2812
See: tasmota.github.io/docs/Lights/
Add a single led
Add the Photoresistor
See: tasmota.github.io/docs/ADC/
The change in the photoresistor value is unfortunately not sent automatically with each change. You must therefore define a rule directly in Tasmota. See : PIR-Motion-Sensors documentation
SwitchMode1 1
SwitchTopic 0
Rule1
ON analog#a0>%var1% DO
Backlog var1 %value%;
publish stat/%topic%/photoresistor %value%;
var2 %value%;
add1 10;
sub2 10;
ENDON
ON analog#a0<%var2% DO
Backlog var2 %value%;
publish stat/%topic%/photoresistor %value%;
var1 %value%;
add1 10;
sub2 10;
ENDON
Rule1 1
Motion sensor (PIR HCS-SR505)
See :https://tasmota.github.io/docs/PIR-Motion-Sensors/#tasmota-settings
SwitchMode1 1
SwitchTopic 0
Rule2 on Switch1#state=1 do publish stat/%topic%/PIR1 ON endon on Switch1#state=0 do Publish stat/%topic%/PIR1 OFF endon
Rule2 1
Restart 1
configuration.yaml
mqtt:
binary_sensor:
- unique_id: "20240119_1746"
state_topic: "stat/tasmota_escalier_2F9DA0/PIR1"
name: "Escalier PIR"
device_class: motion
availability_topic: "tele/tasmota_escalier_2F9DA0/LWT"
qos: 1
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
Temperature sensor - DHT22
Warning
Don't select DHT11 but use AM2301
Graph with custom:apexcharts-card and type: custom:mini-graph-card
Graph with : motion sensor TRUE (green), led grid ON (orange) + luminosity (grey)
type: custom:apexcharts-card
update_interval: 10min
header:
show: true
title: Éclairage escalier
show_states: false
colorize_states: true
graph_span: 24h
span:
end: day
apex_config:
legend:
show: false
chart:
height: 260
now:
show: true
color: grey
label: Now
series:
- entity: sensor.escalier_photoresistor
group_by:
func: avg
duration: 10min
type: area
opacity: 0.3
stroke_width: 1
color: rgb(200, 200, 200)
extend_to: now
transform: return x / 10.24
- entity: binary_sensor.escalier_pir
color: green
type: column
stroke_width: 3
opacity: 0.1
transform: 'return x === ''on'' ? 72 : 0;'
- entity: light.esp_tasmota_escalier_tasmota2
type: column
color: orange
transform: 'return x === ''off'' ? 75 : 0;'
stroke_width: 1.5
yaxis:
- min: 70
max: 100
show: false
Show values of luminosity (0 - 1024), Temperature and motion sensor
type: horizontal-stack
cards:
- type: custom:mini-graph-card
name: Luminosité
entities:
- sensor.escalier_photoresistor
line_color: blue
line_width: 8
font_size: 75
- type: custom:mini-graph-card
name: °C
entities:
- sensor.esp_tasmota_escalier_am2301_temperature
line_color: '#e74c3c'
line_width: 8
font_size: 75
- type: custom:mini-graph-card
name: PIR
entities:
- sensor.escalier_pir_x_100
line_color: var(--accent-color)
line_width: 8
font_size: 75
Automation
Turns ON the LED grid if movement is detected and there is not enough light
Turns OFF the LED grid if the "detected" state changes to "not detected"