Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dyson component cannot initialize device (US based Dyson Cool Link) #8097

Closed
rwlove opened this issue Jun 18, 2017 · 5 comments · Fixed by #8113
Closed

Dyson component cannot initialize device (US based Dyson Cool Link) #8097

rwlove opened this issue Jun 18, 2017 · 5 comments · Fixed by #8113

Comments

@rwlove
Copy link

rwlove commented Jun 18, 2017

Home Assistant release (hass --version):

root@homeassistant:/usr/src/app# hass --version
0.47.0

Python release (python3 --version):

root@homeassistant:/usr/src/app# python3 --version
Python 3.6.1

Component/platform:

Dyson

Description of problem:

Dyson Cool Link Air Purifier isn't initialized.

Expected:

Dyson to be initialized correctly.

Problem-relevant configuration.yaml entries and steps to reproduce:

(relevent portion of configuration.yaml)

dyson:
  username: !secret dyson_username
  password: !secret dyson_password
  language: !secret dyson_language
  devices:
    - device_id: !secret dyson_device_id_1
      device_ip: !secret dyson_device_ip_1

Traceback (if applicable):

2017-06-18 12:47:50 INFO (SyncWorker_6) [homeassistant.components.dyson] Creating new Dyson component
2017-06-18 12:47:53 INFO (SyncWorker_6) [homeassistant.components.dyson] Connected to Dyson account
2017-06-18 12:47:54 INFO (SyncWorker_6) [homeassistant.components.dyson] Connected to device DysonDevice(XXX-XX-XXXXXXXX,True,Purifier Cool Tower,21.03.08,True,False,475,NetworkDevice(Purifier Cool Tower,192.168.5.9,1883))
2017-06-18 12:47:54 DEBUG (SyncWorker_6) [homeassistant.components.dyson] Starting sensor/fan components
2017-06-18 12:47:54 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 179, in _step
    result = coro.send(None)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 368, in async_process_entity
    new_entity, self, update_before_add=update_before_add
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 223, in async_add_entity
    yield from entity.async_added_to_hass()
  File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 210, in coro
    res = func(*args, **kw)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/sensor/dyson.py", line 41, in async_added_to_hass
    self._device.add_message_listener(self.on_message))
  File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 210, in async_add_job
    elif is_callback(target):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 78, in is_callback
    return '_hass_callback' in func.__dict__
AttributeError: 'NoneType' object has no attribute '__dict__'
2017-06-18 12:47:54 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 179, in _step
    result = coro.send(None)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 368, in async_process_entity
    new_entity, self, update_before_add=update_before_add
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 223, in async_add_entity
    yield from entity.async_added_to_hass()
  File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 210, in coro
    res = func(*args, **kw)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/fan/dyson.py", line 78, in async_added_to_hass
    self._device.add_message_listener(self.on_message))
  File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 210, in async_add_job
    elif is_callback(target):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 78, in is_callback
    return '_hass_callback' in func.__dict__
AttributeError: 'NoneType' object has no attribute '__dict__'

Additional info:

Language is set to 'GB' even though I'm in the US. I tried 'UK' but the logs indicated that I couldn't connect to my account. With 'GB' it seems as though it connects to my account, but then HASS cannot initialize my device.

@CharlesBlonde
Copy link
Contributor

I can confirm the error.
I'm working on it but can you confirm the fan component is working despite of this error ?

And for the language code, I haven't yet a full list of working code but it's good to know that you have to use 'GB' for an US device. Thanks.

@rwlove
Copy link
Author

rwlove commented Jun 19, 2017

If you look at the log closely I think you can see the exception is popping for both the fan and sensor components.

...
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/sensor/dyson.py", line 41, in async_added_to_hass
self._device.add_message_listener(self.on_message))
...
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/fan/dyson.py", line 78, in async_added_to_hass
self._device.add_message_listener(self.on_message))
...

I don't know if this is relevant, but from the UI in Developer Tools -> States, in the group.all_fans entity there is an attribute fan.purifier_cool_tower. However, I don't actually see a fan.purifier_cool_tower entity in the list. There are no other instances of the string 'purifier_cool_tower' in the entity listing.

@CharlesBlonde
Copy link
Contributor

CharlesBlonde commented Jun 19, 2017

You are right. While I was testing, I had only the error for the sensor, not the fan. And the fan component was working fine (but maybe something in cache too).
I have just fix this issue, I'm passing the tests (and it's quite long) and after I'll submit a PR.

If you want to manually fix (and tests are welcome):

sensor/dyson.py: line 41, replace the line with:

            self._device.add_message_listener, self.on_message)

fan/dyson.py: line 78, replace the line with:

            self._device.add_message_listener, self.on_message)

@rwlove
Copy link
Author

rwlove commented Jun 19, 2017

Thanks for the solution/workaround! I patched my codebase and I don't get the exceptions anymore.

However, I only get the following entities:

sensor.purifier_cool_tower_filter_life unknown unit_of_measurement: hours
friendly_name: Purifier Cool Tower filter life

fan.purifier_cool_tower off speed_list: AUTO,1,2,3,4,5,6,7,8,9,10
friendly_name: Purifier Cool Tower
supported_features: 3

Aside from not having the correct filter life, the device is currently in 'Auto' mode, and it has set itself to fan level 4, so the HASS data doesn't look right.

@CharlesBlonde
Copy link
Contributor

It seems you have another issue.
Can you set the dyson loggers to debug and provide me the outputs ?

logger:
  default: warn
  logs:
    homeassistant.components.sensor.dyson: debug
    homeassistant.components.fan.dyson: debug
    homeassistant.components.dyson: debug

You can of course anonymize sensitive data (device ID, IP address, etc ...)

Are you able to see the web component ? Something like that:
image

And I think you should open another issue because the problem seems to be different.

We can continue the troubleshooting on this post https://community.home-assistant.io/t/dyson-link-action-and-sensor/10145/ if you want.

@home-assistant home-assistant locked and limited conversation to collaborators Oct 20, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants