Dear community,
Is it possible to have a slider or nice visual element on Lovelace UI to control my Dyson fan speed? It goes from 1 to 10 then auto and night modes.
Thanks!
I don’t use a dyson fan, but I would do something like this:
Create an input_number to control the speed the fan:
input_number:
fan_speed_control:
name: "Fan Speed Control"
initial: 1
min: 1
max: 10
step: 1
Create an automation that changes the fan speed every time the input_number changes.
- id: '4549823579843'
alias: 'Change fan speed on change of input_number'
trigger:
platform: state
entity_id: finput_number.fan_speed_control
action:
service: fan.set_speed
entity_id: fan.dyson_fan
data_template:
dyson_speed: "{{ trigger.to_state.state | int }}"
Use the input_number in your lovelace view.
Thanks for this, I was looking for this as well.
One minor correction - you need to call the dyson.set_speed service rather than the fan.set_speed service. The latter only accepts the attribute “speed” with the values “low, medium & high”.
Can anyone help me with this? I tried a few things but none of them seem to get this up and running. This is my code in automations.yaml and a screenshot of the GUI
- id: '4549823579843'
alias: 'Change fan speed on change of input_number'
trigger:
platform: state
entity_id: input_number.fan_speed_control
action:
service: dyson.set_speed
entity_id: fan.schlafzimmer
data_template:
dyson_speed: "{{ trigger.to_state.state | int }}"
This is what my helper looks like:
I only changed it to my values. This is what I found in the logs:
Can anyone help me with this? Thanks in advance!
The first error is probably because you tried to manually trigger the automation and it therfore couldn’t find a trigger.
Does setting fan speed manually through Developer Tools -> Services work?
Can you please try putting the entity_id part in the action section into the data_template part like this:
action:
service: dyson.set_speed
data_template:
entity_id: fan.schlafzimmer
dyson_speed: "{{ trigger.to_state.state | int }}"
Thats it! Yes under developer tools everything was working fine. When I put the entity_id under data_template its working as it should.
This whole YAML thing still drives me crazy as I´ve never worked with it before
Thanks a lot for your help!
Normally it shouldn’t make a difference wheter you put it inside the data part or not, but there are some exceptions (like your example) where it needs to be inside the data part, I don’t know all the details and to be honest I don’t care because I don’t create my automations inside Home Assistant