Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *****OBS, skall ligga under template: ******
- #SMHI forecast sensorer
- - trigger:
- - trigger: time_pattern
- hours: "/1" # Uppdatera varje timme
- - trigger: homeassistant
- event: start # Uppdatera vid omstart
- action:
- # 1. Hämta Dygnsprognos (Daily)
- - action: weather.get_forecasts
- data:
- type: daily
- target:
- entity_id: weather.smhi_home
- response_variable: daily_data
- # 2. Hämta Timprognos (Hourly)
- - action: weather.get_forecasts
- data:
- type: hourly
- target:
- entity_id: weather.smhi_home
- response_variable: hourly_data
- sensor:
- # --- SENSOR 1: IDAG (Dygn) ---
- - name: "SMHI Idag"
- unique_id: smhi_home_today
- icon: mdi:calendar-today
- state: >
- {{ daily_data['weather.smhi_home'].forecast[0].condition }}
- attributes:
- temp_max: >
- {{ daily_data['weather.smhi_home'].forecast[0].temperature }}
- temp_min: >
- {{ daily_data['weather.smhi_home'].forecast[0].templow }}
- nederbord: >
- {{ daily_data['weather.smhi_home'].forecast[0].precipitation }}
- vindhastighet: >
- {{ daily_data['weather.smhi_home'].forecast[0].wind_speed }}
- vindriktning: >
- {{ daily_data['weather.smhi_home'].forecast[0].wind_bearing }}
- luftfuktighet: >
- {{ daily_data['weather.smhi_home'].forecast[0].humidity }}
- datum: >
- {{ daily_data['weather.smhi_home'].forecast[0].datetime }}
- # --- SENSOR 2: IMORGON (Dygn) ---
- - name: "SMHI Imorgon"
- unique_id: smhi_home_tomorrow
- icon: mdi:calendar-arrow-right
- state: >
- {{ daily_data['weather.smhi_home'].forecast[1].condition }}
- attributes:
- temp_max: >
- {{ daily_data['weather.smhi_home'].forecast[1].temperature }}
- temp_min: >
- {{ daily_data['weather.smhi_home'].forecast[1].templow }}
- nederbord: >
- {{ daily_data['weather.smhi_home'].forecast[1].precipitation }}
- vindhastighet: >
- {{ daily_data['weather.smhi_home'].forecast[1].wind_speed }}
- vindriktning: >
- {{ daily_data['weather.smhi_home'].forecast[1].wind_bearing }}
- luftfuktighet: >
- {{ daily_data['weather.smhi_home'].forecast[1].humidity }}
- datum: >
- {{ daily_data['weather.smhi_home'].forecast[1].datetime }}
- # --- SENSOR 3: NÄSTA TIMME (Hourly) ---
- - name: "SMHI Nästa Timme"
- unique_id: smhi_home_next_hour
- icon: mdi:clock-outline
- state: >
- {{ hourly_data['weather.smhi_home'].forecast[0].condition }}
- attributes:
- temperatur: >
- {{ hourly_data['weather.smhi_home'].forecast[0].temperature }}
- nederbord: >
- {{ hourly_data['weather.smhi_home'].forecast[0].precipitation }}
- vindhastighet: >
- {{ hourly_data['weather.smhi_home'].forecast[0].wind_speed }}
- # Hämtar alla timmar
- alla_timmar: >
- {{ hourly_data['weather.smhi_home'].forecast }}
Advertisement
Add Comment
Please, Sign In to add comment