Shark IQ Robot

Yea, I'm not sure how I can test this. I did find another implementation (via Python), here: GitHub - ajmarks/sharkiq: Python API for Shark IQ robot

See if you're able to manipulate your groovy driver with the App_id and App_Secret, listed on that project. Those values are:

I tried editing the driver but same error.
def body = """{"user":{"email":"$loginusername","application":{"app_id":"Shark-Android-field-id","app_secret":"Shark-Android-field-Wv43MbdXRM297HUHotqe6lU1n-w"},"password":"$loginpassword"}}"""

I will try to run the python code tomorrow and see if I can get any further.

I've also am reaching out to that dev to see how they got those app_id and app_secret values: App_id and App_Secret ยท Issue #2 ยท ajmarks/sharkiq ยท GitHub

OK,
I'm on the aylanetworks.com site as a "developer" looking around and reading some of the doc....

I have an idea. I'm going to grab the android apk and see what I can find. My brother is a mobile app developer so I can ask him for help.

I found this "Shark-Android-field-Wv43MbdXRM297HUHotqe6lU1n-w" in a resource file within the apk Same as the python app.

I honestly think they're shared. I just did another packet capture and verified my ios field was the same as I previously made. - The 1st call out to the aylanetworks endpoint included it, so it's not like a login happened, that was returned and a subsequent call included it then.

Wait, hold on a sec. So the error you're getting is during the "runCmd". At that point, you're already logged in. So something with the URI for that command is wrong. (Datapoints.json)... let me look.

Based on the debug entry:
Response received from Shark in the postReponseHandler. [approved:true, confirmed:true,
The data after that is absolutely telling me I'm logged in. I see all of my account info.

Yep, it's the issue is with this URI path:

path: "/apiv1/properties/171735600/datapoints.json",

Specifically the 17135600. That seems to be linked to MY shark device. Obviously, you can have multiple devices per account, and they've switched this up to use a new dsn value.

This can retrieved using the GET /apiv1/devices.json endpoint. I can probably work that into the code easily, but will probably have to add a text field for the Device Name (enter your own), and I'll add a drop down for the Android ids that we talked about before.

2 Likes

Cool! I'm out of time tonight. I'll check this again in the morning and report. Thanks for the work to get this going. It's one more device in the house I will have access to. What's I'll do with it, I don't know. It may just be a device to monitor for proper operation. Or It could be on a schedule.

Thanks again!!

No problem. It's obviously not as complex as that python one out there, but this should at least get some folks going with implementation. - I'll update here if I get anything working tonight...I might need to code the rest of it tomorrow.

So I spent way too much time on this tonight (I can't sleep when things are broken - A horrible habit), but I believe I've got it working now. You'll need to populate the Device Name and Mobile Device within the settings after updating the driver.

I've discovered that the app_id and app_secret are useless. It merely is for identification for Shark to know what device you're using. So for now, I've kept the Mobile Device option in there, if you'd like to spoof that the request comes from either an Android or iOS device.

I've revised some of the code as well to better handle future endpoint implementation. Shark makes it somewhat nice in that they simply change the URL for the endpoint you're trying to hit (SET_Operating_Mode, SET_Power_Mode, etc.) - And the body simply contains your uuid and a "value". For example, for SET_Operating_Mode, 3 = OFF, 2 = ON (And I believe 1 = Pause?).

Let me know how it works for you. :crossed_fingers:

1 Like

It looks like it works. I say looks like because I don't want it to wake the wife as it bumps into things. I did a quick start and stop. Once my wife is awake and a little coffee in her, I'll give it a better test.

Thanks!

This was in response to clicking on push in the devices page:
dev:15102020-10-17 06:46:30.059 am errorgroovy.lang.MissingMethodException: No signature of method: user_driver_cstevens_Shark_IQ_Robot_1153.push() is applicable for argument types: () values: [] Possible solutions: push(java.lang.String, java.lang.String, java.lang.Integer), use([Ljava.lang.Object;), use(java.util.List, groovy.lang.Closure), use(java.lang.Class, groovy.lang.Closure), run(), run() (push)

On and off work! Great job!!

Yep, the push was never implemented (at least properly). - This is my first Hubitat integration, so I'm still learning how to make proper buttons, other inputs, etc. I'll expand on this (hopefully), but feel free to submit any Pull Requests...I'm open for getting others involved to make this integration more robust.

I'm willing to try to help. I don't claim to have any real programming skills. Just quite a few years of exposure. I'll fork your repo and play around a little. I'm interested in seeing the results of error the robot encounters. Thanks for getting this running. I'm looking forward to learning more.

Alright, just pushed an update to my driver.
Added in:

  • Some Shark IQ States
  • Revised Buttons
  • Togglable Debug Logging (Thanks @gassgs!)
  • Cleaned up some code - Still plenty to do.

To Do:

  • Re-add "Switch".
  • Automated Polling (with smarter logic? - See Shark IQ Robot)
  • Add in Power Options
  • Cleanup States that are just Numbers (Convert to words)
  • Schedules?
  • Ability to specify rooms to clean?

Looks great! Only suggestion would be to have a switch state so that RM can be used to send on/off commands. For example, I have a rule to turn on the Shark when I leave and it return to base when I come home.