I went on a mission te replace my wax candles with something more modern, and I find these dancing flame candles quite convincing. Most of them come with a generic IR remote, so I decided to give it a shot and bought these:
I enabled the following features:
After you learn your remote, use the following config to control them:
(make sure your learnt remote commands have a matching name)
input_boolean:
candles_state:
name: "Candles State"
input_number:
candles_brightness:
name: "Candles Brightness"
initial: 7
min: 1
max: 7
step: 1
input_select:
candles_effect:
name: "Candles Effect"
options:
- candle
- light
initial: candle
light:
- platform: template
lights:
candles:
friendly_name: "Candles"
unique_id: living_room_candles
value_template: "{{ states('input_boolean.candles_state') }}"
level_template: "{{ ((states('input_number.candles_brightness')|int)* (255/state_attr('input_number.candles_brightness', 'max'))) | round(0, 'ceil') }}"
effect_list_template: "{{ state_attr('input_select.candles_effect', 'options') }}"
effect_template: "{{ states('input_select.candles_effect') }}"
turn_on:
- service: remote.send_command
data:
num_repeats: 1
delay_secs: 0.4
hold_secs: 0
command: "on"
device: candles
target:
entity_id: remote.broadlink_remote
- service: input_boolean.turn_on
target:
entity_id: input_boolean.candles_state
- service: input_select.select_option
data:
option: "candle"
target:
entity_id: input_select.candles_effect
# Sync the brightness
- service: remote.send_command
data:
num_repeats: "{{ (state_attr('input_number.candles_brightness', 'max') - states('input_number.candles_brightness')| int) | abs }}"
delay_secs: 0
hold_secs: 0
command: "brightness_down"
device: candles
target:
entity_id: remote.broadlink_remote
turn_off:
- service: remote.send_command
data:
num_repeats: 1
delay_secs: 0.4
hold_secs: 0
command: "off"
device: candles
target:
entity_id: remote.broadlink_remote
- service: input_boolean.turn_off
target:
entity_id: input_boolean.candles_state
set_level:
- service: remote.send_command
data:
num_repeats: "{{ (((brightness / (255/state_attr('input_number.candles_brightness', 'max'))) | round(0, 'ceil')) - states('input_number.candles_brightness')| int) | abs }}"
delay_secs: 0
hold_secs: 0
command: "{{'brightness_up' if (((brightness / (255/state_attr('input_number.candles_brightness', 'max'))) | round(0, 'ceil')) > states('input_number.candles_brightness')| int) else 'brightness_down'}}"
device: candles
target:
entity_id: remote.broadlink_remote
- service: input_number.set_value
data:
value: "{{ (brightness / (255/state_attr('input_number.candles_brightness', 'max'))) | round(0, 'ceil') }}"
target:
entity_id: input_number.candles_brightness
set_effect:
- service: remote.send_command
data:
num_repeats: 1
delay_secs: 0.4
hold_secs: 0
command: "{{ effect }}"
device: candles
target:
entity_id: remote.broadlink_remote
- service: input_select.select_option
data:
option: "{{ effect }}"
target:
entity_id: input_select.candles_effect
Edit:
- Sync brightness on startup
- Use candles_brightness max for brightness calculations