Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Home Assistant new Get weather forecast service #137

Closed
markmghali opened this issue Sep 7, 2023 · 30 comments
Closed

Home Assistant new Get weather forecast service #137

markmghali opened this issue Sep 7, 2023 · 30 comments

Comments

@markmghali
Copy link

Hello,

Thank you for all your work on this. Home Assistant has created a new service in the latest release 2023.9 called weather.get_forecast. Can please update the home assistant integration to reflect this change?

Thank you Again

image

@alexander0042
Copy link
Collaborator

Thanks for pointing it out! HA just revamped their whole weather approach, and while it's considerably better, it's also a major change. I'm going to work on integrating it in the next couple months, but I'm just waiting for some other integrations to be updated so I can use them as reference first.

@alexander0042
Copy link
Collaborator

Since this is a HA specific issue, I'm also going to transfer this over to that repo, but I'll keep you updated there with progress!

@alexander0042 alexander0042 transferred this issue from Pirate-Weather/pirateweather Sep 7, 2023
@dmbreakey
Copy link

You might be interested to know that AstroWeather recently updated their integration to support the new service mode.

@langestefan
Copy link

Since this is a HA specific issue, I'm also going to transfer this over to that repo, but I'll keep you updated there with progress!

FYI, this is still broken and will break the integration completely in a few months.

pirateweather::PirateWeather implements the forecast property or sets self._attr_forecast in a subclass of WeatherEntity, this is deprecated and will be unsupported from Home Assistant 2024.3. Please create a bug report at https://github.com/alexander0042/pirate-weather-ha/issues

@alexander0042
Copy link
Collaborator

Fixed in v1.3! It's listed a pre-release at the moment, but assuming there aren't any showstopping bugs I'll push it public next week!
Since there's already discussion of this in #136, I'm going to close this issue for now. Feel free to reply there about any problems though!

@markmghali
Copy link
Author

upgraded to 1.3 and it fails to load now.

image

@alexander0042
Copy link
Collaborator

Ok, well that's not good, but why I pushed this as a pre-release! Anything in the logs here?

@alexander0042 alexander0042 reopened this Nov 14, 2023
@mermelmadness
Copy link

Mine is working, but I don't see the forecast entities.
image
image

@markmghali
Copy link
Author

I thought you were looking for testing? I am not seeing anything in the logs from what I can tell

@alexander0042
Copy link
Collaborator

@markmghali , very much looking for testing, so I appreciate this report!
@mermelmadness , good to know your update worked. The only change to the user side of this if you see both the daily an hourly forecasts for the weather entity on the dashboard, There shouldn't be any changes to the sensors at all

@mermelmadness
Copy link

mermelmadness commented Nov 14, 2023

Well, yes, it works, but the old attribute sensors for forecast are gone. This is expected with the new changes to weather integrations, but I thought that they would populate as individual sensors or entities with their own attributes. I did add 0,1,2,3,4,5,6,7 to the configuration of the Sensors portion and I see them there with good data. But missing are the forecast condition and temperatures, even though they are listed (unless I'm looking in the wrong place).

image
image
image

I can still see the forecast in the GUI.

image

@alexander0042
Copy link
Collaborator

Alas, they won't populate on their own unless sensors are selected. This is a bit of a controversial decision: https://community.home-assistant.io/t/petition-dont-delete-the-forecast-attribute/609298, but seems set in stone, so such is life.

However, if you add those sensors in, they should show up! Can you try only using the temperature and condition sensors?

@alexander0042
Copy link
Collaborator

Note that for daily sensors, you need to use "Temperature High" and "Temperature Low". Maybe I should document this better in the config? i.e. having "daily monitored conditions" and "hourly monitored conditions"

@mermelmadness
Copy link

Note that for daily sensors, you need to use "Temperature High" and "Temperature Low". Maybe I should document this better in the config? i.e. having "daily monitored conditions" and "hourly monitored conditions"

Ahh, yes, I selected those to be safe and they are now appearing, though it's annoying that I have to manually remove the sensors that I disabled (not your fault, just HA being HA). I think this looks good, though now I have to go through a lot of automations and modify my MQTT scripts:

service: mqtt.publish
data:
  topic: wled/Weather/api
  payload: >-
    {"seg":[{"id":6,"n":"{{state_attr('weather.pirateweather','forecast')[1].temperature}}/{{state_attr('weather.pirateweather','forecast')[1].templow}}"}]}

@alexander0042
Copy link
Collaborator

Yea, I'd love to find a way to git rid of them automatically, but I couldn't figure it out!

@alexander0042
Copy link
Collaborator

Ideally I would base this off some other integration that creates sensors and allows them to be configured, but I couldn't find one that works. Also agree that this is going to be a big change, so not thrilled about the amount of work you'll have to go though. I don't know if there's a way around it though, and judging by the comments on that link I don't know if there is any other option other than sensors

@mermelmadness
Copy link

mermelmadness commented Nov 14, 2023

Yea, I'd love to find a way to git rid of them automatically, but I couldn't figure it out!

No worries, and I figured out the MQTT command conversion relatively easily.

OLD:

service: mqtt.publish
data:
  topic: wled/Weather/api
  payload: >-
    {"seg":[{"id":5,"n":"{{state_attr('weather.pirateweather','forecast')[0].temperature}}/{{state_attr('weather.pirateweather','forecast')[0].templow}}"}]}

NEW:

service: mqtt.publish
data:
  topic: wled/Weather/api
  payload: >-
    {"seg":[{"id":5,"n":"{{states('sensor.pirateweather_daytime_high_temperature_0d') | round(0) }}/{{states('sensor.pirateweather_overnight_low_temperature_0d') | round(0) }}"}]}

@mermelmadness
Copy link

Ahh, one thing missing was in the old forecast attribute it gave the date of the forecasted day. The new sensors lack that. I'll have to figure out something else, then, to get the actual date of the forecasted day instead of just 2d or 5d

I used it in this script:

service: mqtt.publish
data:
  topic: wled/Misc/api
  payload: >-
    {"seg":[{"id":0,"n":"{{
    (state_attr('weather.pirateweather','forecast')[2].datetime)[:10] |
    regex_replace('^(\\d{4})-(\\d{2})-(\\d{2})$', '\\2/\\3')}}"}]}

@alexander0042
Copy link
Collaborator

Would it help to have a "time" sensor that provided the datetime for something? So there would be a "time_2d" sensor with a datetime value?

@mermelmadness
Copy link

Yes, that would definitely help. I was going to see about populating those segments in my panel with dates from HA directly, but if it can be synced with PirateWeather summary conditions that would be best.

@alexander0042
Copy link
Collaborator

Great. They're easy enough to add in, so I'll push a 3.0.1 that adds them as an option

@mermelmadness
Copy link

mermelmadness commented Nov 14, 2023

Thank you.

A note to others making the change over. The verbiage of the old condition attribute, which is now called summary or daily_summary has changed slightly:

sunny is now Clear
rainy is now Rain
cloudy is now Cloudy
partlycloudy is now Partly Cloudy

Dunno about snow, fog, or stormy as it's not cold enough yet.

@alexander0042
Copy link
Collaborator

I think icon should give you the previous values- the summary will one day be a text summary, while icon is meant for more machine readable stuff

@mermelmadness
Copy link

I think icon should give you the previous values- the summary will one day be a text summary, while icon is meant for more machine readable stuff

Hmm, interesting. The icon entities seems like it lines up with the MDI versions. Will have to observe for a while to see which would work best.

@mermelmadness
Copy link

mermelmadness commented Nov 14, 2023

Sorry, side question. Since this YAML configuration is now deprecated, where can we set the scan interval, or does it just default and hard code to 15 minutes?

  - platform: pirateweather
    api_key: <API KEY>
    scan_interval: '00:02:15'
    monitored_conditions:
      - temperature
      - precip_probability
      - precip_type
      - humidity
      - cloud_cover
      - nearest_storm_distance
      - precip_intensity
      - wind_speed

@alexander0042
Copy link
Collaborator

Good question, another thing I should add to the docs. It imports it in from the yaml, so if it's in there you should be good to go. Otherwise you can set it when you first create the integration from the GUI. I don't believe there's a way to change it after the fact, but I can look into this

@mermelmadness
Copy link

mermelmadness commented Nov 14, 2023

Just installed v1.3.1. Not sure what to make of this time entity value. It's not in Unix format or NPT.

image

@FARKIr

This comment was marked as off-topic.

@onedr0p

This comment was marked as off-topic.

@cloneofghosts
Copy link
Collaborator

Stable version released. Thank you to everyone who tested the pre-release version.

@github-project-automation github-project-automation bot moved this from In Progress to Done in Pirate Weather Home Assistant Nov 28, 2023
@Pirate-Weather Pirate-Weather locked and limited conversation to collaborators Jan 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Development

No branches or pull requests

8 participants