Yoda-x / ha-zha-new

update of the zha component
56 stars 10 forks source link

local variable 'custom_module' referenced before assignment #35

Closed h3ndrik closed 6 years ago

h3ndrik commented 6 years ago

when trying to pair my tradfri dimmer i get the following error message:

Jul 05 14:33:22 home hass[68]:   File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
Jul 05 14:33:22 home hass[68]:     result = coro.send(None)
Jul 05 14:33:22 home hass[68]:   File "/home/homeassistant/.homeassistant/custom_components/zha_new.py", line 382, in async_device_initialized
Jul 05 14:33:22 home hass[68]:     if '_custom_endpoint_init' in custom_module:
Jul 05 14:33:22 home hass[68]: UnboundLocalError: local variable 'custom_module' referenced before assignment
Jul 05 14:33:26 home hass[68]: 2018-07-05 14:33:26 INFO (MainThread) [zigpy.application] Device 0xbdeb (00:0b:57:ff:fe:3a:48:cb) joined the network

when looking at the code of custom_components/zha_new.py around line 382 i believe the error is correct.

configuration:

zha_new:
  usb_path: /dev/ttyUSB0
#  radio_type: ezsp
  database_path: /home/homeassistant/.homeassistant/zigbee.db
  device_config:
    "00:0b:57:ff:fe:3a:48:cb-1":
      template: tradfri_dimmer
      type: switch
      config_report:
        - [ 0x0008, 0, 0, 3600, 1]
Yoda-x commented 6 years ago

btw, tradfri dimmer should be detected automatic. no need for a device entry.