Shark IQ Robot

This is great! My shark is currently cleaning and the state shows as "2." I've made a few dashboard tiles to show some of the attributes like the battery level. Eventually I'd like to be able to trigger lights to come on when cleaning starts if it is dark out. Is this driver set to poll automatically? Or do I have to click the "grab info" button to update the attributes?

@toby - I've revised this answer. I wasn't thinking straight. Yes, a Switch needs to be added (I had one previously, and removed it). It'll get added back in, in a future release.

@Dodgeboy - It's currently set to poll manually. I honestly just figured out the state stuff yesterday, so next step would be to figure out how to automatically poll. It'll probably be a poll that wouldn't poll very frequently - I don't want to overload Shark's servers and have them change something :slight_smile: - I can probably make polling a configurable value too, along with some smarter logic (Click Start? Start polling. Stopped? Stop polling.)

Alright, just pushed another update to the driver. - Hubitat-SharkIQRobot/SharkIQRobotDriver.groovy at master · TheChrisTech/Hubitat-SharkIQRobot · GitHub

Added in/Revised:

  • Automated Polling/Refresh (@Dodgeboy) - All, please be cautious when specifying a refresh time. This isn't simply polling the device, but polling the Shark API (External) - I've made this a configurable value (number of seconds and disable/enable).
  • Re-Add Switch (@toby) - I've decided to make buttons (On) = "Start" and (Off) = "Return to Base". Shark's idea of "Stop" is literally "Stop dead in your tracks". The vacuum will sit in the middle of the room.
  • Power Mode button added.
  • Cleanup of State Values - They now display words (Error Codes, Power Modes, and Operating Modes)
  • Optimization of State API Calls - Instead of individual API calls, it makes 1 and parses the response properly.

To Do:

  • Smarter Logic for Automated Polling (Start polling with "Start", Stop polling with "Stop")
  • Schedules?
  • Ability to specify rooms to clean?
2 Likes

Awesome work!! Mine does not seem to be refreshing at the specified interval. I let it sit for 30 minutes or so, and it was still showing data from the last time I clicked manual refresh. I wonder if this needs to be an app instead of a driver in order to poll data like that?

Turn debug logging on and view the logs when you click refresh. You should see a "Refresh scheduled in X seconds".

I've also pushed another update which includes a "*Last_Refreshed" State...Hopefully to give you a better idea how "Fresh" the state statuses are.

My bad! I clicked "getsharkinfo" instead of "refresh" so my refresh schedule never kicked off. It's going now. This is great!

  • *Last_Refreshed : Fri Oct 23 12:03:39 EDT 2020
  • *Last_Refreshed : Fri Oct 23 12:05:45 EDT 2020
  • *Last_Refreshed : Fri Oct 23 12:06:47 EDT 2020
  • *Last_Refreshed : Fri Oct 23 12:07:49 EDT 2020

I'm trying to figure out how to use this as a trigger for my "lights on during cleaning" rule. I wonder if there's a way to make it show up as a switch or something else that can be used as a trigger?

And another update today:

Added:

  • Smart State Refresh - This is a more graceful way of triggering refreshes only when the vacuum is in an active state (Running, Returning to Dock, Paused). @Dodgeboy - This should better address your concerns of triggering the refresh when the vacuum is running. Others may prefer having a scheduled refresh, but I honestly don't see the point if it's just sitting on the dock.
  • Recharging_To_Resume State - This is when your Shark isn't done cleaning, but the battery is too low and it must recharge. This will turn True when this happens.
  • Charging_Status State - Can't believe I missed this one before, but I did. It's added now. I'm making assumptions based on what I've seen, in that 0 = Not Charging, and 1 = Charging. These play a role in the Smart State Refresh, so I'll need your help to better confirm these values are correct.
  • Additional Operating_Mode State values - Besides the usual values of "Stopped", "Paused", "Running", and "Returning to Dock", I've added more logic around battery states, charging, continuation, etc. and have added the following values to help provide a better "Status" for your Shark. Those values are: "Resting on Dock", "Charging on Dock", and "Recharging to Continue".
  • Slight Delay when getting Refresh After Triggering Button - As @gassgs has pointed out, the Shark API takes a bit to update. For this, I've introduced a delay after you click "On" or "Off", or another button so it has time to get the correct values from Shark.

Removed:

  • Stop Button - It didn't do anything (Thanks @gassgs)

Fixed:

  • Pause Button - It didn't work correctly. (Thanks @gassgs)
  • Bug with Smart State Refresh - Kept refreshing even when battery is at 100%.
  • Last_Refreshed State - Since there was a * in the beginning of the state name, Hubitat didn't like it and kept adding new states (Couldn't find the one to update). I removed the *. @Dodgeboy - This fixes the issue you probably saw earlier today.

This update pretty much wraps up everything I wanted to do in this driver. Sure there's Schedules and Go Clean Room ___, but I worry about the complexity of those, and the general use of them. Schedules should be able to be done within Rule Machine (which I prefer better, as you can turn lights on if needed), and I've personally never used the "Go Clean Room XYZ" feature. If you think otherwise, let me know.

For now, I'm going to let this update bake a while. Please let me know if you run into issues with anything, and I'll try to address them as I can.

3 Likes

Thank you for all of your hard work on this! I'm very happy to get some integration with my vacuum.

1 Like

Wow! This is a great app! It works great!

If you decide to implement this new feature, I will be extremely happy! It is something that can’t be automated yet with the scheduler in the app and a feature that I would love to use. I will be more than happy to help test it!

2 Likes

I've been running this app for a couple months now and it has been working great for the most part. I have noticed several times that the state of the vacuums has stopped updating. Things I've noticed that cause this:

  1. When the hub is rebooted. It seems this app does not automatically reach out for status when the hub boots up. If I don't manually go into the vacuum device and hit refresh, it will be unaware of the status of the vacuum.
  2. After several days of inactivity.

Perhaps a refresh on load, and periodic refresh (separate from the configured refresh) could be added to the app to fix these issues?

2 Likes

I noticed that for some reason Rule Machine has issues using text attributes as a trigger (there's no option for me to do anything after selecting the attribute); however, changing the attributes to string type makes it so it works. I'm not the familiar with Hubitat coding beyond some basics - would there be a downside to changing these attributes from text to string? If not, I might suggest making the change so that it works with Rule Machine.

I'm not seeing these values come up ever. Is everyone else seeing these?

Could it be that your Shark is not updating? I found that if I just had it go on its internal schedule, I would not get the updates and the rules would not run. Now, I have it start with RM and use its internal schedule as a backup.

I am able to see the “Charging on Dock” status. I haven’t checked for the others...

Thanks for the info, I'll keep playing with it.
The power modes, operating modes, charging etc have been have been updating. Just not with the "new" statuses.
The only difference i'm seeing from your screenshot and my device page:
-Your firmware version is newer
-I don't see the Recharging To Resume at all

1 Like

FWIW, I fixed my stale status by creating a rule that does a refresh on the Shark devices every 2hrs. Seems to be working fine since that change.

1 Like

I installed the driver and can get everything working by selecting the vacuum in devices. I want to add a tile in a dashboard but dont see what to select in templates. I cant get the tiles to respond using anything selected in the list of options.

Any suggestions??

1 Like

Very good question! I suspect it may require a driver tweak...?

I tried setting it up as a switch and outlet since it does have an on/off and to see if that would work, but no luck.

1 Like

ok, so Im not going crazy then !!!!! It would be very helpful to be able to utilize a tile in our dashboards.

1 Like