Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Occupancy for Care/Maintenance #651

Open
elcid2012 opened this issue Jan 25, 2023 · 5 comments
Open

[Feature Request] Occupancy for Care/Maintenance #651

elcid2012 opened this issue Jan 25, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@elcid2012
Copy link

Hello,

Excellent plugin, everything works well for me. I searched and could not find this feature suggestion in the opened/closed tickets.

I wanted to ask if it would possible to add occupancy sensors for brush/filter replacement and sensor cleaning. I noticed in the logs the plugin is already pulling those statuses for my S6 Pure; having an occupancy or other type of HomeKit trigger (with accompanying push notification) would be fantastic. Then I could disable push notifications from Mi Home entirely and only rely on that application to correct map issues.

Thanks!

@afharo afharo added the enhancement New feature or request label Jan 25, 2023
@afharo
Copy link
Member

afharo commented Jan 25, 2023

Hi @elcid2012, that is a great suggestion. And should be fairly straightforward to implement.

Just adding a disclaimer... AFAIK, there's no way to "reset" the counters (or, at least, we haven't been able to identify the API call that makes that). This means that, after servicing the robot (cleaning the brush), we'll need to open the Xiaomi app to reset it.

If you help me out figuring out the command that is required for the reset, I can also create a "reset" button for those sensors :)

I hope it makes sense.

@elcid2012
Copy link
Author

I'd be more than happy to help figure out how those are reset via the app, but honestly I am not sure where to start. My code skills are minimal. I did start doing some digging and thought of a few ideas.

Reverse engineering an API seems like a challenge. I would need to understand how this plugin communicates with Xiaomi's API service at awsusor0.fds.api.xiaomi.com to get a head start, assuming that what this plugin does.

If it communicates directly with the vacuum instead, then I think I would need to do a packet capture on my iPhone while executing an API call from within the Mi Home app, which I am also unfamiliar with. But capturing those packets to the API server would hopefully reveal how the API call goes to their servers and back to the vacuum. Hypothetically, of course, if that's how it works.

Can you provide some additional insight to get me started?

In my original post, I was thinking that I would be satisfied with opening the Xiaomi app to reset the counters... right now the issue I'm facing is this: The Xiaomi app doesn't allow you to specify WHICH push notifications are sent to you. It's either all or nothing. I run my vacuum daily, and it's triggered to run at night via HomeKit/Homebridge. I really don't need a notification at 1:00 am saying my vacuum completed its clean. I'd really rather have only a notification for maintenance, but, like I said, Xiaomi doesn't offer this flexibility. It would be great to disable Mi Home/Xiaomi push notifications, relying on HomeKit notifications instead, and then I can open the app to reset the counter manually as required.

Another thing I just thought of is considering Siri might accidentally reset the counter if a voice command is misinterpreted. I think maybe simply having an occupancy sensor/switch flip on or something similar would be the better choice rather than introducing a reset switch within HomeKit that might accidentally get triggered.

Thanks for entertaining the idea and looking forward to helping in any way I can!

@afharo
Copy link
Member

afharo commented Jan 26, 2023

This plugin talks directly to the robot in the local network. Anyway, I think I found the command to reset the counter: reset_consumable. We've go all we need to set them up... I'll try to find some spare time to build it 😇

One last question: what do you think it's best?

  1. One Occupancy sensor that reports the need for servicing + One switch to reset the state?
  2. One Lock that can report the need for servicing and can be manually unlocked to reset the state?
  3. Any other type of Service? All available services are detailed here: https://developers.homebridge.io/#/service/AccessControl

@elcid2012
Copy link
Author

I am not exactly sure what I am looking at in your link, but I see there's a filter maintenance service and what I would assume is a generic service label. But it's not readily apparent if those would appear as Objects/Devices in a user's home and if they would support reseting those maintenance indicators.

I think a lock makes the most sense. A lock that is in a "locked" state would indicate a filter or brush needs replacing or the vacuum's sensors need cleaning. Having a lock in a "locked" state would not so easily be triggered via voice since they are security items and, I believe, require secure iOS confirmation (FaceID, TouchID) to unlock and thus reset the maintenance indicator. I do not have any locks in my HomeKit Home so I am not 100% certain, but my other security devices (SimpliSafe alarm) and my garage door (myQ) require secure confirmation on an iOS device to disarm or open. I would assume a lock works the same way.

Good to know that your plugin talks directly with the robot. I think once these maintenance notifications are implemented I'll be able to fully shut off internet access to my IoT VLAN.

Please feel free to let me know when this is ready for testing and I'll be happy to help provide feedback!

@maisun
Copy link

maisun commented Jun 24, 2023

Also vote for this very useful feature - with reset just make things even better!
Has there been any plan when will it be released? Can't wait for it :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants