Closed mdallaire closed 1 year ago
Hey, thanks for the repport! Can you open developer tools and send entity attributes in yaml form?
Here is the attributes for the warning.
location: XYZ
station: Aéroport int. de Montréal-Mirabel
alert_1: Avertissement De Chaleur
alert_time_1: 19 juillet 2022 15h40 HAE
attribution: Données fournies par Environnement Canada
icon: mdi:alert-octagon
friendly_name: envcan Warnings
I poked at the code a bit and I think the issue is that the attribution is in French in my configuration. When you configure the integration you can chose between French and English and obtain the information in the chosen language from Environment Canada.
Looking at it even more it looks like the whole thing would need to be translated. If you want I could do a PR with a new integration env_canada_fr.ts which would be the exact same as the original but with the French strings. I am no python expert so there may be a more elegant way of doing this too. Just let me know and I can take care of the translation if you need help.
@mdallaire Yeah I thought this was the case. You shouldn't really make a different integration just edit this if statement you've linked. Let me know If you want to work on this!
I translated the eventTypes section by simply adding the french strings for the various types. However I have no idea on how to add the 'Données fournies par Environnement Canada' to the existing logic.
// From: https://www.canada.ca/fr/environnement-changement-climatique/services/types-previsions-meteorologiques-utilisation/publiques/criteres-alertes-meteo.html
'Poussée d’air arctique': MeteoalarmEventType.SnowIce,
// Same as English 'Blizzard': MeteoalarmEventType.SnowIce,
'Poudrerie': MeteoalarmEventType.SnowIce,
'Tempête de poussière': MeteoalarmEventType.Dust,
'Froid extrême': MeteoalarmEventType.LowTemperature,
'Refroidissement soudain': MeteoalarmEventType.SnowIce,
'Brouillard': MeteoalarmEventType.Fog,
'Bruine verglaçante': MeteoalarmEventType.SnowIce,
'Pluie verglaçante': MeteoalarmEventType.SnowIce,
'Gel': MeteoalarmEventType.SnowIce,
'Chaleur': MeteoalarmEventType.HighTemperature,
'Ouragan': MeteoalarmEventType.Hurricane,
'Pluie': MeteoalarmEventType.Rain,
'Orage violent': MeteoalarmEventType.Thunderstorms,
'Neige': MeteoalarmEventType.SnowIce,
'Bourrasques de neige': MeteoalarmEventType.SnowIce,
'Onde de tempête': MeteoalarmEventType.Thunderstorms,
'Tornade': MeteoalarmEventType.Tornado,
'Tempête tropicale': MeteoalarmEventType.Hurricane,
// Same as English 'Tsunami': MeteoalarmEventType.Tsunami,
'Météorologique': MeteoalarmEventType.Unknown,
'Vents': MeteoalarmEventType.Wind,
'Tempête hivernale': MeteoalarmEventType.SnowIce
Something like that
public supports(entity: EnvCanadaEntity): boolean {
const isStateNumber = !Number.isNaN(Number(entity.state));
const validAttribution = entity.attributes.attribution == 'Data provided by Environment Canada' || entity.attributes.attribution == 'Données fournies par Environnement Canada'
return validAttribution && isStateNumber && this.getEntityType(entity) !== undefined);
}
Describe the bug
I am trying to configure the card with Environment Canada but I get the following error:
Those sensors exist and have the valid information from the integration.
Steps to reproduce
No response
Screenshots
Card version
v2.0.0
Integration type
Environnement Canada
Installation type
Home Assistant Community Store (HACS)
Card Configuration
Integration Configuration