home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.69k stars 30.44k forks source link

Dyson integration stopped working with 2021.2 #46400

Closed afk11 closed 2 years ago

afk11 commented 3 years ago

The problem

I have been using the dyson integration with my hot/cold fan successfully for a while. I upgraded HA last night to 2021.2 and saw alerts that the integration couldn't initialize

What is version of Home Assistant Core has the issue?

2021.2

What was the last working version of Home Assistant Core?

2021.1

What type of installation are you running?

Home Assistant Core

Integration causing the issue

Dyson

Link to integration documentation on our website

https://www.home-assistant.io/integrations/dyson/

Example YAML snippet

dyson:
  username: EMAIL
  password: !secret SECRET
  language: GB
  devices:
    - device_id: DEVICE_ID
      device_ip: LAN_IP

Anything in the logs that might be useful for us?


# First Warning in logs

2021-02-11 03:17:41 ERROR (SyncWorker_2) [homeassistant.components.dyson] Not connected to Dyson account. Unable to add devices
2021-02-11 03:17:41 INFO (MainThread) [homeassistant.setup] Setup of domain dyson took 0.6 seconds
2021-02-11 03:17:41 ERROR (MainThread) [homeassistant.setup] Setup failed for dyson: Integration failed to initialize.
2021-02-11 03:17:41 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=persistent_notification, service=create, service_data=title=Invalid config, message=The following integrations and platforms could not be set up:
- dyson

# Later warning in logs. I'm not sure if this is actually from dyson or not. The IP looked weird, but when I googled it, it's some AWS thing. 

2021-02-11 03:17:41 ERROR (SyncWorker_2) [homeassistant.components.dyson] Not connected to Dyson account. Unable to add devices
2021-02-11 03:17:41 INFO (MainThread) [homeassistant.setup] Setup of domain dyson took 0.6 seconds
2021-02-11 03:17:41 ERROR (MainThread) [homeassistant.setup] Setup failed for dyson: Integration failed to initialize.
2021-02-11 03:17:41 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=persistent_notification, service=create, service_data=title=Invalid config, message=The following integrations and platforms could not be set up:
- dyson
Please check your config and [logs](/config/logs)., notification_id=invalid_config>
2021-02-11 03:17:41 DEBUG (SyncWorker_0) [botocore.utils] Caught retryable HTTP exception while making metadata service request to http://169.254.169.254/latest/api/token: Connect timeout on endpoint URL: "http://169.254.169.254/latest/api/token"
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 169, in _new_conn
conn = connection.create_connection(
File "/usr/local/lib/python3.8/site-packages/urllib3/util/connection.py", line 96, in create_connection
raise err
File "/usr/local/lib/python3.8/site-packages/urllib3/util/connection.py", line 86, in create_connection
sock.connect(sa)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/botocore/httpsession.py", line 311, in send
urllib_response = conn.urlopen(
File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "/usr/local/lib/python3.8/site-packages/urllib3/util/retry.py", line 506, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/local/lib/python3.8/site-packages/urllib3/packages/six.py", line 735, in reraise
raise value
File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 394, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 234, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers)
File "/usr/local/lib/python3.8/http/client.py", line 1255, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/lib/python3.8/site-packages/botocore/awsrequest.py", line 92, in _send_request
rval = super(AWSConnection, self)._send_request(
File "/usr/local/lib/python3.8/http/client.py", line 1301, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.8/http/client.py", line 1250, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.8/site-packages/botocore/awsrequest.py", line 120, in _send_output
self.send(msg)
File "/usr/local/lib/python3.8/site-packages/botocore/awsrequest.py", line 204, in send
return super(AWSConnection, self).send(str)
File "/usr/local/lib/python3.8/http/client.py", line 950, in send
self.connect()
File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 200, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 174, in _new_conn
raise ConnectTimeoutError(
urllib3.exceptions.ConnectTimeoutError: (<botocore.awsrequest.AWSHTTPConnection object at 0x7f41143bd5e0>, 'Connection to 169.254.169.254 timed out. (connect timeout=1)')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/botocore/utils.py", line 377, in _fetch_metadata_token
response = self._session.send(request.prepare())
File "/usr/local/lib/python3.8/site-packages/botocore/httpsession.py", line 344, in send
raise ConnectTimeoutError(endpoint_url=request.url, error=e)
botocore.exceptions.ConnectTimeoutError: Connect timeout on endpoint URL: "http://169.254.169.254/latest/api/token"
2021-02-11 03:17:41 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=persistent_notification.invalid_config, old_state=None, new_state=<state persistent_notification.invalid_config=notifying; title=Invalid config, friendly_name=Invalid config, message=The following integrations and platforms could not be set up:
- dyson

I'm running the qcow2 image in KVM. Happy to muck about with suggested tweaks if it helps narrow down the issue.

kintaroju commented 3 years ago

yea, I'm in the same boat as well, just upgraded to 2021.3.0 and it isn't working anymore

Did the following:

  1. sign out of Dyson App on Phone
  2. Apply fix to HA with bfayers code
  3. signed in Dyson App with the 2FA code (which is new, which I noticed, which other people noticed as well)
  4. quickly try to restart HA right after logging in Dyson App on Phone

If i am missing a step above let me know, thanks!

Also if there are documented ways how to do shenxn\ha-dyson setup, I'm all ears too! (I've read the whole thread, and there wasn't a direct connection/documented way to do it, unless i am super blind, [has happened, sorry in advanced])

oneseventhree commented 3 years ago

curl -O https://raw.githubusercontent.com/bfayers/libpurecool/fix_auth/libpurecool/dyson.py

anyone know why this doesn't work on Home Assistant Core 2021.3? It worked on the previous release for me.

The Dyson Fan entity doesn't show up BUT the climate entity does so its half working. Why wouldn't the fan entity work?

EDIT: I had to DELETE the iPhone App and reinstall - the UI changed on the app so I am guessing there was an update and now it all works - Hope this helps someone else :)

Parlane commented 3 years ago

To those having issues after 2021.3.0 did you rerun the pip3 install after doing your docker recreate?

After singing in to the android dyson link app again and restart my HA instance, it did connect correctly in HA.

richlawson commented 3 years ago

To those having issues after 2021.3.0 did you rerun the pip3 install after doing your docker recreate?

@Parlane, yes. I even did it a second time just to make sure I didn't miss an error message or some other issue.

ddp526 commented 3 years ago

I logged out of my dyson app and re-logged in with the new 2FA code (but forgot to re-apply the fix to the dyson.py file)

Probably half an hour later I applied this fix: curl -O https://raw.githubusercontent.com/bfayers/libpurecool/fix_auth/libpurecool/dyson.py

Then I restarted HA, and it worked for me.

3mta3 commented 3 years ago

Interesting - reapplied the docker fix and ran through the app logout / login / restart server (HassOS) and the native Dyson integration worked again. An hour later I rebooted the host and the integration errored out on load. Ran through logout / in / restart server and it came back. I'd try to recreate the issue with another host reboot but I'm not touching a thing for a while..

lolongan commented 3 years ago

yea, I'm in the same boat as well, just upgraded to 2021.3.0 and it isn't working anymore

Did the following:

  1. sign out of Dyson App on Phone
  2. Apply fix to HA with bfayers code
  3. signed in Dyson App with the 2FA code (which is new, which I noticed, which other people noticed as well)
  4. quickly try to restart HA right after logging in Dyson App on Phone

If i am missing a step above let me know, thanks!

Also if there are documented ways how to do shenxn\ha-dyson setup, I'm all ears too! (I've read the whole thread, and there wasn't a direct connection/documented way to do it, unless i am super blind, [has happened, sorry in advanced])

This trick works for me too. Edit: but only when the Dyson App is accessing internet from the same IP address as HA.

curt7000 commented 3 years ago

Still on 2021.2.3 (due to other issues), but the signing out and back in trick worked for me as well.

mklik commented 3 years ago

Did the following:

  1. sign out of Dyson App on Phone
  2. Apply fix to HA with bfayers code
  3. signed in Dyson App with the 2FA code (which is new, which I noticed, which other people noticed as well)
  4. quickly try to restart HA right after logging in Dyson App on Phone

If i am missing a step above let me know, thanks!

Worked also for me with 2021.3.1 even my Android phone doesn't require 2FA code ...

ddp526 commented 3 years ago

I think it is worth adding, that I updated HA again today, once again the integration was broken. Applied the curl fix, restarted HA, still broken. I did not log out of my dyson app and sign back in, I just used it - then restarted HA again, and it is now working.

mklik commented 3 years ago

I did not log out of my dyson app and sign back in, I just used it - then restarted HA again, and it is now working.

Same for me. Updated to HA 2021.3.2 and integration stopped working. Noticed a new version of Dyson App on Android but didn't log of and on, just used it. After applying the curl fix and restarting HA everything is fine.

vdheidenet commented 3 years ago

Same here,

update to latest version (2021.3.2 in my case), curl fix (see attached Dyson_problemen.txt), logout of Dyson app, reboot HA, login into Dyson app.

SOLVED

febalci commented 3 years ago

Still using HA 2021.1.5, not updated. I did applied curl fix some time ago and it was working, and now it is not. So;

logout of Dyson login again with 2FA code sent to my e-mail restart HA

now it is working again.

yogoo commented 3 years ago

Using HA 2021.3.2.

Applied the curl fix, logged out of the Dyson iOS app, logged back in, used the app, restarted HA.

The integration works again. Not 2FA on the iOS app though.

kintaroju commented 3 years ago

ok, after having to redig into the issue, the permanent solution i have is this:

  1. install HACS
  2. add the following repositories to HACS:
  3. go to configuration -> integration -> + new integration -> dyson cloud
  4. enter your credentials including the 2FA code (yes 2FA code hooray!) and then fill in IP information for each dyson device it finds for you (yes you don't need to fill in stuff in configuration.yaml anymore)
  5. Done!
afk11 commented 3 years ago

@kintaroju Thanks for the report. That's the most workable solution I've seen so far. Hoping they get it into HA soon

emdimon commented 3 years ago

I've tried the HACS ha-dyson solution but keep getting "config flow could not be loaded" when I try to integrate Dyson cloud. Any thoughts ?

kintaroju commented 3 years ago

@emdimon did you install both integrations? For the config flow could now be loaded can you send a screenshot where that is happening?

emdimon commented 3 years ago
Screenshot 2021-03-08 at 18 43 22 Screenshot 2021-03-08 at 18 42 59

Get the config flow error when trying to add either integration

kintaroju commented 3 years ago

@emdimon you might want to clean up both integrations and re-install as it should look like the below:

image

Basically it needs dyson local to work with dyson cloud, without it, that is probably why you are getting the error

kintaroju commented 3 years ago

@emdimon just to add one more thing, in HACS, for custom repositories, make sure both are listed below:

image

emdimon commented 3 years ago

@kintaroju huge thanks. All now working.

kintaroju commented 3 years ago

so now the big question, how can we get the shenxn dyson integration into the main HA-Core setup and drop the legacy version?

3mta3 commented 3 years ago

Native integration: I've noticed you don't need to log out / in on the Dyson mobile app to clear the error (/me on Android) - open HA mobile, open Dyson mobile, restart HA (restart core, restart server, reboot host all seem to work); must be a token refresh refresh / aging cycle on the Dyson app now.. You only need to run the auth-fix after HA updates.

fwiw I've never had much luck with HACS - my system invariably becomes unstable, many errors, much instability, always end up restoring a pre-hacs snap.

gobigdave commented 3 years ago

I notice now that if you have the latest Dyson mobile app, it now requires a 6 digit code in addition to a password to login. If the API requires the same, then that would explain why the HA integration stopped working. There isn't a way to use the code.

flyjer commented 3 years ago

ok, after having to redig into the issue, the permanent solution i have is this:

  1. install HACS
  2. add the following repositories to HACS:
  1. go to configuration -> integration -> + new integration -> dyson cloud
  2. enter your credentials including the 2FA code (yes 2FA code hooray!) and then fill in IP information for each dyson device it finds for you (yes you don't need to fill in stuff in configuration.yaml anymore)
  3. Done!

Hi, sorry new to HA. I've done steps 1, 2 but when I do step 3, I don't see the 'Dyson Cloud' option after clicking on '+ New Integration'. Have I missed some steps? Thanks!

3mta3 commented 3 years ago

Hi, sorry new to HA. I've done steps 1, 2 but when I do step 3, I don't see the 'Dyson Cloud' option after clicking on '+ New Integration'. Have I missed some steps? Thanks!

Have you tried clearing your browser cache or surfing to the integrations page in incognito mode? A few have noted that was required after installing and before the integration showed up. Fwiw I had the same issue a while back and gave up - so let me know if that works for you :)

ronaldwigman commented 3 years ago

Try to log out and log in to your Dyson account in the app and then connect through HA

flyjer commented 3 years ago

Hi, sorry new to HA. I've done steps 1, 2 but when I do step 3, I don't see the 'Dyson Cloud' option after clicking on '+ New Integration'. Have I missed some steps? Thanks!

Have you tried clearing your browser cache or surfing to the integrations page in incognito mode? A few have noted that was required after installing and before the integration showed up. Fwiw I had the same issue a while back and gave up - so let me know if that works for you :)

Hi, sorry new to HA. I've done steps 1, 2 but when I do step 3, I don't see the 'Dyson Cloud' option after clicking on '+ New Integration'. Have I missed some steps? Thanks!

Have you tried clearing your browser cache or surfing to the integrations page in incognito mode? A few have noted that was required after installing and before the integration showed up. Fwiw I had the same issue a while back and gave up - so let me know if that works for you :)

Thank-you stupid-I-clever. I accessed it using a different device and the Dyson integrations are now appearing and have successfully setup my Dyson fans.

watotoro commented 3 years ago

ok, after having to redig into the issue, the permanent solution i have is this:

  1. install HACS
  2. add the following repositories to HACS:
  1. go to configuration -> integration -> + new integration -> dyson cloud
  2. enter your credentials including the 2FA code (yes 2FA code hooray!) and then fill in IP information for each dyson device it finds for you (yes you don't need to fill in stuff in configuration.yaml anymore)
  3. Done!

This worked for me but I just want to tell everyone to make sure your fan is actively on. Being in standby isn't enough. At least it wasn't for me. This did work though once my fan was on. Thank you!

ronaldwigman commented 3 years ago

Hi,

You have to logout off and login to the Dyson app (everytime) when you start HA. This uses a two-factor authentication where you get a new code in your e-mail.

Regards, Ronald

On 13 Mar 2021, at 13:17, flyjer @.***> wrote:

 Hi, sorry new to HA. I've done steps 1, 2 but when I do step 3, I don't see the 'Dyson Cloud' option after clicking on '+ New Integration'. Have I missed some steps? Thanks!

Have you tried clearing your browser cache or surfing to the integrations page in incognito mode? A few have noted that was required after installing and before the integration showed up. Fwiw I had the same issue a while back and gave up - so let me know if that works for you :)

Hi, sorry new to HA. I've done steps 1, 2 but when I do step 3, I don't see the 'Dyson Cloud' option after clicking on '+ New Integration'. Have I missed some steps? Thanks!

Have you tried clearing your browser cache or surfing to the integrations page in incognito mode? A few have noted that was required after installing and before the integration showed up. Fwiw I had the same issue a while back and gave up - so let me know if that works for you :)

Thank-you stupid-I-clever. I accessed it using a different device and the Dyson integrations are now appearing and have successfully setup my Dyson fans.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

oneseventhree commented 3 years ago

the step that is missed is "RESTART HA after you install the HACS respos" :)

Khengsoon commented 3 years ago

Hi guys, is anyone got the error message "GitHub Ratelimit error" when trying to add the custom repository? May I know how to resolve this issue?

Thanks in advance Regards, Kheng Soon

ndwalters commented 3 years ago

Hi guys, is anyone got the error message "GitHub Ratelimit error" when trying to add the custom repository? May I know how to resolve this issue?

Thanks in advance Regards, Kheng Soon

Set up a new Github Api key in HACS

WilldabeastHA commented 3 years ago

@febalci @vdheidenet @mklik @lolongan the curl fix doesn't work for me in 2021.6 - is it working for you?

I'm using the following: cd /usr/local/lib/python3.8/site-packages/libpurecool/ rm dyson.py curl -O https://raw.githubusercontent.com/bfayers/libpurecool/fix_auth/libpurecool/dyson.py

gobigdave commented 3 years ago

Stopped working for me as well.

kintaroju commented 3 years ago

Stopped working for me as well.

Please refer to my workaround as they haven't integrated shenxn's solution as that one works like hot cakes.

FYI with ShenXN's solution I've been running it stable for the last few months since Dyson integrated 2FA

ok, after having to redig into the issue, the permanent solution i have is this:

  1. install HACS
  2. add the following repositories to HACS:
  1. go to configuration -> integration -> + new integration -> dyson cloud
  2. enter your credentials including the 2FA code (yes 2FA code hooray!) and then fill in IP information for each dyson device it finds for you (yes you don't need to fill in stuff in configuration.yaml anymore)
  3. Done!
WilldabeastHA commented 3 years ago

Stopped working for me as well.

Please refer to my workaround as they haven't integrated shenxn's solution as that one works like hot cakes.

FYI with ShenXN's solution I've been running it stable for the last few months since Dyson integrated 2FA

ok, after having to redig into the issue, the permanent solution i have is this:

  1. install HACS
  2. add the following repositories to HACS:
  1. go to configuration -> integration -> + new integration -> dyson cloud
  2. enter your credentials including the 2FA code (yes 2FA code hooray!) and then fill in IP information for each dyson device it finds for you (yes you don't need to fill in stuff in configuration.yaml anymore)
  3. Done!

I’ve been resistant to installing HACS I want to keep my HA install simple and love how much is integrated into core. Is there a way that this workaround can bu put into core?

kintaroju commented 3 years ago

Stopped working for me as well.

Please refer to my workaround as they haven't integrated shenxn's solution as that one works like hot cakes. FYI with ShenXN's solution I've been running it stable for the last few months since Dyson integrated 2FA

ok, after having to redig into the issue, the permanent solution i have is this:

  1. install HACS
  2. add the following repositories to HACS:
  1. go to configuration -> integration -> + new integration -> dyson cloud
  2. enter your credentials including the 2FA code (yes 2FA code hooray!) and then fill in IP information for each dyson device it finds for you (yes you don't need to fill in stuff in configuration.yaml anymore)
  3. Done!

I’ve been resistant to installing HACS I want to keep my HA install simple and love how much is integrated into core. Is there a way that this workaround can bu put into core?

You might want to talk to ShenXN and see if he has cycles to help HA to integrate it into core, since the native dyson plugin is no longer compliant with the new dyson setup.

I've made this request a few months ago, but haven't seen any new traction

WilldabeastHA commented 3 years ago

Stopped working for me as well.

Please refer to my workaround as they haven't integrated shenxn's solution as that one works like hot cakes. FYI with ShenXN's solution I've been running it stable for the last few months since Dyson integrated 2FA

ok, after having to redig into the issue, the permanent solution i have is this:

  1. install HACS
  2. add the following repositories to HACS:
  1. go to configuration -> integration -> + new integration -> dyson cloud
  2. enter your credentials including the 2FA code (yes 2FA code hooray!) and then fill in IP information for each dyson device it finds for you (yes you don't need to fill in stuff in configuration.yaml anymore)
  3. Done!

I’ve been resistant to installing HACS I want to keep my HA install simple and love how much is integrated into core. Is there a way that this workaround can bu put into core?

You might want to talk to ShenXN and see if he has cycles to help HA to integrate it into core, since the native dyson plugin is no longer compliant with the new dyson setup.

I've made this request a few months ago, but haven't seen any new traction

I’m not super technical but is there a way to just pull / CURL these files from ShenXN repo into the HA Core?

ProLoser commented 3 years ago

@WilldabeastHA the easiest solution is to just install HACS. Your concerns with avoiding it are unfounded and it requires more work for people to provide instructions for workarounds when HACS is a perfectly adequate UI

geekofweek commented 3 years ago

I’ve been resistant to installing HACS I want to keep my HA install simple and love how much is integrated into core. Is there a way that this workaround can bu put into core?

The creator of HACS (Joakim Sørensen) works for NabuCasa, so I wouldn't be too worried about HACS. The only way this will get merged into the core is if somebody submits a pull request to either fix the existing integration or replace it with new version based on the ShenXN changes. It appears the original maintainer of libpurecool has abandoned it so some forks and changes need to be made there to get it moving again. That needs to happen but it also needs people with enough time and effort to get involved and make that happen.

If you want a quick fix, HACS and the ShenXN custom integration.

c0bra99 commented 3 years ago

I have been holding off any of these fixes hoping the fix would be added to Core, but today I removed all existing dyson integration and entities, added the dyson-local integration to HACS and set up the device using wifi information using the instructions here: https://github.com/shenxn/ha-dyson/

It was super easy, and everything is working fine, wish I did it sooner! Thanks for posting the instructions to add the repository to HACS, it made me finally do it.

Kernald commented 3 years ago

At this point, the core integration has been broken for months. If nobody wants to put the time in to fix it (which is fair enough, no complaint here), it might be worth removing it entirely, there's no point keeping broken code around except letting new users think this is a working integration when it's not. Or at the very least updating the documentation to make it obvious.

bfayers commented 3 years ago

I had originally intended on opening a PR to fix the version in core, however at this point it would be wasted work as shenxn's is much better and as they mention; ultimately intend for it to become official.

WilldabeastHA commented 3 years ago

Looking forward to it becoming official. I’ll try the HACS route. Is it best to install it in the container or the host?

**Quick update. I installed HACS and the ShenXN Dyson integration and I’m presently surprised! Works great and easy to use. Thanks for the encouragement.

github-actions[bot] commented 3 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Kernald commented 3 years ago

This is still an issue pending #53801.

slepiavka commented 2 years ago

At this point, the core integration has been broken for months. If nobody wants to put the time in to fix it (which is fair enough, no complaint here), it might be worth removing it entirely, there's no point keeping broken code around except letting new users think this is a working integration when it's not. Or at the very least updating the documentation to make it obvious.

Agree, it's just misleading to have a posted official integration on HA's site. Is there an official deprecation procedure?

mig8447 commented 2 years ago

If someone has the time to give me some pointers on how to diagnose the authentication issue based on past experiences I can give a try to this, so far I've attempted to diagnose this myself with no success