Flow Details
- You need to create a sensor in the configuration.yaml file or add a link to the file where the weather icons code change sensor is written. In my case, I added the following lines to the configuration.yaml:
homeassistant:
packages: !include_dir_merge_named includes/packages
Place the name_icon_weather_sensor.yaml file in the packages folder. In the name_icon_weather_sensor.yaml file, You have to change the name of your weather sensor, mine is called weather.forecast_golovna.
-
Create your automation. I added my automation to the automations.yaml file. In this file, set your AWTRIX MQTT prefix in topic: instead of awtrix_565c3c. You have to change the name of your weather sensor, mine is called weather.forecast_golovna.
-
Do not forget to download the icons mentioned in the project.
If you have any questions, please contact me on Discord at megadimich.
1. File name_icon_weather_sensor.yaml:
name_icon_weather_sensor:
sensor:
- platform: template
sensors:
name_icon_weather:
friendly_name: 'name icon weather'
value_template: >
{% if is_state('weather.forecast_golovna', 'clear-night') %}12181
{% elif is_state('weather.forecast_golovna', 'cloudy') %}53384
{% elif is_state('weather.forecast_golovna', 'exceptional') %}56705
{% elif is_state('weather.forecast_golovna', 'fog') %}17055
{% elif is_state('weather.forecast_golovna', 'hail') %}53288
{% elif is_state('weather.forecast_golovna', 'lightning') %}50231
{% elif is_state('weather.forecast_golovna', 'lightning-rainy') %}49299
{% elif is_state('weather.forecast_golovna', 'partlycloudy') %}53802
{% elif is_state('weather.forecast_golovna', 'pouring') %}49300
{% elif is_state('weather.forecast_golovna', 'rainy') %}2284
{% elif is_state('weather.forecast_golovna', 'snowy') %}2289
{% elif is_state('weather.forecast_golovna', 'snowy-rainy') %}49301
{% elif is_state('weather.forecast_golovna', 'sunny') %}2282
{% elif is_state('weather.forecast_golovna', 'windy') %}55032
{% else %}2422
{% endif %}
2. File automations.yaml:
- id: '1702989107888'
alias: 'AWTRIX Meteorologisk institutt (Met.no)'
description: ''
trigger:
- platform: time_pattern
minutes: /5
condition: []
action:
- service: mqtt.publish
data:
qos: '0'
retain: false
topic: awtrix_565c3c/custom/weather1
payload: "{ \"text\": \"{{ state_attr('weather.forecast_golovna','temperature')
}}{{ state_attr('weather.forecast_golovna','temperature_unit') }}\",\n \"icon\":
\"{{ states('sensor.name_icon_weather') }}\",\n \"repeat\": 2,\n \"duration\":
5\n }"
- service: mqtt.publish
data:
qos: '0'
retain: false
topic: awtrix_565c3c/custom/weather2
payload: '{ "text": "{{ state_attr(''weather.forecast_golovna'', ''humidity'')
}}%", "icon": "2423", "repeat": 2, "duration": 5 }'
- service: mqtt.publish
data:
qos: '0'
retain: false
topic: awtrix_565c3c/custom/weather3
payload: '{ "text": "{{ state_attr(''weather.forecast_golovna'', ''pressure'')
| round(0)}}{{ state_attr(''weather.forecast_golovna'', ''pressure_unit'')[:3]
}}", "textCase": 2, "icon": "39912", "repeat": 2, "duration": 5 }'
- service: mqtt.publish
data:
qos: '0'
retain: false
topic: awtrix_565c3c/custom/weather4
payload: '{ "text": "{{ state_attr(''weather.forecast_golovna'', ''wind_speed'')
|round(0) }}{{ state_attr(''weather.forecast_golovna'', ''wind_speed_unit'')}}",
"textCase": 2, "icon": "55032", "repeat": 2, "duration": 5 }'
mode: single
-- Flow first published on January 20, 2024.