gluap / pyduofern

GNU General Public License v2.0
40 stars 11 forks source link

duofern not working with Home assistant 0.89 #1

Closed dhzl84 closed 5 years ago

dhzl84 commented 5 years ago

Hi, I just updated to HA 0.89 and the duofern custom component stopped working. I already tried to update to the latest version (commit 29a0505) but it fails to initialize.

Error log:

Error while setting up platform duofern
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/duofern/cover.py", line 20, in setup_platform
    stick = hass.data[DOMAIN]['stick']
KeyError: 'duofern'

my configuration.yaml:

cover:
  - platform: duofern
    serial_port: /dev/ttyUSB1
    config_file: duofern.json
    code: !secret duofern_code
dhzl84 commented 5 years ago

Got it working with commit ea0f052 and this config for hassio. No need for SSH and cloning git.

duofern:
  serial_port: /dev/ttyUSB1
  config_file: duofern.json
  code: !secret duofern_code

Your latest description doesn't mention the key config_file: for configuration.yaml but HAs config check fails if it is not given.

Also changing the name via GUI isn't possible for me, no gear symbol available (like for other devices) or do you mean the Configuation- Customization way of changing them?

gluap commented 5 years ago

@dhzl84 you're right, I missed commiting a local change to __init__.py from the custom component. I only submitted the documentation part, but the config_file parameter still had a broken default. It should be fixed now (by assuming a default config file name if none is passed).

I used the homeassistant configuration directory (deducing the location relative to the custom components folder) as the default. That way it should be editable in Homeassistant.

Regarding your second issuue: I had accidentally removed the unique_id property from the devices -- I re-added it and now renaming works for me.

dhzl84 commented 5 years ago

@gluap thanks for the reply!

Just tested commit ea0f052 with hassio on HassOS and I can only confirm what you said. The config file is now used properly and renaming from GUI works. Thank you!

Any intentions to submit it to HA as a component?