Can i adjust an input slider with a scene. I have a timed light that has a input slide to adjust how long the timer is. The automation is triggered when I adjust the input slide and would like to use a scene to do this with the amazon echo. Maybe there is a better way to do this?
This is what I have:
Automation:
- alias: "Turn on kitchen lights when there is movement"
trigger:
- platform: state
entity_id: sensor.vision_zp3111_multisensor_4in1_alarm_level_3_1
state: '255'
- platform: state
entity_id: switch.ge_12722_onoff_relay_switch_switch_2_0
state: 'on'
- platform: state
entity_id: input_slider.kitchen_timer
condition:
condition: or
conditions:
- condition: template
value_template: '{{ states.sun.sun.attributes.elevation < 15 }}'
- condition: template
value_template: '{{ states.sensor.vision_zp3111_multisensor_4in1_luminance_3_3.state < 45 }}'
action:
service: homeassistant.turn_on
entity_id: script.kitchen_timed_light
Script:
kitchen_timed_light:
alias: "Turn on kitchen light and set timer"
sequence:
# Cancel ev. old timers
- service: script.turn_off
data:
entity_id: script.kitchen_timer_off
- service: homeassistant.turn_on
data:
entity_id: switch.ge_12722_onoff_relay_switch_switch_2_0
# Set new timer
- service: script.turn_on
data:
entity_id: script.kitchen_timer_off
kitchen_timer_off:
alias: "Turn off kitchen light after 1 minutes"
sequence:
- delay: '00:{{ states.input_slider.kitchen_timer.state | int }}:00'
- service: input_slider.select_value
data_template:
entity_id: input_slider.kitchen_timer
value: 1
- service_template: >
{%- if not is_state("sensor.vision_zp3111_multisensor_4in1_alarm_level_3_1", "0") -%}
script.turn_on
{% else %}
homeassistant.turn_off
{% endif %}
data_template:
entity_id: >
{%- if not is_state("sensor.vision_zp3111_multisensor_4in1_alarm_level_3_1", "0") -%}
script.kitchen_timer_off_restart
{% else %}
switch.ge_12722_onoff_relay_switch_switch_2_0
{% endif %}
kitchen_timer_off_restart:
alias: "Turn off kitchen light after 1 minutes (restart)"
sequence:
# Cancel current script
- service: script.turn_off
data:
entity_id: script.kitchen_timer_off
- service: input_slider.select_value
data_template:
entity_id: input_slider.kitchen_timer
value: 1
# Set new timer
- service: script.turn_on
data:
entity_id: script.kitchen_timer_off
Input Slider:
kitchen_timer:
name: Kitchen Light Timer
initial: 1
min: 1
max: 51
step: 5
Scene:
- name: Dinner Time
entities:
input_slider.kitchen_timer:
state: 51
Home Assistant Log:
17-01-17 23:41:29 homeassistant.helpers.state: reproduce_state:
Unable to reproduce state <state input_slider.kitchen_timer=51
Thanks