Letzter täglicher Build
Build erfolgreich
Zuletzt gebaut: 27.09.2026, 15:02
Build-Details & Log anzeigen1esphome:
2 name: rgb-led-mit-pir
3
4esp8266:
5 board: nodemcuv2
6
7wifi:
8 ssid: !secret WLanSSID
9 password: !secret WLanPassword
10
11 ap:
12 ssid: "RGB-LED-PIR"
13 password: "gWef1LGFbEILB"
14
15captive_portal:
16logger:
17api:
18ota:
19
20sun:
21 latitude: 51.158672°
22 longitude: 7.196742°
23
24time:
25 - platform: homeassistant
26 id: local_time
27
28
29binary_sensor:
30 - platform: gpio
31 pin: D1
32 name: "Bewegungsmelder"
33 device_class: motion
34 id: pir
35 on_press:
36 then:
37 - if:
38 condition:
39 - sun.is_below_horizon:
40 then:
41 - script.execute: switch_rgb_led_script
42
43light:
44 - platform: rgb
45 name: "RGB Led"
46 red: rgb_led_red
47 green: rgb_led_green
48 blue: rgb_led_blue
49 id: rgb_led
50
51output:
52 - platform: esp8266_pwm
53 id: rgb_led_red
54 pin: D5
55 - platform: esp8266_pwm
56 id: rgb_led_green
57 pin: D6
58 - platform: esp8266_pwm
59 id: rgb_led_blue
60 pin: D2
61
62
63# Helper um per HA das Abschalten per timeout generell zu verhindern
64switch:
65 - platform: gpio
66 pin: D3
67 name: "LEDs dauerhaft an"
68 id: leds_daueran
69 on_turn_on:
70 - light.turn_on: rgb_led
71 on_turn_off:
72 - light.turn_off: rgb_led
73
74
75# Script mit Mode=restart, damit der Timeout bei jeder erneuten Bewegung zurückgesetzt wird.
76# Wenn also das Licht eingeschaltet wurde, aber in den 2 Minuten delay erneut eine Bewegung erkannt wird,
77# wird das Script abgebrochen und neu gestartet, wodurch die 2 Minuten Wartezeit erneut beginnen
78script:
79 - id: switch_rgb_led_script
80 mode: restart
81 then:
82 - light.turn_on: rgb_led
83 - delay: 2min
84 - if:
85 condition:
86 switch.is_off: leds_daueran
87 then:
88 - light.turn_off: rgb_led