Reviewers needed: Environment Canada component with weather, sensor, and camera (radar) platforms

Thanks, this helps a lot. I’ll see if I can rework the dependencies so that it’ll run properly on Debian Stretch. Edit: I tried it with a Debian Stretch container and it worked…

I’ve only been working on the env_canada library for now; I’ll rework the components once I get the library fixed.

Which glibc version was in your container? And what python version were you running?
A container or full fledged OS should be the same in theory.

glibc = 2.24
python = 3.5.3

I’m trying to see if I can spin up a container based on Hassbian now.

I’m running python 3.7.3 and from what I found online, this could be the problem…

I just upgraded to python 3.7 due to the obsolecense of 3.5 in august… I’d be curious to see if you get the same results with python 3.7.3

Congratulation Michael for the release in v0.95! It works very well for me, very good work
thank you

1 Like

Had the same issue. Fixed by using “’” in station parameter, e.g. station: ‘ON/s0000430’`

I had to install libatlas-base-dev to get numpy to install properly, to get rid of the “platform not found” message

Fixed by using the following line to avoid installing the pre-compiled version:

pip install numpy==1.16.4 --force-reinstall --ignore-installed --no-binary :all:

Working well for me in hassio 95.4. Really happy about this component. I’ve parsed through the thread and saw that there was quite a bit of work put into the warning,statements, and ending statements, etc portion and how people used it in cards and how the work was incorporated into the component. Maybe when the installation hubub dies down somebody could throw me a bone on some automation ideas for bad weather. I was hoping to get bad weather announced with google tts. This might actually score some “significant other” acceptance points for my technology hobby

Thanks, I’m glad you’re finding it useful!

As luck would have it, I’ve been playing around with sending alerts to TTS this afternoon, and so far this script is working well:

  weather_alert_tts:
    alias: Weather Alert TTS
    sequence:
      - service: tts.amazon_polly_say
        data_template:
          message: '{{ states("sensor.warnings") }} in effect. {{ state_attr("sensor.warnings", "alert detail") }}'

I’m thinking about increasing the update frequency to every minute (maybe I should make this configurable…), and then having an automation trigger this kind of script if the alert sensors change. It’s a work in progress.

1 Like

Running
pip install numpy==1.16.4 --force-reinstall --ignore-installed --no-binary :all:
as @jmll suggested fixed the Numpy error with the sensor, as well as the “platform not found” error.

But as of now, I’m not getting any readings for temperature and condition. I’m getting the weather forecast and wind speed though.

EDIT: Problem has to do with my closest station… I tried with another one and everythoing works

Problem replicated manually:

>>> from env_canada import ECData, ECRadar
>>> data = ECData(station_id='ON/s0000430')
>>> print(data.conditions['condition'])
Mainly Sunny
>>> print(data.conditions['temperature'])
20.9
>>> data = ECData(station_id='QC/s0000416')
>>> print(data.conditions['temperature'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: 'temperature'
>>> data = ECData(station_id='QC/s0000620')
>>> print(data.conditions['temperature'])
20.2

Interesting… I thought the sensors were not working as well and even re-installed env_canada with the following line:

pip install env-canada==0.0.10 --force-reinstall --ignore-installed --no-binary :all:

The process took quite a while but I had to make sure everything was properly installed. However, the sensors were working fine. I was looking for weather.environment_canada but instead the sensor is named after the location weather.toronto (I know, RTFM). The platform is now working pretty nice and fully integrated with my TTS alerts - thank you and great job @michaeldavie. Just one little thing: I noticed yesterday with a “heat warning” I couldn’t get the details parsed - maybe an issue with Environment Canada? Not sure.

@Answer maybe try manually setting to the second closest location temporarily in the config file?

Exactly what I did to make it work! Will try to find out what’s up with my location!

@Answer, it seems like Environment Canada has some sites that they only publish forecasts for, without any, or at least a full set of, observations. In that case, manually setting the closest site that has a full set is probably your best option.

I should also mention that the coordinates provided for the sites are only specified to 2 decimal places, so sometimes the closest by that measure is not actually the closest. In that case, you can also override the automatic selection.

@jmll, thanks, I noticed that too. It was a problem with case sensitivity, and I’ve submitted a PR to handle this in the future.

@michaeldavie yeah, I’ll try to get more info on this. The auto discovered station is the correct one. I’m using an alternate one in the meantime. Would be kinda weird for a station not to provide temperature, but hey, we never know! lol!
Thanks again for that great component!

Thanks so much. Still learning and it’s great to have something to work off. In terms of update frequency I think I read u have set it to a default of 10 minutes. I thought that was based on environment Canada’s updates. I noticed that for example temperature doesn’t seem to change every 10 minutes whereas my dark sky temp sensor seems to be more exacting. With 5 minute polling I seem to pick up even small changes in temperature with dark sky. I’m supposing that environment Canada would offer updates more often on weather warnings and emergencies. I remember they were trying to achieve a minimum warning time for tornadoes forming but don’t remember what it was. For things like this I suppose the sooner the better. An F5 rolled thru prairies but was about a decade ago but F4’s are becoming more frequent too

@jmll

How are u running your TTS alerts if u don’t mind me asking

@ others

I had a similar problem with my closest weather station not reporting observations so I switched to the main one at the airport. A little research on environment Canada indicated that not all weather stations provide observations (maybe this actually requires a human/metrologist) and obviously some weather stations are simply automated data collection)

The weird thing about my station, it that it will give me the coming days forecast, but not current temp…

EDIT: Oh well… My station really doesn’t report temp…

https://weather.gc.ca/wxlink/wxlink.html?cityCode=qc-78&lang=e

https://weather.gc.ca/wxlink/wxlink.html?cityCode=qc-133&lang=e

Yeah, I wonder if some of these “stations” with no data are really just target locations for their forecasting models.

@dasbooter, in my latest PR I’ve changed the polling frequency to 1 minute to capture alerts as soon as possible. I should probably make it configurable.

Thanks! hope the PR is accepted soon.

Pretty much as @michaeldavie suggested but I’m using tts.google_translate_say instead:

And bit more info in the message (still WIP):

            Outside, it will be {{ states('sensor.condition') }} with a current temperature of {{ states('sensor.temperature') }} degrees. The forecast for today is a high of {{ states('sensor.high_temperature') }} degrees, low of {{ states('sensor.low_temperature') }} degrees and a humidex of {{ states('sensor.humidex') }} degrees.
            {% if states.sensor.warnings.state != 'unknown' %}
               There is a {{ states("sensor.warnings") }} in effect: {{ state_attr("sensor.warnings", "alert detail") }}.
            {% endif %}