core: Shark IQ Failed to Set Up

The problem

The Shark IQ was working correctly yesterday at some point overnight it stopped working so I tried a reboot just to see if something was weird with the connection and when everything came back up, this.

image

What version of Home Assistant Core has the issue?

core-2022.2.0b5

What was the last working version of Home Assistant Core?

core-2021.10

What type of installation are you running?

Home Assistant OS

Integration causing the issue

sharkiq

Link to integration documentation on our website

https://rc.home-assistant.io/integrations/sharkiq

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.config_entries
Source: components/sharkiq/__init__.py:58
First occurred: 7:16:06 AM (1 occurrences)
Last logged: 7:16:06 AM

Error setting up entry myemail@gmail.com for sharkiq
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 327, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/sharkiq/__init__.py", line 58, in async_setup_entry
    shark_vacs = await ayla_api.async_get_devices(False)
  File "/usr/local/lib/python3.9/site-packages/sharkiqpy/ayla_api.py", line 213, in async_get_devices
    devices = [SharkIqVacuum(self, d) for d in await self.async_list_devices()]
  File "/usr/local/lib/python3.9/site-packages/sharkiqpy/ayla_api.py", line 199, in async_list_devices
    devices = await resp.json()
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1103, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain;charset=utf-8', url=URL('https://ads-field.aylanetworks.com/apiv1/devices.json')

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 48

Most upvoted comments

hello everyone! I was having the same problem. I’ve edited the file as per @netman74501 instructions. and it works fine now. So I guess we need an update for this integration.

I can confirm that changing DEVICE_URL from https://ads-field.aylanetworks.com to https://ads-apiv1-sharkue1.aylanetworks.com in /usr/local/lib/python3.9/site-packages/sharkiqpy/const.py on my docker container fixed the Shark IQ integration in Home Assistant for me. A very easy fix indeed.

I could tell from the logs in Home Assistant that it was something in the underlying sharkiqpy library, but I hadn’t had time to delve into it yet so thanks for doing the legwork!

@kmain4 if you are running HA OS, you can install an SSH & Web Terminal Community Add-On. Disable protected mode (not sure if it’s needed). logon and than you can run docker exec -it homeassistant vi /usr/local/lib/python3.9/site-packages/sharkiqpy/const.py command to edit the file.

I did it and it worked fine.

I spun up a VM to test. Looks like you have a command line in the VM which is referred to as the HA CLI. At this command line, you can type “login” to drop to a real Linux shell where you can then run the command I previously posted to edit the file using VI:

docker exec -it homeassistant /usr/bin/vi /usr/local/lib/python3.9/site-packages/sharkiqpy/const.py

Press “i” to enter edit mode, edit the DEVICE_URL to be https://ads-apiv1-sharkue1.aylanetworks.com, then press ESC and type “:wq” followed by pressing ENTER. Then type “exit” at the command line to get back to the HA CLI where you can use the regular HA commands to reboot the system. (e.g. core restart)

That is the file’s contents. You would edit the DEVICE_URL to be https://ads-apiv1-sharkue1.aylanetworks.com by pressing “i” to edit and then save as I previously described.

If you have nano available, I would use that instead as suggested. It is a much easier editor to work with.

I’m more familiar with nano but that command didn’t work. I did get it to work with the VI editor.

For individuals not familiar with VI. Press “I” to enter the edit mode, make your changes, Press “I” to exit the edit mode, and Press and Hold Shift+ZZ to save.

After I restarted my container the vacuum is up and running as it used to be. Thank you everyone for your help!

That is the file’s contents. You would edit the DEVICE_URL to be https://ads-apiv1-sharkue1.aylanetworks.com by pressing “i” to edit and then save as I previously described.

If you have nano available, I would use that instead as suggested. It is a much easier editor to work with.

This is what I’m seeing

“”“Various constants”“”

DEVICE_URL = “https://ads-field.aylanetworks.com” LOGIN_URL = “https://user-field.aylanetworks.com” SHARK_APP_ID = “Shark-Android-field-id” SHARK_APP_SECRET = “Shark-Android-field-passwordhere”

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

  • /usr/local/lib/python3.9/site-packages/sharkiqpy/const.py 4/7 57%

Have you ever used VI before? It’s a pretty involved editor, you need to enter editing mode, edit the URL, then press ESC, :wq, and it’s done

Also try this command instead since pi should have nano installed and you may be more familiar with that

docker exec -it homeassistant nano /usr/local/lib/python3.9/site-packages/sharkiqpy/const.py

It’s likely this was an unintended consequence of some larger update they made. Disappointing, because this integration was really nice, it made it so I could actually set the vacuum to Max automatically, a feature that I am amazed their app still does not support.

I know it’s still early and someone could come up with a fix, but just thought I’d drop the shark customer service link here in case anyone wants to call in and see if they’ll take in feedback / requests.

https://support.sharkclean.com/hc/en-us/articles/4403101981714-Contact-Us

I intend on calling in over the next few days. My experience with Shark CS has been positive in the past. I feel they really care about their customers and that is why they make such excellent products. Honestly, it kind of disappoints me that they are not a part of this community nor seem to be concerned about native HomeKit support, but maybe if enough of us call in then this could be an opportunity to change that.

Our use of the API is unofficial and unsupported. I believe the capabilities we are using were made available through reverse engineering and contacting them may be a bad idea. If they’re crippling our integration unintentionally, calling them about this issue may cause them to permanently and intentionally block our ability to use this api.