How do you use forecast data today?

Hi, all.

I have been working on this for weeks now, and am no closer to having it done. Does anyone have working weather forecast code that works with today’s ESPHome and HA?

I’m trying to build a weather forecast display. I’ll worry about how to display it… I am currently stuck trying to get the data.

There are countless people who put some YAML code somewhere in HA that then creates variables in HA that ESPHome then reads. I have never gotten any of these to work, so either I am doing it incorrectly, or those methods are no longer supported.

I am able to manually create states in HA and then read those in ESPHome. What I want to do is have a state dynamically generated that I can read in ESPHome.

I have tried reading HA and ESPHome documentation, but it is extremely difficult to read because it assumes a lot of knowledge that I don’t have yet. And, the documentation uses a lot of ellipses, and I don’t know what they’re skipping, and I don’t understand how to take the information given and build a solution from it. A “Hello World” type example would go a long way here.

Does anyone have a “Hello world” program here?

To be clear: I can take individual variables out of the weather data – I can get the current conditions, no problem. I am trying to get forecast data, but there does not seem to be a way to process the forecast array in ESPHome, so it has to be processed in HA and then sent to ESPHome via a text string or other variable(s). This is the part that I cannot get working.

Can anyone please help?

Here is one of the methods I have tried: Esphome help with nested attribute in homeassistant

In that thread, user tom_l presents a solution that would work, but gives no details about it. Anybody know how to do what he is saying? I mean: How do I split it up in ESPHome?

Thanks so much for any and all assistance.

Here is another thing I have tried:

I added the sensor code to my /homeassistant/configuration.yaml file, but whenever I do this, I was getting an error that sensor was not supported. I just retried it, and now I don’t get an error, but I also don’t get any value in sensor.weather_fivedays.

This weater display works, I built it less than a month ago using the sample code and yaml:

The example also works also for lcd, assuming you set the right display type and parameters.

Thanks – I don’t know what’s different today versus all other recent attempts, but it is working today.

I now get a value of Mon;38-49°;0.33in;sunny#Tue;31-51°;0.0in;sunny#Wed;36-56°;0.0in;cloudy# for sensor.weather_fivedays.

I have absolutely no idea what is different today, but I am glad to have gotten it to work finally.

And, thanks for that link – that project is one that I want to replicate, and is how I got started trying to do all this.

Today I have an m5stack, and will display on that one at first. I’ll buy an e-ink display soon.

But, now that I have the data, I will be able to make progress.

Thanks so much for all your help.

Now I have it displaying to my m5stack. Thank you, @Edwin_D !

Now to make it look pretty. This here is just demonstrating that I have the data.

One thing I need to do is turn down the update frequency – it updates every second right now. Once an hour is more than sufficient.

1 Like

@Edwin_D How do you limit the update frequency of your sensor?

My sensor is:

sensor:
  - platform: template
    sensors:
      wx_forecast:
        friendly_name: "Local forecast"
        value_template: >-

(actual code is the common code posted elsewhere)

I think this is updating every second, and met.no has blocked me from updates.

I have looked around and tried a few things, but nothing is working to limit the update frequency.

How can I set this to once an hour?

Thanks.

The answer is in the code for the weatherman display I linked you to a few posts higher sensor. It uses a time based trigger. The top part looks like this:

- trigger:
      platform: time_pattern
      minutes: "/1"
    sensor:
      - name: Weatherman Data
        state: .....