Automation component fails after upgrade from 0.30 to 0.32.3

Upgraded last night from 0.30 to 0.32.3 using the manual instructions for All-In-One (Getting started - Home Assistant). This is my first time updating HA and … has not gone well for me :frowning:

After upgrading, things started falling apart. I received a message on the frontend that the automation component failed to initialize. From the log:
homeassistant.bootstrap: component automation failed to initialize

Played with my automation scripts a little to see if I could find an error with no success. This was all working on previous version of hass.

Relevant line in configuration.yaml looks like this:

automation: !include_dir_merge_list automation

automation directory currently only has one file: dooropen.yaml

dooropen.yaml:

    alias: DoorOpen
    trigger:
      platform: state
      entity_id: binary_sensor.schlage_ecolink_dwzwave1_sensor_4_0
      to: "on"
    action:
      service: notify.gmail
      data:
        title: "Someone is here"
        message: "Just sayin"
    hide_entity: true

Don’t know if it is related, but I am also seeing random Z-wave errors in the HA log. Doesn’t seem to effect the devices through hass, but I never saw these errors prior to upgrade:

16-11-14 10:51:40 homeassistant.components.sensor: Error while setting up platform zwave
Traceback (most recent call last):
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 148, in _async_setup_platform
    entity_platform.add_entities, discovery_info
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/sensor/zwave.py", line 37, in setup_platform
    add_devices([ZWaveMultilevelSensor(value)])
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 289, in add_entities
    ).result()
  File "/usr/lib/python3.4/concurrent/futures/_base.py", line 402, in result
    return self.__get_result()
  File "/usr/lib/python3.4/concurrent/futures/_base.py", line 354, in __get_result
    raise self._exception
  File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step
    result = coro.throw(exc)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 304, in async_add_entities
    yield from asyncio.gather(*tasks, loop=self.component.hass.loop)
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/asyncio/tasks.py", line 237, in _step
    result = next(coro)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 320, in _async_process_entity
    new_entity, self, update_before_add=update_before_add
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 194, in async_add_entity
    yield from entity.async_update_ha_state()
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 225, in async_update_ha_state
    device_attr = self.device_state_attributes
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/zwave/__init__.py", line 597, in device_state_attributes
    battery_level = self._value.node.get_battery_level()
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/openzwave-0.3.1-py3.4.egg/openzwave/command.py", line 284, in get_battery_level
    for val in self.get_battery_levels():
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/openzwave-0.3.1-py3.4.egg/openzwave/command.py", line 306, in get_battery_levels
    type='Byte', readonly=True, writeonly=False)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/openzwave-0.3.1-py3.4.egg/openzwave/node.py", line 438, in get_values
    for value in self.values:
RuntimeError: dictionary changed size during iteration
16-11-14 10:51:41 homeassistant.components.sensor: Error while setting up platform zwave
Traceback (most recent call last):
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 148, in _async_setup_platform
    entity_platform.add_entities, discovery_info
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/sensor/zwave.py", line 37, in setup_platform
    add_devices([ZWaveMultilevelSensor(value)])
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 289, in add_entities
    ).result()
  File "/usr/lib/python3.4/concurrent/futures/_base.py", line 402, in result
    return self.__get_result()
  File "/usr/lib/python3.4/concurrent/futures/_base.py", line 354, in __get_result
    raise self._exception
  File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step
    result = coro.throw(exc)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 304, in async_add_entities
    yield from asyncio.gather(*tasks, loop=self.component.hass.loop)
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/asyncio/tasks.py", line 237, in _step
    result = next(coro)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 320, in _async_process_entity
    new_entity, self, update_before_add=update_before_add
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 194, in async_add_entity
    yield from entity.async_update_ha_state()
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 225, in async_update_ha_state
    device_attr = self.device_state_attributes
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/zwave/__init__.py", line 597, in device_state_attributes
    battery_level = self._value.node.get_battery_level()
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/openzwave-0.3.1-py3.4.egg/openzwave/command.py", line 284, in get_battery_level
    for val in self.get_battery_levels():
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/openzwave-0.3.1-py3.4.egg/openzwave/command.py", line 306, in get_battery_levels
    type='Byte', readonly=True, writeonly=False)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/openzwave-0.3.1-py3.4.egg/openzwave/node.py", line 438, in get_values
    for value in self.values:
RuntimeError: dictionary changed size during iteration

Did you read the change log for 0.31? There are breaking changes for z-wave.

I had not before I ran the update. In hunting down the problem I did find I had to update the names of all my z-wave devices. This already been done in all my yaml files. Sorry, should have mentioned that in the original post.

I don’t know if that error message is directly related. I have been getting this message on start up since going to 32.x and yet all my ZWave devices are reporting correctly and any automations with using them are also working exactly as they should.

I’m still searching through Issues and PRs to see if this is being looked into.

I think this needs hyphens

- alias: Automation 1
  trigger: ......

- alias: Automation 2
  trigger:
    platform: state
    entity_id: binary_sensor.schlage_ecolink_dwzwave1_sensor_4_0
    to: 'on'

To use as is with no hyphen try !include_dir_merge_named automation

and each automation is in it’s own individual file in the folder with no hyphen.

automation1.yaml

alias: Automation 1
      trigger: ......

and
dooropen.yaml

alias: DoorOpen
trigger:
  platform: state
  entity_id: binary_sensor.schlage_ecolink_dwzwave1_sensor_4_0
  to: 'on'

Also, not sure if it matters but I think I read somewhere that I should use single quotes

to: 'on'

rather than

to: "on"

That was it Barry. Thank you!

I think in a recent update Hass started checking for errors like this and became a bit more strict about letting things slide, or perhaps that should be load. It probably would have failed prior to updating as soon as you had more automations in that folder.