-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsensors.yaml
169 lines (152 loc) · 6.18 KB
/
sensors.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
163
164
165
166
167
168
169
- platform: rest
name: "weatherxm_sensor"
resource: https://api.weatherxm.com/api/v1/cells/********/devices
scan_interval: 300
value_template: "{{ value_json.value }}"
json_attributes_path: $.[0].current_weather
json_attributes:
- temperature
- feels_like
- humidity
- icon
- precipitation
- pressure
- uv_index
- wind_direction
- wind_gust
- wind_speed
- platform: template
sensors:
weatherxm_temperature_celsius:
value_template: "{{ state_attr('sensor.weatherxm_sensor', 'temperature')|round(2)}}"
device_class: temperature
unit_of_measurement: "°C"
- platform: template
sensors:
weatherxm_temperature_fahrenheit:
value_template: "{{ (state_attr('sensor.weatherxm_sensor', 'temperature') * 9/5 + 32) |round(1)}}"
device_class: temperature
unit_of_measurement: "°C"
- platform: template
sensors:
weatherxm_feels_like_fahrenheit:
value_template: "{{ (state_attr('sensor.weatherxm_sensor', 'feels_like') * 9/5 + 32) |round(1)}}"
device_class: temperature
unit_of_measurement: "°C"
- platform: template
sensors:
weatherxm_feels_like_celsius:
value_template: "{{ state_attr('sensor.weatherxm_sensor', 'feels_like')|round(2)}}"
device_class: temperature
unit_of_measurement: "°C"
- platform: template
sensors:
weatherxm_humidity:
value_template: "{{ state_attr('sensor.weatherxm_sensor', 'humidity')|round(2)}}"
device_class: humidity
unit_of_measurement: "°%"
- platform: template
sensors:
weatherxm_wind_speed_kmh:
value_template: "{{ (state_attr('sensor.weatherxm_sensor', 'wind_speed') |float * 3.6) |round(2) }}"
unit_of_measurement: "km/h"
- platform: template
sensors:
weatherxm_wind_gust_kmh:
value_template: "{{ (state_attr('sensor.weatherxm_sensor', 'wind_gust') |float * 3.6) |round(2) }}"
unit_of_measurement: "km/h"
- platform: template
sensors:
weatherxm_weather_condition:
value_template: >
{% set state = state_attr('sensor.weatherxm_sensor', 'icon') %}
{% if state == 'partly-cloudy-night' %} Partly cloudy
{% elif state == 'partly-cloudy-day' %} Partly cloudy
{% elif state == 'cloudy-night' %} Cloudy
{% elif state == 'cloudy-day' %} Cloudy
{% elif state == 'sunny' %} Sunny
{% elif state == 'drizzle' %} Rainy
{% elif state == 'rainy' %} Rainy
{% elif state == 'rain' %} Rainy
{% elif state == 'unavailable' %} -
{% elif state == 'Unavailable' %} -
{% elif state == 'unknown' %} -
{% elif state == 'Unknown' %} -
{% endif %}
- platform: template
sensors:
weatherxm_icon:
friendly_name: 'weatherxm icon'
value_template: >
{% set state = state_attr('sensor.weatherxm_sensor', 'icon') %}
{% if state == 'partly-cloudy-night' %} mdi:weather-night-partly-cloudy
{% elif state == 'partly-cloudy-day' %} mdi:weather-partly-cloudy
{% elif state == 'cloudy-night' %} mdi:weather-night-partly-cloudy
{% elif state == 'cloudy-day' %} mdi:weather-cloudy
{% elif state == 'sunny' %} mdi:weather-sunny
{% elif state == 'drizzle' %} mdi:weather-pouring
{% elif state == 'rainy' %} mdi:weather-pouring
{% elif state == 'rain' %} mdi:weather-pouring
{% elif state == 'unavailable' %} mdi:reload
{% elif state == 'Unavailable' %} mdi:reload
{% elif state == 'unknown' %} mdi:reload
{% elif state == 'Unknown' %} mdi:reload
{% endif %}
- platform: template
sensors:
weatherxm_icon_color:
friendly_name: 'weatherxm icon color'
value_template: >
{% set state = state_attr('sensor.weatherxm_sensor', 'icon') %}
{% if state == 'partly-cloudy-night' %} blue-grey
{% elif state == 'partly-cloudy-day' %} white
{% elif state == 'cloudy-night' %} blue-grey
{% elif state == 'cloudy-day' %} white
{% elif state == 'sunny' %} yellow
{% elif state == 'drizzle' %} blue
{% elif state == 'rainy' %} blue
{% elif state == 'rain' %} blue
{% elif state == 'unavailable' %} grey
{% elif state == 'Unavailable' %} grey
{% elif state == 'unknown' %} grey
{% elif state == 'Unknown' %} grey
{% endif %}
- platform: template
sensors:
weatherxm_pressure_hpa:
value_template: "{{ state_attr('sensor.weatherxm_sensor', 'pressure')|round(0)}}"
device_class: pressure
unit_of_measurement: "°hPa"
- platform: template
sensors:
weatherxm_wind_speed_mph:
value_template: "{{ (state_attr('sensor.weatherxm_sensor', 'wind_speed') |float / 1.60934) |round(2) }}"
unit_of_measurement: "mph"
- platform: template
sensors:
weatherxm_wind_gust_mph:
value_template: "{{ (state_attr('sensor.weatherxm_sensor', 'wind_gust') |float / 1.60934) |round(2) }}"
unit_of_measurement: "mph"
- platform: template
sensors:
weatherxm_wind_direction:
value_template: "{{ state_attr('sensor.weatherxm_sensor', 'wind_direction')}}"
unit_of_measurement: "°"
- platform: template
sensors:
weatherxm_wind_direction_cardinal:
value_template: >
{% set direction = ['N','NNE','NE','ENE','E','ESE','SE','SSE','S','SSW','SW','WSW','W','WNW','NW','NNW','N'] %}
{% set degree = states('sensor.weatherxm_wind_direction')|float %}
{{ direction[((degree+11.25)/22.5)|int] }}
- platform: template
sensors:
weatherxm_precipitation:
value_template: "{{ state_attr('sensor.weatherxm_sensor', 'precipitation')}}"
device_class: precipitation_intensity
unit_of_measurement: "mm/h"
- platform: template
sensors:
weatherxm_uv_index:
value_template: "{{ state_attr('sensor.weatherxm_sensor', 'uv_index')}}"
unit_of_measurement: "UV Index"