-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathfan.yaml
76 lines (76 loc) · 2.44 KB
/
fan.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
- platform: template
fans:
living_room_ceiling_fan:
friendly_name: "Living Room Ceiling Fan"
value_template: "{{ states('light.living_room_ceiling_fan_fan') }}"
speed_template: >
{% if (state_attr('light.living_room_ceiling_fan_fan', 'brightness') // 85) == 1 %}
{{'Low'}}
{% endif %}
{% if (state_attr('light.living_room_ceiling_fan_fan', 'brightness') // 85) == 2 %}
{{'Medium'}}
{% endif %}
{% if (state_attr('light.living_room_ceiling_fan_fan', 'brightness') // 85) == 3 %}
{{'High'}}
{% endif %}
turn_on:
service: homeassistant.turn_on
entity_id: light.living_room_ceiling_fan_fan
turn_off:
service: homeassistant.turn_off
entity_id: light.living_room_ceiling_fan_fan
set_speed:
service: light.turn_on
entity_id: light.living_room_ceiling_fan_fan
data_template:
brightness: >
{% if speed == 'Low' %}
{{'85'}}
{% endif %}
{% if speed == 'Medium' %}
{{'170'}}
{% endif %}
{% if speed == 'High' %}
{{'255'}}
{% endif %}
speeds:
- 'Low'
- 'Medium'
- 'High'
office_ceiling_fan:
friendly_name: "Office Ceiling Fan"
value_template: "{{ states('light.office_ceiling_fan_fan') }}"
speed_template: >
{% if (state_attr('light.office_ceiling_fan_fan', 'brightness') // 85) == 1 %}
{{'Low'}}
{% endif %}
{% if (state_attr('light.office_ceiling_fan_fan', 'brightness') // 85) == 2 %}
{{'Medium'}}
{% endif %}
{% if (state_attr('light.office_ceiling_fan_fan', 'brightness') // 85) == 3 %}
{{'High'}}
{% endif %}
turn_on:
service: homeassistant.turn_on
entity_id: light.office_ceiling_fan_fan
turn_off:
service: homeassistant.turn_off
entity_id: light.office_ceiling_fan_fan
set_speed:
service: light.turn_on
entity_id: light.office_ceiling_fan_fan
data_template:
brightness: >
{% if speed == 'Low' %}
{{'85'}}
{% endif %}
{% if speed == 'Medium' %}
{{'170'}}
{% endif %}
{% if speed == 'High' %}
{{'255'}}
{% endif %}
speeds:
- 'Low'
- 'Medium'
- 'High'