Advertisement
zubir2k

Home Assistant Sonoff iFan03 Setup

Aug 4th, 2021
1,104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.43 KB | None | 0 0
  1. ##########################
  2. ### configuration.yaml ###
  3. ##########################
  4.  
  5. input_number:
  6.   fan_speed:
  7.     name: Fan Speed
  8.     icon: mdi:fan
  9.     initial: 2
  10.     min: 1
  11.     max: 3
  12.     step: 1
  13.  
  14. sensor:
  15.   - platform: template
  16.     sensors:
  17.       fan_speed:
  18.         friendly_name: "Fan Speed"
  19.         value_template: >
  20.            {% if states.input_number.fan_speed.state == "1.0" %}low
  21.             {% elif states.input_number.fan_speed.state == "2.0" %}medium
  22.             {% elif states.input_number.fan_speed.state == "3.0" %}high
  23.             {% endif %}
  24.         icon_template: mdi:fan
  25.  
  26. #######################
  27. ### automation.yaml ###
  28. #######################
  29.  
  30. - id: '00'
  31.   alias: Fan Speed
  32.   description: ''
  33.   trigger:
  34.   - platform: template
  35.     value_template: '{{states.sensor.fan_speed.state == "low"}}'
  36.   - platform: template
  37.     value_template: '{{states.sensor.fan_speed.state == "medium"}}'
  38.   - platform: template
  39.     value_template: '{{states.sensor.fan_speed.state == "high"}}'
  40.   condition: []
  41.   action:
  42.   - service: fan.set_speed
  43.     data:
  44.       entity_id: fan.sonoff_0000xxxxxx
  45.       speed: '{{ trigger.to_state.state }}'
  46.   mode: single
  47.  
  48. ###########################  
  49. ### lovelace: dashboard ###
  50. ###########################  
  51.  
  52. type: entities
  53. entities:
  54.   - entity: fan.sonoff_0000xxxxxx
  55.   - entity: input_number.fan_speed
  56.   - entity: sensor.fan_speed
  57. title: Fan Control
  58. show_header_toggle: false
  59.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement