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

I’m just updated to 0.91 to see if it made a difference.

Yes, it seems like something changed in the master camera component in 0.90 that broke the radar platform, and I haven’t figured out what yet. It looks like 90.1 only changed the new stream component, so I don’t know if that will help.

I’m still looking into it; thanks for your patience.

Edit: I didn’t change anything, but when I restarted my 0.90 container to capture the logs it seems to have come up properly. Weird. If you’ve tried restarting and you’re still stuck, please let me know.

@michaeldavie I’ve restarted several times and having the same issue with the radar image not working after upgrading to 0.90.

I just restarted my development version, and the camera started working again:

Now my radar image is working this morning :thinking:

well. I changes my real cameras to use stream_source: instead of input: and not the problem with the EC radar has gone away in HA version 0.90. using env_canada 0.0.8 . Don’t understand the relationship but seems to be a conflict with 0.90. stream to chrome cast function added in HA 0.90.

Just got HA 0.90.1 and everything looks good.

PS. Used Stream Component: Confirmed Cameras and Configurations to find correct streaming settings for my cameras.

Update to say that after restarting 0.90 with env_canada 0.0.8 and no changes in configuration, the radar is working again.

1 Like

@michaeldavie

Was hoping to take your component here for a preview spin before it gets integrated.

When I run this command:

pip install env_canada==0.0.8 --target /config/deps/lib/python3.6/site-packages --upgrade

I get this error

C compiler: gcc -fno-strict-aliasing -Os -fomit-frame-pointer -g -DNDEBUG -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC

compile options: '-Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/include/python2.7 -c'
gcc: _configtest.c
failure.
removing: _configtest.c _configtest.o
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-install-CDQIcq/numpy/setup.py", line 415, in <module>
    setup_package()
  File "/tmp/pip-install-CDQIcq/numpy/setup.py", line 407, in setup_package
    setup(**metadata)
  File "/tmp/pip-install-CDQIcq/numpy/numpy/distutils/core.py", line 171, in setup
    return old_setup(**new_attr)
  File "/usr/lib/python2.7/site-packages/setuptools/__init__.py", line 129, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/tmp/pip-install-CDQIcq/numpy/numpy/distutils/command/install.py", line 62, in run
    r = self.setuptools_run()
  File "/tmp/pip-install-CDQIcq/numpy/numpy/distutils/command/install.py", line 36, in setuptools_run
    return distutils_install.run(self)
  File "/usr/lib/python2.7/distutils/command/install.py", line 563, in run
    self.run_command('build')
  File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/tmp/pip-install-CDQIcq/numpy/numpy/distutils/command/build.py", line 47, in run
    old_build.run(self)
  File "/usr/lib/python2.7/distutils/command/build.py", line 127, in run
    self.run_command(cmd_name)
  File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/tmp/pip-install-CDQIcq/numpy/numpy/distutils/command/build_src.py", line 148, in run
    self.build_sources()
  File "/tmp/pip-install-CDQIcq/numpy/numpy/distutils/command/build_src.py", line 159, in build_sources
    self.build_library_sources(*libname_info)
  File "/tmp/pip-install-CDQIcq/numpy/numpy/distutils/command/build_src.py", line 292, in build_library_sources
    sources = self.generate_sources(sources, (lib_name, build_info))
  File "/tmp/pip-install-CDQIcq/numpy/numpy/distutils/command/build_src.py", line 375, in generate_sources
    source = func(extension, build_dir)
  File "numpy/core/setup.py", line 667, in get_mathlib_info
    raise RuntimeError("Broken toolchain: cannot link a simple C program")
RuntimeError: Broken toolchain: cannot link a simple C program

----------------------------------------
Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-CDQIcq/numpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-4i8egh/install-record.txt --single-version-externally-managed --compile --home=/tmp/pip-target-uLuuDx" failed with error code 1 in /tmp/pip-install-CDQIcq/numpy/

Any idea where I might have went wrong? Running Hassio 0.90.1 on rPi3.

Weird. I found this, which might help:

Most of that is over my head. Bit of a linux noob here. I did successfully upgrade pip but i didn’t help. I don’t even know where to go to ask for help with this. I don’t think it’s actually a home assistant problem.

Thanks for looking into it though.

You seem to running pip from python2. See last line as well as -I/usr/include/python2.7 in the includes

Try “pip3” or “python3 -m pip” instead if “pip”

OK I just spent a couple hours trying to figure this out… I admit defeat. I’m lost.

If I run pip - V I get

pip 19.0.3 from /usr/lib/python2.7/site-packages/pip (python 2.7)

If I run pip3 I get

command not found: pip3

If I run python3 -m pip I get

command not found: python3

This is all through a terminal window in Cloud9. I eventually figured out I use the normal SSH addon I can run the python3 -m pip command. So I tried installing the env_canada package from there and it does the whole collecting/downloading thing but then fails installing on a completely different element.

I’m sure this has something to do with being in different virtual environments or something like that but damned if I can figure it out. Obviously, this isn’t the place for a crash course in linux.

Thanks for looking at it though @froz

python is python 2.x, and python3 is version 3.x.
Fun note: they are basically not compatible with each other.

From a quick Google, it looks like you can install python3 on Cloud9 with “sudo yum -y install python36
(as per https://docs.aws.amazon.com/cloud9/latest/user-guide/sample-python.html )

Quick question about Advisory, Statement, Watch, Warning, and Ended sensor values.

I’m still on 0.0.7 (I know, I know) and .88 for HA (ok, I get it) :slight_smile: I’ve noticed that if there are no alerts out the values have no value.

I had a conditional card that would appear when there was an alert. I used a ‘state_not:’ condition which worked great when the state for the sensor was ‘unknown’. Now with a blank I’m not sure how to handle it. There are too many variables to trigger a conditional card with a state: ‘XX’ condition.

Guess my question is 3 fold, are the sensor still empty values in 0.0.8?
If yes does anyone know how to trigger on a not blank value?
Last is it possible to have a value?

Let me know if I should spin this question out into a separate post.

Yes, this is still the same in 0.0.8. I’m not too familiar with the new UI yet, but have you tried testing whether the state is not an empty string, i.e. ''? If that doesn’t work I could maybe change it to some placeholder, but it seems more Pythonic to leave it blank.

@rlongfield @michaeldavie Here’s how i deal with those sensors to effectively create a “bad weather” sensor. I look at the “hidden” attribute in each sensor to create a binary sensor. In my configuration.yaml:

binary_sensor:
  - platform: template
    sensors:
      bad_weather:
        value_template: >-
          {{ is_state_attr('sensor.warnings', 'hidden', False) or is_state_attr('sensor.statements', 'hidden', False) or is_state_attr('sensor.advisories', 'hidden', False) or is_state_attr('sensor.watches', 'hidden', False) }}  

This lets me display conditional cards when the bad_weather sensor is true.

1 Like

You’ve created a template sensor that does not explicitly indicate the entities that must be monitored for state-changes. As a result, Home Assistant must infer the entities to be monitored by examining the template.

If the entities are non-obvious, Home Assistant will evaluate the template sensor once at startup and never again (i.e. only until the next startup). In addition, Home Assistant will log a warning message indicating the template sensor doesn’t have an obvious entity. Check your log for any messages related to this template sensor.

Should there be a warning message, the solution is to list the entities to be monitored:

binary_sensor:
  - platform: template
    sensors:
      bad_weather:
        entity_id:
          - sensor.warnings
          - sensor.statements
          - sensor.advisories
          - sensor.watches
        value_template: >-
          {{ is_state_attr('sensor.warnings', 'hidden', False) or is_state_attr('sensor.statements', 'hidden', False) or is_state_attr('sensor.advisories', 'hidden', False) or is_state_attr('sensor.watches', 'hidden', False) }}

@davidbb and @123

Thank you so much. I was trying a much more complicated way using templates that wasn’t working out. This is so much more elegant and functional.
Conveniently we have a Special weather statement in effect right now so I was able to real world test it and it worked like a charm.

Now if only I could get the card-modder customization to work with a conditional card things would be great!

edit: So I got the card-modder to work, now when there is “bad weather” this beauty pop up.

image

1 Like

Nice! Could you post your config for this as well?

Absolutely. First off you will need to install card-modder if you haven’t already.
You can find the details on card-modder here: https://github.com/thomasloven/lovelace-card-modder

In ui-lovelace.yaml This bit controls the Weather Alert card.

 #Weather Warning Card
       - type: conditional
         conditions:
           - entity: binary_sensor.bad_weather
             state: 'on'
         card:
           type: custom:card-modder
           style:
             background-color: rgba(251,13,13,1)
             border-radius: 5px
             --primary-color: white
             --paper-item-icon-color: white
           card:
             type: entities
             entities:
               - type: weblink
                 name: Weather Alert
                 icon: mdi:weather-lightning-rainy
                 url: https://weather.gc.ca/warnings/report_e.html?XX##

Make sure to change XX## to your location code. Clicking the link will open the weather advisory page for the XX## location in a new browser tab.

This bit creates the binary_sensor.bad_weather used in the conditional card above courtesy of @davidbb and @123:

If you are putting this in your configuration.yaml it will go under the

binary_sensor:

I put it in a binary_sensors.yaml file with:

binary_sensor: !include binary_sensors.yaml
 #Creating a Bad Weather Binary Sensor for warning card
   - platform: template
     sensors:
       bad_weather:
         entity_id:
           - sensor.warnings
           - sensor.statements
           - sensor.advisories
           - sensor.watches
         value_template: >-
           {{ is_state_attr('sensor.warnings', 'hidden', False) or is_state_attr('sensor.statements', 'hidden', False) or is_state_attr('sensor.advisories', 'hidden', False) or is_state_attr('sensor.watches', 'hidden', False) }}

That’s pretty much it.

1 Like