core: shark stopped working 2 days ago. vacuums shown as unavailable

The problem

sharkiq stopped working 2 days ago. both of my robots are shown as unavailable in home assistant. I tried to reload the integration or restart HA… problem is still present.

I also tried to manually edit the device url as described in some other thread without success.

my vacuum robots are accessible through the sharkclean app.

it stopped working when I was on 2022.3.6. I just upgrade to 2022.3.7 and problem is still present.

What version of Home Assistant Core has the issue?

core-2022.3.7

What was the last working version of Home Assistant Core?

core-2022.3.6

What type of installation are you running?

Home Assistant OS

Integration causing the issue

sharkiq

Link to integration documentation on our website

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

Diagnostics information

none

Example YAML snippet

No response

Anything in the logs that might be useful for us?

I set log level to "debug" for this integration. 
no errors are shown. all looks fine. 

here's what I'm getting:
2022-03-24 10:53:46 DEBUG (MainThread) [homeassistant.components.sharkiq] Updating sharkiq data
2022-03-24 10:53:46 DEBUG (MainThread) [homeassistant.components.sharkiq] Finished fetching sharkiq data in 0.203 seconds (success: True)
2022-03-24 10:54:04 DEBUG (MainThread) [homeassistant.components.sharkiq] Disconnecting from Ayla Api
2022-03-24 10:54:04 DEBUG (MainThread) [homeassistant.components.sharkiq] Initialize connection to Ayla networks API
2022-03-24 10:54:04 DEBUG (MainThread) [homeassistant.components.sharkiq] Found 2 Shark IQ device(s): Alfred, Aline
2022-03-24 10:54:05 DEBUG (MainThread) [homeassistant.components.sharkiq] Updating sharkiq data
2022-03-24 10:54:05 DEBUG (MainThread) [homeassistant.components.sharkiq] Finished fetching sharkiq data in 0.123 seconds (success: True)
2022-03-24 10:54:05 DEBUG (MainThread) [homeassistant.components.sharkiq] Found 2 Shark IQ device(s): Alfred, Aline
2022-03-24 10:54:35 DEBUG (MainThread) [homeassistant.components.sharkiq] Updating sharkiq data
2022-03-24 10:54:35 DEBUG (MainThread) [homeassistant.components.sharkiq] Finished fetching sharkiq data in 0.200 seconds (success: True)

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 32 (13 by maintainers)

Most upvoted comments

So I did some digging and found out some info…

First I did a test of the upstream package that this integration relies on by running this:

from sharkiqpy import get_ayla_api

USERNAME = '[REDACTED]'
PASSWORD = '[REDACTED]'

ayla_api = get_ayla_api(USERNAME, PASSWORD)
ayla_api.sign_in()

shark_vacs = ayla_api.list_devices()
print(shark_vacs)

Which returned the following information

[{'product_name': '[REDACTED]', 'model': '[REDACTED]', 'dsn': '[REDACTED]', 'oem_model': '[REDACTED]', 'sw_version': 'devd 1.7 2020-11-20 16:58:53', 'template_id': 43306, 'mac': '[REDACTED]', 'unique_hardware_id': None, 'lan_ip': '[REDACTED]', 'connected_at': '2021-10-31T03:59:23Z', 'key': [REDACTED], 'lan_enabled': False, 'connection_priority': [], 'has_properties': True, 'product_class': None, 'connection_status': 'Offline', 'lat': '[REDACTED]', 'lng': '[REDACTED]', 'locality': '[REDACTED]', 'device_type': 'Wifi', 'dealer': None}]

It states that the device is offline, but checking the Shark app, it is indeed online.

Just as a test, I removed line 67 in update_coordinator.py which removes the requirement for the Shark Vacuum to be online before controlling it, and now it shows up properly in Home Assistant.

I found that the battery level displayed in Home Assistant is incorrect though, as the battery level shown is 5% on Home Assistant, yet the app reports it is docked and fully charged.

Attempting to investigate that issue, I ran the following code just testing the upstream package

from sharkiqpy import get_ayla_api, Properties

USERNAME = '[REDACTED]'
PASSWORD = '[REDACTED]'

ayla_api = get_ayla_api(USERNAME, PASSWORD)
ayla_api.sign_in()

shark_vacs = ayla_api.get_devices()
shark = shark_vacs[0]

shark.update()
battery = shark.get_property_value(Properties.BATTERY_CAPACITY)
print(battery)

Which returned

5

Which is not what matches the app: Screenshot

Some more digging might be required to get to the bottom of this, but Shark likely updated parts of its API and the upstream package will liekly need to updated.

So how do I get this fix?

@400HPMustang there’s no published fix yet. you have to wait or edit the file manually. if you are running HA OS, in a terminal window, run this command : docker exec -it homeassistant vi /usr/local/lib/python3.9/site-packages/sharkiqpy/const.py

and edit the device url and login url line. DEVICE_URL = “https://ads-field-39a9391a.aylanetworks.com” LOGIN_URL = “https://user-field-39a9391a.aylanetworks.com

Anyone want to volunteer as tribute to fork the repo and be the new maintainer?

https://github.com/JeffResc/sharkiq https://pypi.org/project/sharkiq/

Edit: image Works, I’ll submit a PR shortly

a quick follow up on this issue… with the new URLs, all is working fine. my automations worked fine this morning.

we are only missing the official fix now 😉

The formatting would appear to be ##a###a.aylanetworks.com user-field-yyy9391a.aylanetworks.com ads-field-yyy9391a.aylanetworks.com

I can confirm that I’m seeing URLs of this format as well. Are we certain that this is a per-user hash, or is it possible that they just updated the URL to a URL that seems like it is a unique hash?

Having a look until mitmproxy, the login URL is in the format: https://user-field-yyy9391a.aylanetworks.com/users/sign_in.json, so this URL is actually determined before the user login process. In terms of where the app got this URL, I don’t see any other relevant network connections before this one, so it seems to be “baked into” the app’s code, not loaded in dynamically from a static URL.

@lishan89uc I don’t think so. I tried to change the url and it didn’t work. and also there’s no error shown anywhere… vacuums are just unavailable.