#Help with Temperature Automation
1 messages · Page 1 of 1 (latest)
I just want to get the temperature value of today's high temp
I'd do this in the visual editor, as I despise writing YAML, but apparently there is no way to create sensors in automations yet......for some reason
Hi @torpid fossil,
First it's really hard to help when the code is in picures like that.
I think that alias: tag is out of place, not connected to anything, but I can't tell much else.
Here is a pastebin of the automation in it's current form: https://pastebin.com/xueTpFwC
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
@torpid fossil To format your text as code, enter three backticks on the first line, press Enter for a new line, paste your code, press Enter again for another new line, and lastly three more backticks.
```yaml
example: here
```
Don't forget you can edit your post rather than repeatedly posting the same thing.
Yes. I previously used to use "{{ state_attr('weather.home', 'forecast')[0].temperature }}" to pull weather data into an automation, but since that's been removed, annoyingly, I'm trying to make a custom sensor that I can use to compare values in my automations.
Well start here...
https://www.home-assistant.io/docs/automation/basics/
Sensors: doesn't go in an automation, for starters.
You might want a template sensor, which is something completely different.
All I want is the high and low temperatures from today's forecast so I can use them in automations.
I've been banging my head against the docs off and on for months trying to figure this out
This should not be this hard.......
and the Template Sensor docs only show you how to do it by YAML, not by using the GUI, so I have no idea what to even enter for the Template data field
Based on the docs, it seemed like the ability to create sensors within an automation was added
Well that's not something I have done, but drop this in a search engine and I can see a bunch of people have in the forums.
site:community.home-assistant.io weather get temperature
..............
That's BC it a yaml only thing.
Then why is there a GUI option to add a Template Sensor?
Something new I haven't needed to use, so I don't know.
I can only help with what I know about. Someone else will probably drop in and write some code for you, let it cook here a bit,
Appreciate it
Not an expert, but does https://www.reddit.com/r/homeassistant/comments/1e0yl84/how_to_get_the_forecasted_high_for_today_within/ help?
Yeah I already saw that post. There is someone in there explaining about how weather.get_forecast service is how you're supposed to do it, but the docs don't explain how to do it and neither does the person that on that post, so.......
Well I added my stuff to a template.yaml and added it as an include in the configuration.yaml
Now I'm getting data for temperature, but it's the current temp.....not the forecasted temp
and templow is without value
If you're using Openweather, they hve a new api 3.0 that requires a CC to be attched, wonder if that provides that information(just guessing, no idea if thats the truth) you get 1000 API calls a day free
I'm not using OpenWeather. I'm using the built in Weather from Met.no
weather.forecast_home:
forecast:
- condition: sunny
datetime: "2024-11-18T18:00:00+00:00"
wind_bearing: 275.4
uv_index: 3.8
temperature: 81
templow: 62
wind_speed: 13.42
precipitation: 0
humidity: 19
The annoying thing is that the data is RIGHT THERE
OMG I finally got it. In case anyone else suffers like me at this:
trigger:
- platform: time_pattern
hours: /4
- platform: homeassistant
event: start
action:
- service: weather.get_forecasts
target:
entity_id: weather.forecast_home
data:
type: daily
response_variable: homeforecast
sensor:
- name: Today High Temperature
unique_id: today_high_temp
device_class: temperature
state: "{{ homeforecast['weather.forecast_home'].forecast[0].temperature }}"
unit_of_measurement: °F
- name: Today Low Temperature
unique_id: today_low_temp
device_class: temperature
state: "{{ homeforecast['weather.forecast_home'].forecast[0].templow }}"
unit_of_measurement: °F
Then just use the two variables today_low_temp and today_high_temp to set your automations for Above or Below those values.
congrats!