RMCob / homebridge-wyze-robovac

This plug-in provides rudimentary control for a Wyze Robot Vacuum.
Apache License 2.0
8 stars 4 forks source link
homebridge robovac verified wyze

homebridge-wyze-robovac

npm npm GitHub last commit verified-by-homebridge Donate

This plugin adds rudimentary support for the Wyze Robot Vacuum device to Homebridge.

Background

Since HomeKit does not yet have a 'smart vacuum' framework, this plugin creates a separate 'switch' accessory for each room in the current Wyze app map for the vacuum. It also adds an "All Rooms" switch to do the entire map. Turning a switch 'On' will tell the vacuum to sweep that room. Turning it 'Off' will tell the vacuum to stop sweeping and return to the charging dock. In addition, a faux humidity sensor is created to display the vacuum's current battery charge level.

In the Home app, create a room named 'Vacuum' and move all the new switch accessories and the faux humidity sensor into that room. You can then say "Hey Siri, vacuum living room on" and the magic happens. :-) If you have multiple vacums the configuration is a bit more involved. See below.

Requirements

Python version must be >= 3.8.3.

wyze-sdk must be >= 2.0.0. Installation instructions are here: https://github.com/shauntarves/wyze-sdk.

Visit the Wyze developer API portal to generate an API ID/KEY: https://developer-api-console.wyze.com/#/apikey/view. This info is used in the Settings UI. See the Configuration section below. Be careful to check that the generated keys do not contain any 'shell' special characters like '*' or '|' (vertical bar). If they do, delete the keys (via the web browser interface) and regenerate them.

Caveats

Error Indications

The Wyze API indicates the vacuum is sweeping but does not return any 'room' information. If the vacuum was already started sweeping by the Wyze app when you try to start it via the plugin, nothing will happen. The switch will just turn itself off. I don't like it either but that's how it works now.

If you start the vacuum sweeping and then try to turn on a different room 'switch' (i.e. - pick a different room), the second switch will turn off with an '!' in the icon, indicating the error. To change rooms, first turn off the room that's being swept.

Configuration

Use the settings UI in Homebridge Config UI X to configure your Wyze account, or manually add the following to the platforms section of your config file. See the Requirements section above for instructions on how to get your API_KEY and KEY_ID:

{
  "platforms": [
    {
      "platform": "WyzeRoboVac",
      "name": "WyzeRoboVac",
      "username": "YOUR_EMAIL",
      "password": "YOUR_PASSWORD",
      "mfaCode": "YOUR_2FA_AUTHENTICATION_PIN",
      "key_id": "YOUR WYZE ACCOUNT KEY_ID",
      "api_key": "YOUR WYZE ACCOUNT API_KEY",
      "statusCheckRefreshInterval": "Refresh Interval for status checks after sweeping starts. Default 30 sec",
      "idleBatteryCheckRefreshInterval": "Refresh Interval for battery checks when idle. Default 1800 seconds (30 min)",
      "busyBatteryCheckRefreshInterval": "Refresh Interval for battery checks when busy or charge level < 100. Default 120 seconds (2 min)",
      "path2py_stubs": "Path to Python helper scripts. Default '/usr/lib/node_modules/homebridge-wyze-robovac/py_helpers'",
      "debugLevel": "Can be 0 (no logging), 1 (log.info), or 2 (log.debug)"
    }
  ]
}

Supported devices will be discovered and added to Homebridge automatically.

Optional fields

Other Info

Special thanks to the following projects for reference and inspiration:

Thanks again to Shaun Tarves for the Python libraries that this plugin utilizes, and thanks to others for volunteering their time to help fix bugs and add support for other features.