Hello!
could you please help me to extract the temperature from my weather forecast entity?
I have researched before and added the following to my configuration.yaml:
# Temperature from entity
- platform: template
sensors:
norwegian_temperature:
friendly_name: "weather.dom"
unit_of_measurement: '°C'
value_template: "{{ state_attr('weather.dom', 'temperature') }}"
<>
In this example the “weather.dom” is the name of the entity, and “temperature” is the attribute.
Please use the </> button to format your code and paste in the section of the file again.
Your sensor from your code above will be called sensor.norwegian_temperature and will work if you use @Hellis81’s code (with the temperature typo fixed).
If, instead of norwegian_temperature, you use weather_hki, your sensor will be sensor.weather_hki which is as close as you can get. You can’t create a sensor under the weather domain.
This might come off as a stupid question, or one that is common programming knowledge, but I want to be able to extract a subset value from a nested array.
I’m working with a weather forecast entity that includes a 5 day weather forecast and would like to retrieve specific attribute values from it, rather than applying a pre-made weather card.