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

Alert sensor is not parsing data correctly #63

Open
Anwen747 opened this issue Mar 2, 2022 · 3 comments
Open

Alert sensor is not parsing data correctly #63

Anwen747 opened this issue Mar 2, 2022 · 3 comments

Comments

@Anwen747
Copy link

Anwen747 commented Mar 2, 2022

I recently updated to version 1.0.8 of the integration from an older version (pre 1.0). Today for the first time since I updated, an alert came up. The sensor for the alerts is not parsing the data correctly. I have description_english and description_local in the attributes. I am not sure why there are two description attributes as there is only one description field in the provided data.

Description string in original source data (shortened and with location redacted):

"description": "A period of snow will overspread xxxx xxxxx late\ntonight and early Thursday morning. Precipitation will likely be\nin the form of mainly rain [continues on, for several more sentences.]

In sensor.weatherbit_weather_alerts (with location redacted but not otherwise changed):

description_english: onight and early Thursday morning. Precipitation will likely be
description_local: ' period of snow will overspread xxxx xxxxx late'

In other words,

description_local is giving me the first several words of the description string. missing the first character. The string starts and ends with single quotes.

description_english is giving me several words of the description string continuing from where description_local left off, also missing a first character. The rest of the description (which is most of it) is missing. There are no quotation marks at the start or end of the string.

It looks as though the /n characters in the original string may be part of the problem. I have saved the the full text of the original data and a screenshot of the sensor.weatherbit_weather_alerts information from Developer-States in Home Assistant, if that would be helpful to you. I do not want to post it here as it contains personal information.

I see from the other open issue that you are unavailable for a time, so I am aware there will be a delay in your looking at this issue. Congratulations on your new home.

@briis
Copy link
Owner

briis commented Mar 21, 2022

Hi @Anwen747
I am almost up and running - a house move takes more time than I anticipated  😁.
The reason for the english and local description comes from the fact that in some countries the weather service supplies both a local language description and an english version, so I have tried to split the descriptions.

I now find that, depending on the Weather Authority, supplying the Weather Alerts, the format is different, so this gets complex.
Next time you have an alert, could you post here, and supply a city/country, so that I can get the raw text that weatherbit supplies. Then I will try and see if I can make this work, also for you.

@Anwen747
Copy link
Author

Hi @briis - Thanks for your response, hope all is going well with the new house. I have been using a different integration for the weather alerts (NWS Alerts) which is working well for me (I am located in the US). I can still provide the information you requested, if you like, but I would prefer not to post my actual location here.

@briis
Copy link
Owner

briis commented Mar 31, 2022

but I would prefer not to post my actual location here.

Fully understand that. I will look at the NWS and find a place with a weather alert to get some data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants