Hi all,
I have a heating controller which is based on the 4-relay ESP32 board from AliExpress, similar to this project: DIY Heating and Hot Water Controller
I have a multifunction button with an LED which controls the downstairs heating. I need the LED on this button to represent the status of the heating in this zone:
LED off - meaning that the heating is off;
Slow pulse - meaning that the heating has been triggered by a timer;
On-solid - meaning that the heating is in boost mode.
Here are my effects listed under the light: component:
light:
- platform: monochromatic
name: $friendly_name Button Light 1
output: button_light_1
id: button_light_switch_1
restore_mode: ALWAYS_OFF
# internal: true
effects:
- pulse:
name: "Blink"
transition_length: 0.5s
update_interval: 0.5s
- pulse:
name: "Fast Pulse"
transition_length: 0.1s
update_interval: 0.4s
- pulse:
name: "Slow Pulse"
transition_length: 1s
update_interval: 2s
The button is setup using a GPIO and this calls a script “script.execute: heating_downstairs_1hr” when pressed:
binary_sensor:
- platform: gpio
pin:
number: GPIO13
mode:
input: true
pullup: true
id: button_1
filters:
- delayed_on: 20ms
on_release:
then:
- script.execute: heating_downstairs_1hr
Script heating_downstairs_1hr has the delay function for the required time:
script:
- id: heating_downstairs_1hr
mode: restart
then:
- switch.turn_on: brb_ds_direct
- logger.log: "BoilerRelayBoard DS on"
- delay: 60 min
- switch.turn_off: brb_ds_direct
- logger.log: "BoilerRelayBoard DS off"
Here’s the timer event for calling the heating:
time:
on_time:
# Downstairs, every weekday morning, 07.20 for 30 mins
- hours: 07
minutes: 20
seconds: 00
days_of_week: MON-FRI
then:
- script.execute: heating_downstairs_30min
What I can’t work out is, how do I call/set the effect or state of the LED on the basis of the operational jobs of the timer or the button? When I insert the light parameters (id, effect and brightness) into the script area as follows, I get error “mapping values are not allowed here”
- id: heating_downstairs_1hr
mode: restart
then:
- switch.turn_on: brb_us_direct
- light.turn_on: button_light_switch_1
id: button_light_switch_1
effect: "Blink"
brightness: 50%
- logger.log: "BoilerRelayBoard US on"
- delay: 60 min
- switch.turn_off: brb_us_direct
- logger.log: "BoilerRelayBoard US off"
What’s the best way of handling this? Do I need to lambda it in a platform template?