-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHA_config.yaml
162 lines (159 loc) · 4.59 KB
/
HA_config.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#Add the following lines to the end of configuration.yaml
input_text:
post_url:
initial: "http://<ESP32_IP_ADDR>/api/controls"
rest_command:
fan_level_change:
url: "{{states('input_text.post_url')}}"
method: POST
content_type: 'application/json'
payload: '{"set_fan": {{ fan_level }}}'
auto_mode_on:
url: "{{states('input_text.post_url')}}"
method: POST
content_type: 'application/json'
payload: '{"attributes": "auto_mode_on"}'
auto_mode_off:
url: "{{states('input_text.post_url')}}"
method: POST
content_type: 'application/json'
payload: '{"attributes": "auto_mode_off"}'
night_mode:
url: "{{states('input_text.post_url')}}"
method: POST
content_type: 'application/json'
payload: '{"attributes": "night_mode"}'
flow_direction:
url: "{{states('input_text.post_url')}}"
method: POST
content_type: 'application/json'
payload: '{"attributes": "direction"}'
rotation_mode:
url: "{{states('input_text.post_url')}}"
method: POST
content_type: 'application/json'
payload: '{"attributes": "sw_rotation"}'
info_change:
url: "{{states('input_text.post_url')}}"
method: POST
content_type: 'application/json'
payload: '{"attributes": "info"}'
led_change:
url: "{{states('input_text.post_url')}}"
method: POST
content_type: 'application/json'
payload: '{"set_led_mode": {{ led_mode }}}'
#my sensor
switch:
- platform: rest
resource: http://<ESP32_IP_ADDR>/api/controls
method: post
name: Dysonswitch
body_on: >
{% if is_state('switch.dysonswitch','off') %}
{"attributes": "on_off"}
{% endif %}
body_off: >
{% if is_state('switch.dysonswitch','on') %}
{"attributes": "on_off"}
{% endif %}
state_resource: http://<ESP32_IP_ADDR>/api/states/sensors
is_on_template: >-
{% if value_json.state == 1 %} True
{% else %} False
{% endif %}
scan_interval: 5
- platform: template
switches:
dysons_witch:
friendly_name: "Air purifier power"
value_template: "{{is_state('switch.dysonswitch','on')}}"
turn_on:
service: switch.turn_on
target:
entity_id: switch.dysonswitch
turn_off:
service: switch.turn_off
target:
entity_id: switch.dysonswitch
dyson_auto_mode:
friendly_name: "Auto mode"
turn_on:
service: rest_command.auto_mode_on
turn_off:
service: rest_command.auto_mode_off
sensor:
- platform: rest
name: DysonDevice
json_attributes:
- state
- temperature
- humidity
- vent_level
- pm25_level
- pm10_level
resource: http://<ESP32_IP_ADDR>/api/states/sensors
value_template: "{{ value_json}}"
scan_interval: 5
- platform: template
sensors:
state:
friendly_name: "On/off State"
unique_id: "Dyson_state"
value_template: "{{'On' if state_attr('sensor.dysondevice', 'state')|int>0 else 'Off'}}"
temperature:
friendly_name: "Temperature"
unique_id: "Dyson_temp"
value_template: "{{ state_attr('sensor.dysondevice', 'temperature') }}"
device_class: temperature
unit_of_measurement: "°C"
humidity:
unique_id: "Dyson_hum"
friendly_name: "Humidity"
value_template: "{{ state_attr('sensor.dysondevice', 'humidity') }}"
device_class: humidity
unit_of_measurement: "%"
fan_level:
unique_id: "Dyson fan level"
friendly_name: "Fan level"
value_template: "{{ state_attr('sensor.dysondevice', 'vent_level') }}"
device_class: wind_speed
unit_of_measurement: " lv"
pm25_level:
unique_id: "Dyson pm25 level"
friendly_name: "pm2.5 level"
value_template: "{{ state_attr('sensor.dysondevice', 'pm25_level') }}"
device_class: pm25
unit_of_measurement: "µg/m³"
pm10_level:
unique_id: "Dyson pm10 level"
friendly_name: "pm10 level"
value_template: "{{ state_attr('sensor.dysondevice', 'pm10_level') }}"
device_class: pm10
unit_of_measurement: "µg/m³"
input_number:
number1:
name: "Fan level"
initial: 1
min: 1
max: 10
step: 1
input_button:
direction_btn:
name: Flow direction
icon: mdi:waves-arrow-right
night_btn:
name: Night mode
icon: mdi:weather-night
rotation_btn:
name: Rotation
icon: mdi:axis-z-rotate-counterclockwise
input_select:
led_mode:
name: Onboard Led Mode
options:
- "Off"
- "On"
- "Blink"
initial: "Blink"
icon: mdi:led-on