MrBartusek / MeteoalarmCard

Meteoalarm, Météo-France and DWD severe weather warnings card for Home Assistant Lovelace UI ⛈️
MIT License
129 stars 46 forks source link

Error: Failed to match one of the known prefixes to alert name! #237

Closed Khayrisill closed 2 months ago

Khayrisill commented 6 months ago

Describe the bug

Environnement Canada issued an advisory but it not correctly reported to the Meteoalarm card.

Not sure if this is coming from environment Canada or something went wrong with the card.

Error: Failed to match one of the known prefixes to alert name! Was looking for [ "Avis De" ] and failed (isFrench=true)
name: Meteoalarm
type: custom:meteoalarm-card
integration: env_canada
entities:
  - entity: sensor.chambly_advisory
  - entity: sensor.chambly_statements
  - entity: sensor.chambly_watches
  - entity: sensor.chambly_warnings
scaling_mode: headline_and_scale
hide_when_no_warning: false
disable_swiper: true

Integration state attributes


location: Carignan
station: Aéroport de Saint-Hubert
alert_1: Avis Météorologique
alert_time_1: 06 janvier 2024 21h56 HNE
attribution: Données fournies par Environnement Canada
icon: mdi:bell-alert
friendly_name: Chambly Advisory

Screenshots

Screenshot_2024-01-06-22-47-18-333_io homeassistant companion android-edit

Card version

V2.5.4

Installation type

Home Assistant Community Store (HACS)

Card Configuration

name: Meteoalarm type: custom:meteoalarm-card integration: env_canada entities:

Integration type

Environnement Canada

Integration configuration

YAML (configuration.yaml)

Integration Configuration

No response

kayrozen commented 3 months ago

I have the same error right now. Seems like this is in lines 190-215 of env_canada.ts

it should have also :

like the "Veille D'" on line 202.

I cannot PR right now but if someone can, i think it would fix it.


private get entityTypeTranslation(): { en: string[]; fr: string[]; type: EnvCanadaEntityType }[] {
        // English from: https://www.canada.ca/en/environment-climate-change/services/types-weather-forecasts-use/public/criteria-alerts.html
        // French from : https://www.canada.ca/fr/environnement-changement-climatique/services/types-previsions-meteorologiques-utilisation/publiques/criteres-alertes-meteo.html
        return [
            {
                type: EnvCanadaEntityType.Warning,
                en: ['Warning'],
                fr: ['Avertissement De', "Avertissement D'"],
            },
            {
                type: EnvCanadaEntityType.Watch,
                en: ['Watch'],
                fr: ['Veille De', "Veille D'"],
            },
            {
                type: EnvCanadaEntityType.Statement,
                en: ['Statement'],
                fr: ['Bulletin'],
            },
            {
                type: EnvCanadaEntityType.Advisory,
                en: ['Advisory'],
                fr: ['Avis De', "Avis D'"],
            },
        ];
    }
MrBartusek commented 2 months ago

Hey, can you guys help me understand this? Is Avis Météorologique like a general not-specific alert?

If that's the cause we would also need to map Météorologique to a unknown alert

kayrozen commented 2 months ago

Hey, can you guys help me understand this? Is Avis Météorologique like a general not-specific alert?

If that's the cause we would also need to map Météorologique to a unknown alert

yes it is

MrBartusek commented 2 months ago

Thank you guys :heart: This will be a part of v2.7.0