core: Dyson Integration unable to log on
The problem
Starting within the last 24 hours the Dyson integration has stopped working when HA is being restarted. It can no longer log on to the Dyson cloud account.
Environment
- Home Assistant Core release with the issue: 0.113.3
- Last working Home Assistant Core release (if known): 0.113.3
- Operating environment (OS/Container/Supervised/Core): OS
- Integration causing this issue: Dyson
- Link to integration documentation on our website: https://www.home-assistant.io/integrations/dyson/
Problem-relevant configuration.yaml
dyson:
username: !secret dyson_user
password: !secret dyson_password
language: DE
devices:
- device_id: !secret dyson_device_id # eg: Pure Cool Link device
device_ip: 192.168.0.19
Traceback/Error logs
2020-08-06 17:45:15 INFO (MainThread) [homeassistant.setup] Setting up dyson
2020-08-06 17:45:15 INFO (SyncWorker_5) [homeassistant.components.dyson] Creating new Dyson component
2020-08-06 17:45:15 INFO (SyncWorker_5) [homeassistant.components.dyson] Creating new Dyson component
2020-08-06 17:45:15 ERROR (SyncWorker_5) [homeassistant.components.dyson] Not connected to Dyson account. Unable to add devices
2020-08-06 17:45:15 ERROR (SyncWorker_5) [homeassistant.components.dyson] Not connected to Dyson account. Unable to add devices
2020-08-06 17:45:15 INFO (MainThread) [homeassistant.setup] Setup of domain dyson took 0.7 seconds
2020-08-06 17:45:15 ERROR (MainThread) [homeassistant.setup] Setup failed for dyson: Integration failed to initialize.
Additional information
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 5
- Comments: 54 (3 by maintainers)
The user-agent appears to be
DysonLink/29019 CFNetwork/1188 Darwin/20.0.0Hey guys, sorry about the delay, I just got back and saw my inbox. Thank you for figuring out what the issue was. I’ll push a an update for libpurecool immediately. I’ll let you know when it’s done.
In console you could use curl
cd /usr/local/lib/python3.8/site-packages/libpurecool/mv dyson.py dyson.py.oldorrm dyson.pycurl -O https://raw.githubusercontent.com/etheralm/libpurecool/90a17ecc32ff17196044773b55649364444508b9/libpurecool/dyson.pyI think that the problem is caused by a Dyson server. The Dyson server’s filtering and blocking a python request. That’s because I had solved the problem after adding a “User-Agent: curl/7.64.0” to web request as a below.
@Krocko The easiest way to do it is by mounting the new
dyson.pyfile from the PR to the Docker container. In docker-compose it can be done this way:You can also ssh into the container and edit the file at the location in the snippet above.
Running Home Assistant 0.113.1 inside VM on Ubuntu, have ssh into hassio and used
find name dyson.py No such file or directory
Could someone please tell me where this file is likely to be saved?
This is currently what I have in config.yaml
dyson: username: myemail password: mypassword language: AU devices: - device_id: device_SN device_ip: device_IP
When I start HA I get the following…
Setup failed for dyson: Integration failed to initialize. 16:37:55 – setup.py (ERROR) Not connected to Dyson account. Unable to add devices 16:37:55 – dyson (ERROR)
Yes. You won’t have to do anything else, it should just work.
More detail: Two files will be replaced behind the scenes by HA. The manifest.json in the HA dyson integration will include a requirements update, which will trigger HA to download the new Libpurecool library replacing dyson.py again. We’re still awaiting @etheralm reviewing the pull request for the Libpurecool library, so this may be a HA version or two away.
I have always found the Dyson integration is prone to random little connection issues here and there. From what I can tell, if one device is temporarily disconnected it can timeout the setup in HA. It usually requires a restart of HA to fix.
It would be smart to get the HA integration to cache the device list and authentication for some period of time, that would solve most problems. It might also reduce the amount of queries we throw at the dyson servers, making it harder for them to shut down the integration.
Thank you for your answer. I might not understand what iam doing right now 😄 but thats the only way for me to learn how this stuff works. If i mess something up i have no problem with starting from scratch!
Thanks again ill see where your hint will get me 📦 Best Regards
You don’t need a custom component for this fix. Using portainer to replace the dyson.py file should be the only change required. Are you sure you didn’t just rename the file with the first step and not download the file with the curl command? I’d suggest using the portainer console to,
If you’re in a venv it should be in your python site packages, so
/srv/homeassistant/lib/python3.7/site-packages/libpurecool/dyson.py
or
/srv/homeassistant/lib/python3.8/site-packages/libpurecool/dyson.py
Worked for me too. Thanks!
@KibosJ it works!!! thnx for you’re help!
I think @Phontana is on to something. I also ran down the API doing both the POST and GET commands and receive a 200 response with the proper JSON payload, however it appears the library thinks it is not getting a proper response and sets the login value to FALSE those making the home assistant integration dump out thinking you never logged in.