Closed Qhilm closed 9 months ago
I will integrate this for you in the next few days as a new sensor 😉
Just to be specific, I use both max and min forecasted temperatures for today, not just minimum as depicted in the sample code. Probably obvious, but just in case.
Ok, I have spent another thought about this and i think it is no good idea to implement this as a sensor in the integration. This will more or less counteract the newly introduced change in v2.
However, you can achive your request with this:
template:
- trigger:
- platform: time
at: "00:00:01"
- platform: homeassistant
event: start
- platform: event
event_type: event_template_reloaded
action:
- service: weather.get_forecast
data:
type: daily
target:
entity_id: {INSERT WEATHER ENTITY HERE}
response_variable: weather_data
sensor:
- name: "Max temp"
unique_id: max_daily_temp
state: >-
{{ weather_data.forecast[0].temperature }}
unit_of_measurement: "°C"
- name: "Min temp"
unique_id: min_daily_temp
state: >-
{{ weather_data.forecast[0].templow }}
unit_of_measurement: "°C"
Thanks a lot @FL550 .
I'm trying to understand the yaml you wrote: I do not see any reference to dwd_weather in there, am I right in thinking that the forecast in this code then comes from the built-in home assistant weather integration? It's not a problem, I just want to make sure I understand it.
[edit] there are two spaces missing at the start of the line - trigger:
, correct?
Hi! No, the data will come from whichever weather sensor you would like to use.
If you add a station to dwd_weather, it creates a weather entity with the name of the station in the format weather.station_name
. This entity has to be inserted in the part entity_id: {INSERT WEATHER ENTITY HERE}
from the snippet above.
That's strange, I cannot find this entity. I have 11 entities created by the "Deutscher Wetterdienst" integration, they all are of the type sensor.*
.
Does it matter if I choose "sensor only", "forecast only" etc. when configuring the entity?
ignore, I deleted it, re-added it and now I have 20 entities, including the weather.
entity. Don't know what happened.
Happy to hear
Version of home_assistant
2023.09.2
Version of the custom_component
2.0.1
Describe the bug
In previous version I used the code documented in closed issue #80
Question: how to rewrite this code for v2 of the integration? I'm struggling a bit.