core: SharkIQ Integration loses connection frequently; integration must be reloaded daily.
The problem
My Shark vacuums lose connection with home assistant frequently, approximately once per day (but I have not timed it). They show ‘unavailable’ state. Reloading the integration fixes it immediately and the correct state is shown. From logs it appears to be an authentication issue.
Environment
- Home Assistant Core release with the issue: 2020-12-1
- Last working Home Assistant Core release (if known): never
- Operating environment (OS/Container/Supervised/Core): Supervised
- Integration causing this issue: sharkiq
- Link to integration documentation on our website: https://www.home-assistant.io/integrations/sharkiq/
Problem-relevant configuration.yaml
none, set up with UI
Traceback/Error logs
There are over 1200 instances of the word ‘shark’ in my logs, but this seems to be the one causing the problem. If you’d like all of the shark errors I can dive deeper.
2020-12-20 13:16:31 ERROR (MainThread) [homeassistant.components.sharkiq] Error fetching sharkiq data: Ayla Networks API authentication expired. Re-authenticate and retry.
Additional information
Since this is seemingly an issue with Ayla Networks and not HA, perhaps adding a service to reload the integration without visiting the integrations page would be a good workaround. Then I could simply automate that if my vacuums become unavailable the integration is reloaded.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 4
- Comments: 77 (14 by maintainers)
Fixed it with automation that reloads integration once robot becomes unavailable
<token> is long lived token I’ve generated in profile section) <entry> is integration id I’ve captured using chrome inspector while reloading integration from gui
Hi guys, sorry again for not fixing this yet, but I wanted to at least give everybody an update. The issue is in the authentication flow. The login credentials are good for 24 hours, and then they need to be refreshed. That refresh is what’s not working, but it is why the workaround of restarting the integration fixes it. I’ve been slammed with a new job the past few months, but I feel really bad that this is still broken, and I’m going to fix this as soon as I can.
This still happens every day for me, and makes automations around the Shark integration unreliable
Sorry it took so long everyone! Unfortunately I was laid off in TheGreatTechLayoffs™️ and have had to spend all of my time job hunting. Got a new job thankfully so I’m trying to get all of this knocked out before I start next week.
PR IS UP #89357
Hopefully things will be more streamlined moving forward. Thanks for your patience!
@roborobp open up the “Network” tab after hitting F12, then navigate to the integrations screen in Home Assistant, select the 3-dot menu for the Shark integration, then click “Reload”. You should see that request appear in the network tab. Look for the ID as part of the URL.
The code for all (including room-level support) has been written, but the HA maintainers want it divided up into multiple PRs. Which is understandable as it is a lot of changes. Hoping to have that done this weekend.
This fix will be available in the 2023.4.5 minor release.
I don’t know wether I’m the only one having the issue but ever since 2022.8.x the integration has been broken anyways.
it works for a few hours then go unavailable and it’s no longer just a reload I have to delete and run the setup again : Error fetching sharkiq data: 0, message=‘Attempt to decode JSON with unexpected mimetype: text/html;charset=utf-8’, url=URL(‘https://ads-field-39a9391a.aylanetworks.com/apiv1/devices.json’)
Hi there, how is this coming?
I would really like to get my vacuum working consistently.
The integration does not seem to be fixed however home assistant has made quite a lot of progress since the start of this issue and I just want to put in my 2 cents on the workaround. Instead of calling a shell command you can just call the
service: homeassistant.reload_config_entry
. So the automation would look something like this.p.s. the automation look so weird because i created it with the ui.
Thanks and glad you found a job! Looking forward to the next PR where you introduce the ability to clean by room!
bump - happy to help
@proactivematter I think I’ve resolved the latest issue for now, but I’ll need the project owner @ajmarks to merge my super simple PR. At a lower level, I was able to reproduce this error just by manual invokation of functions in the
sharkiq
library, and my fixes resolved those issues. I suspect they should do the same for the HA integration itself.It took me a bit, too. You have to open the inspector in your browser by F12. Then click on the icon in the inspector that looks like a mouse cursor over a pad (at least that’s what it looks like for me). Then you will see different areas in the integration card hightlight as you hover over them. Click on a portion of the card, and find the part that looks like this:
< ha-card outlined=“” class=“single integration” id=“xxxxxxxxxxxxxxxxxxxxxxxxxxxx” >
Where ‘x’ will be your specific ID number. Then enter this command, substituting your long term for ‘y’ and ID. This all goes in the configuration.yaml file.
Shell commands
shell_command: shark_restart: “/usr/bin/curl -X ‘POST’ -H ‘authorization: Bearer yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy’ http://localhost:8123/api/config/config_entries/entry/xxxxxxxxxxxxxxxxxxxxxxxxxxxxx/reload”
Hope this helps a little more
Hi Kafer It does, except your example in step 4 was cut off. This is the output I captured when executing the reload.
EDIT: I think I got it!! Thanks for the help!