Hi all,
I’m quite new to HA so please bear with me.
I have some RGBWW led strips for my kitchen run of an ESPThings Analog controller.
I can control the leds and run some simple effects like a slow rainbow.
I’ve now installed an Aqara PIR motion sensor, and I’m trying to automate it so when the PIR senses motion in the kitchen, it switches from running the slow rainbow effect to full brightness Cold White led’s.
The idea being that when someone enters the kitchen the led’s switch to cold white for additional lighting.
As I state below, I tried using the automation wizard in HA but then had a go with the yaml file.
I’ve had a few try’s with no success, I’ve tried indenting things around.
1, I keep getting the following message;
Message malformed: extra keys not allowed @ data[‘data’]
2, I don’t even know if this correct or not?
Heres the esphome led’s code
esphome:
name: kitchen-colour-leds
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "xxxxxxxxxxxxxxxxxxxxxx"
ota:
password: "xxxxxxxxxxxxxxxxxxxxx"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "xxxxxxxxxxxxxxxxxxxxxxx"
password: "xxxxxxxxxxxxxxxxxxxxxxx"
captive_portal:
sensor:
- platform: wifi_signal
name: "WiFi Signal $devicename"
update_interval: 60s
output:
- platform: ledc
pin: 26
frequency: 25000Hz
id: ledc_cw
- platform: ledc
pin: 18
frequency: 25000Hz
id: ledc_ww
- platform: ledc
pin: 19
frequency: 25000Hz
id: ledc_r
- platform: ledc
pin: 23
frequency: 25000Hz
id: ledc_g
- platform: ledc
pin: 05
frequency: 25000Hz
id: ledc_b
light:
- platform: rgbww
name: "Kitchen Colour LEDs"
id: kcl2
warm_white: ledc_ww
cold_white: ledc_cw
red: ledc_r
green: ledc_g
blue: ledc_b
cold_white_color_temperature: 5000K
warm_white_color_temperature: 3000K
color_interlock: true
effects:
- lambda:
name: Slow Rainbow
update_interval: 16s
lambda: |-
static int state = 0;
auto call = id(kcl2).turn_on();
call.set_transition_length(15000);
if (state == 0) {
call.set_rgb(1.0, 0.0, 0.0);
} else if (state == 1) {
call.set_rgb(1.0, 0.5, 0.0);
} else if (state == 2) {
call.set_rgb(1.0, 1.0, 0.0);
} else if (state == 3) {
call.set_rgb(0.5, 1.0, 0.0);
} else if (state == 4) {
call.set_rgb(0.0, 1.0, 0.0);
} else if (state == 5) {
call.set_rgb(0.0, 1.0, 0.5);
} else if (state == 6) {
call.set_rgb(0.0, 1.0, 1.0);
} else if (state == 7) {
call.set_rgb(0.0, 0.5, 1.0);
} else if (state == 8) {
call.set_rgb(0.0, 0.0, 1.0);
} else if (state == 9) {
call.set_rgb(0.5, 0.0, 1.0);
} else if (state == 10) {
call.set_rgb(1.0, 0.0, 1.0);
} else if (state == 11) {
call.set_rgb(1.0, 0.0, 0.5);
}
call.perform();
state++;
if (state == 12)
state = 0;
- strobe:
- strobe:
name: Strobe Effect With Custom Values
colors:
- state: true
brightness: 100%
red: 100%
green: 90%
blue: 0%
duration: 500ms
- state: false
duration: 250ms
- state: true
brightness: 100%
red: 0%
green: 100%
blue: 0%
duration: 500ms
- flicker:
- flicker:
name: Flicker Effect With Custom Values
alpha: 95%
intensity: 10.5%
- random:
- random:
name: Random Effect With Custom Values
transition_length: 5s
update_interval: 7s
- pulse:
- pulse:
name: "Fast Pulse"
transition_length: 0.5s
update_interval: 0.5s
- pulse:
name: "Slow Pulse"
# transition_length: 1s # defaults to 1s
update_interval: 2s
Here’s what I’ve been trying to write in the automation. I started with Automations wizard within HA, but as it didn’t have the option I wanted to switch the effect Off and only switch On the CW led’s, I decided to try having a go at the yaml myself, possibly a mistake to do so, but I’ve tried.
alias: Kitchen motion Catch
description: ""
trigger:
- type: motion
platform: device
device_id: 0a0d2e74956722bc0f62949fbab52519
entity_id: binary_sensor.kitchen_pir
domain: binary_sensor
for:
hours: 0
minutes: 1
seconds: 0
condition: []
action:
- device_id: bb944cdbee03bad8b30a1c6799c95d3d
domain: light
entity_id: light.kitchen_colour_leds
data: {}
effects: "None"
brightness: 255
rgbww_color: [0,0,0,255,0]
mode: restart
I’d be really grateful for some advice.
Darren.