Binary_sensor missing upgrade from 0.50.2 to 0.51.2

I could use some help on how to properly upgrade from 0.50.2 to 0.51.2 as I’m currently not seeing my binary_sensors that existed in 0.50.2

I run Home Assistant in docker on a QNAP NAS (TS-451) and upgraded to 0.51.2 and am missing all of my zigbee window binary_sensors (MCT-340 E).

I’m relatively new to Home Assistant so let me know if I did something incorrectly.

To upgrade I ran

docker pull homeassistant/home-assistant

To get the latest version of home assistant and then

docker run -d --name="home-assistant-0.51.2" -v /share/Public/ha:/config --restart=always --privileged -v /etc/localtime:/etc/localtime:ro --net=host homeassistant/home-assistant

To create the new docker image. I’ve been doing this each time to upgrade, validating that everything is good, then deleting the old docker image. Is this the correct process with docker? Note each time I’m pointing to the same config directory.

This time when I upgraded the 0.51.2 image doesn’t load any of my binary sensors (they’re new so this is the first time I’m upgrading while they are on the network)

0.50.2 (good) startup log snippet

2017-08-16 17:46:27 INFO (MainThread) [homeassistant.loader] Loaded binary_sensor.zha from homeassistant.components.binary_sensor.zha
2017-08-16 17:46:27 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.ecobee
2017-08-16 17:46:27 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.zha
2017-08-16 17:46:27 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.zha
2017-08-16 17:46:27 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.zha
2017-08-16 17:46:27 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.zha
2017-08-16 17:46:27 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.zha
2017-08-16 17:46:27 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.zha
2017-08-16 17:46:27 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.zha
2017-08-16 17:46:27 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.zha
2017-08-16 17:46:27 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.zha
2017-08-16 17:46:27 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.zha
2017-08-16 17:46:27 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.zha
2017-08-16 17:46:27 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.zha
2017-08-16 17:46:27 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.zha
2017-08-16 17:46:27 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.zha

and 0.51.2 (missing sensors) doesn’t ever say that.

Both say versions give me the same error so I assume this is unrelated

2017-08-16 17:46:38 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 182, in _step
    result = coro.throw(exc)
  File "/usr/src/app/homeassistant/components/zha/__init__.py", line 146, in async_device_initialized
    discovered_info = yield from _discover_endpoint_info(endpoint)
  File "/usr/src/app/homeassistant/components/zha/__init__.py", line 290, in _discover_endpoint_info
    yield from read(['manufacturer', 'model'])
  File "/usr/src/app/homeassistant/components/zha/__init__.py", line 286, in read
    allow_cache=True,
  File "/usr/local/lib/python3.6/site-packages/bellows/zigbee/zcl/__init__.py", line 192, in read_attributes
    result = yield from self.read_attributes_raw(to_read)
  File "/usr/local/lib/python3.6/site-packages/bellows/zigbee/zcl/__init__.py", line 159, in read_attributes_raw
    v = yield from self.request(True, 0x00, schema, attributes)
  File "/usr/local/lib/python3.6/site-packages/bellows/zigbee/application.py", line 261, in request
    v = yield from send_fut
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 332, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
    future.result()
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 245, in result
    raise self._exception
bellows.zigbee.exceptions.DeliveryError: Message send failure: EmberStatus.DELIVERY_FAILED

I can go back to the 0.50.2 instance and see everything, but pointing to the same config directory I don’t see the binary_sensors in 0.51.2

Any tips would be appreciated.

Figured it out.

I had to my database location from

zha:
    usb_path: /dev/ttyUSB1
    database_path: zigbee.db

to

zha:
    usb_path: /dev/ttyUSB1
    database_path: /config/zigbee.db

In case anyone else runs into this its because the docker container loads all my home assistant configs to /config directory since I followed the home assistant guides

$ docker run -d --name="home-assistant" -v /path/to/your/config:/config -v /etc/localtime:/etc/localtime:ro --net=host homeassistant/home-assistant

Per the above command the zigbee.db file I define in my home assistant config directory will live in docker at /config/zigbee.db. When I followed the zigbee home automation steps I largely copy/pasted their example

# Example configuration.yaml entry
zha:
  usb_path: /dev/ttyUSB2
  database_path: zigbee.db

Which doesn’t put zigbee.db in the correct path for docker users (it’s just an example). Once I realized this it made sense that docker was making it’s own db this entire time, that is why when I made a new docker container it lost all the zigbee data. It wasn’t anything specific to the version of home assistant.

Changing the config and putting the correct zigbee.db in my config directory solved the problem!