Support for Environment Canada platforms

Hello, Is the precip_type parameter for the camera mandatory since this new version? I get an error if I don’t specify it.

Hmmm, it seems to be working for me:

In [14]: import asyncio

In [15]: from env_canada import ECRadar

In [16]: test = ECRadar(coordinates=(50, -100))

In [17]: frame = asyncio.run(test.get_latest_frame())

In [18]: frame[:10]
Out[18]: b'\x89PNG\r\n\x1a\n\x00\x00'

Can you check if you’re providing RAIN or SNOW instead? The previous version took uppercase.

The previous version I had is the version that is on the Home Assistant site, in the integration section. In this version the precip_type parameter was optional, and the default was to RAIN from April to October, SNOW from November to March. Now it looks like I absolutely have to specify it. If it is not specified, there is an error.

Thanks, I found the bug and have patched it in v2021.09.1.

Thank you.

Any idea what this is about?

➜  config ha core check
Processing... Done.

Error: Testing configuration at /config
INFO:homeassistant.util.package:Attempting install of pyserial-asyncio==0.4
WARNING:slixmpp.stringprep:Using slower stringprep, consider compiling the faster cython/libidn one.
INFO:homeassistant.util.package:Attempting install of alexapy==1.25.1
INFO:homeassistant.util.package:Attempting install of packaging~=20.3
INFO:homeassistant.util.package:Attempting install of httplib2==0.19.0
Failed config
  General Errors:
    - Platform error sensor.environment_canada - cannot import name '_imaging' from 'PIL' (/usr/local/lib/python3.9/site-packages/PIL/__init__.py)
    - Platform error camera.environment_canada - cannot import name '_imaging' from 'PIL' (/usr/local/lib/python3.9/site-packages/PIL/__init__.py)
    - Platform error weather.environment_canada - cannot import name '_imaging' from 'PIL' (/usr/local/lib/python3.9/site-packages/PIL/__init__.py)

Successful config (partial)

Google seems to say that it can be caused by a conflict between PIL and Pillow. Can you provide any details on your setup? I’m using the 2021.9.5 Docker image without any issues.

Hey folks,

I have what I think is a stable version of the EC integration based on config flow (UI config). Everything is there that is in the existing integration except for radar, which is my next task. It would be great if people could try it out. I’m believe that it is stable and I’m looking for all reports - exception, features, etc.

This is a breaking change! Names of entities are different. Alerts are completely different (the state value is the number of active alerts, and the attributes are the alert/alert time – see image below) Probably other breaking changes.

Screen Shot 2021-09-09 at 13.45.17

1 Like

I am using

Version	core-2021.9.5
Installation Type	Home Assistant OS

(which is docker under-the-hood)
I found the error after I had a failure to restart HA core upon the last upgrade and so ran ha core check from a ssh session.
I wouldn’t know the difference between PIL and Pillow, unless you’re referring to what I swallow before laying my head on that thing on my bed…trying to swallow that would be, well, impossible. :rofl:

Source: https://github.com/gwww/hass-environment-canada
Any plans to make it available via HACS?

No, the plan is to merge @gwww’s work back into the main project as an upgrade to the official integration.

For your PIL issue, take a look at python - Cannot import imaging from PIL - Stack Overflow

1 Like

I did intend to put a Github link in… guess the brain doesn’t work so well after a 16 hour day!

Here is the preferred link. Preferred because it is the tagged version so that I can more easily debug.

What @michaeldavie said - no plans for HACS. However, you can download a zip of the repo, and simply unzip it into your custom components directory.

Had a look and tried the suggestions. Pillow was not installed and won’t install:

    __main__.RequiredDependencyException: zlib

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-a4lsj8rm/pillow_12978341fd534169afca84a894fb73b6/setup.py", line 903, in <module>
        raise RequiredDependencyException(msg)
    __main__.RequiredDependencyException:

    The headers or library files could not be found for zlib,
    a required dependency when compiling Pillow from source.

    Please see the install instructions at:
       https://pillow.readthedocs.io/en/latest/installation.html

I’m on…

Version	core-2021.9.5
Installation Type	Home Assistant OS

Sorry, but this seems to be a problem specific to your installation rather than with the integration itself.

Hello, It looks like two peoples are working on two differents versions. I’m a little confused which one should I used.

That’s fair. Here’s the current situation:

My code at https://github.com/michaeldavie/hass_environment_canada is stable and can be used via the configuration file.

@gwww is building a new version that can be configured via the GUI. His code is ready for testing and is at https://github.com/gwww/hass-environment-canada.

Once @gwww’s code is ready it will be merged into the main project and both of these repos will be retired.

1 Like

Thank you for the details. I have a request for you. I use the Dwains dashboard and in the weather section there is an indicator for visibility. This indicator comes from the Weather.xxxxx parameter. Would it be possible for you to add it in the basic section?

It’s there in both versions:

However, it doesn’t look like Environment Canada reports visibility for Shawinigan: Shawinigan, QC - 7 Day Forecast - Environment Canada

An update: @gwww’s rewrite is ready and we have started the process of moving it through Home Assistant’s PR process. It might be a couple more weeks, but we’re getting close. Thanks for your patience.

4 Likes

I restarted Core this morning and I get error all across the board loading environment_canada platform, tried to look at the issue already opened but I tried to lookup the website https://meteo.gc.ca/ and it seems to be down…

Does the platform load it’s data from this fqdn meteo.gc.ca ?