But I haven’t figured out how to get the slider data into the Action of the automation. Here’s one of my attempts:
Action Type:
Call Service
Service:
light.turn_on
Service Data
{
"brightness": "states('input_number.ldg_dimmer')",
"entity_id": "light.landing"
}
If I put a discrete number for “brightness”:“200”, then touching the slider turns the light on at level 200. Any tips would be appreciated to show me how to get the slider value into this automaton action.
I suspected that I couldn’t use templates. Your suggestion doesn’t work either.
I just discovered the “automation_old” component, may be that’s my solution.
Thanks so much. It’s still not working, but I am getting closer.
I couldn’t find “automation_old” because it isn’t a component and it is “automation old”.
I did see the example automation that publishes an MQTT message with the slider value. I kind of started there.
I made a new include file named “automations_old” and added it to my configuration.yaml. In it I attempted to make the automation, and it almost works.
Now, with the new (old-style) automation, if I touch the slider, the light turns off. I am guessing that it is receiving a bightness of zero but the config tool only says “off”. So, as I said, getting somewhere because before now, touching the slider did nothing.
- alias: Landing Light Dimmer Control
trigger:
platform: state
entity_id: input_number.landing_brightness
condition: []
action:
service: light.turn_on
data_template:
entity_id: light.landing
brightness: > #this is the multiline indicator and makes you not need quotes around the template
{{ states('input_number.landing_brightness')|int }}
maybe even replace that last template by:
{{trigger.to_state.state |int}} though i must confess I didn't test that..
For my personal taste, this is prettier on the eye.
I was apparently wrong to advice on the |int for brightness, (unless you’ve made your input_number not create int’s…)
please see this thread on that Isn't this an int?
You might still need it, but because of a special and peculiar detail, when the template hasn’t got a value (None), and you need it to have a value to pass.