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

Meteoalarm - multiple alerts #26

Open
EreNDern opened this issue Jun 20, 2022 · 10 comments
Open

Meteoalarm - multiple alerts #26

EreNDern opened this issue Jun 20, 2022 · 10 comments

Comments

@EreNDern
Copy link

Would it be possible to add all valid alerts to the attributes of the meteoalarm binary sensor?

@rolfberkenbosch
Copy link
Owner

@EreNDern I see that meteoalarm has changed their api and indeed they allow multiple alerts. That will be difficult by home assistant, because it expect 1 state and not multiple, so I need to think how we can merges multiple alerts to one.

@martkopecky
Copy link

martkopecky commented Aug 15, 2022

Because I also want to fetch all available alerts, I have created a modification which uses nested dictionary. Please find attached a diff, I will gladly publish it as a pull request.

image

I then store this nested dictionary in "output" attribute of my custom sensor and can do all the regular jinja magic to work with the statuses further.

@rolfberkenbosch
Copy link
Owner

Thanks for the research that you have done, can you submit this in a merge request ?

@martkopecky
Copy link

Well, I was reluctant to do it as it breaks backward compatibility for all users of the library and for all home assistant users...

@mdimjasevic
Copy link

mdimjasevic commented Mar 9, 2024

@rolfberkenbosch , can I help with getting support for multiple alerts?

I understand the backward compatibility concern. While meteoalert-api is a library and meteoalarm is a Home Assistant integration, the integration has only 6 reported users according to https://www.home-assistant.io/integrations/meteoalarm/. Therefore, if the backward compatibility is not maintained with this change, this would be an issue for very few people.

I use meteoalarm in Home Assistant and I'm very interested in having multiple alerts available, as it is not rare for my area to have multiple bad weather warnings at once. The benefit of having multiple alerts in my opinion outweighs the drawbacks of breaking the backward compatibility. Furthermore, the integration has the library version 0.3.0 pinned, so this is a no-issue for those not upgrading Home Assistant; their installation will keep on working as usual.

@MarekVigas
Copy link

Hey 👋🏻

I'm currently having problems with multiple alerts issued at the same time. At the moment there is high temperature and thunderstorm alert. The high temperature is during the day and the thunderstorm is expected during the night. My home assistant only gets the single thunderstorm warning. IMHO get_alert() should return the first alert ordered by onset attribute.

Screenshot 2024-06-21 at 08 55 59 Screenshot 2024-06-21 at 08 55 32 Screenshot 2024-06-21 at 09 01 05

@rubenlloria
Copy link

Maybe a solution would be to show the most extreme alert

@jjprz
Copy link

jjprz commented Nov 26, 2024

I don't use MeteoAlarmCard but it seems to be prepared for multiple warnings.
MrBartusek/MeteoalarmCard#221
I can review the integration code with Home Assistant and make the multiple warnings work everywhere. If not, I will make a custom component and show the multiple warnings in a homemade way because it is a must.

@martkopecky
Copy link

martkopecky commented Nov 26, 2024

The only actual solution is to fetch and return all alerts, the whole array. The display job on the HA end is then quite simple.

I've been running my custom version of the library for nearly 2 years now but have not found time or energy to move the changes upstream. Feel free to use the code I am attaching here for inspiration.

To me - the killer feature is to use regular expressions for filtering of the relevant locations.

I run it like this: meteoalarm.py -c 'czechia' -p '^středočeský kraj\s*$|^středočeský kraj\s*\(.*kladno.*\)\s*$' -l 'cs'

meteoalarm.txt

@jjprz
Copy link

jjprz commented Nov 26, 2024

Thank you very much @martkopecky. I will implement what you say if the changes to Home Assistant and meteoalert-api are not accepted. Here is the pull request: #34

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

7 participants