- Simple Wyze Vacuum for Home Assistant
Simple implementation of the Wyze Vacuum right into Home Assistant. I have only tested this against the official firmware version - 1.6.202 If you run into issues against a different firmware please be extra descriptive of the problem when filing an issue.
NOTE
By default, this integration DOES NOT automatically update your vacuum entity. This is due to Wyze applying a rate limit on integrations. For more details you can read the reddit thread here. However, there is an option to enable polling with a configuration change. This leaves this integration with two options to address this issue:
- To update the state of the device, you can do a
vacuum.send_command
with commandupdate
which will update the state of the vacuum. See vacuum-card example below for an implementation. - Enable Polling
- Home Assistant 😅
- HACS Installed in Home Assistant
- Wyze Account (either with 2FA disabled or TOTP authentication setup when integrating Simple Wyze Vac. Note: This is NOT the same thing as the 6 digit code you get from your Authenticator app. Please see TOTP section)
- Generate a Wyze Developer API key at Wyze Developer Page to receive a
key_id
and anapi_key
- On Home Assistant go to HACS -> Integration
- Click menu on the top right
- Click on custom repositories
- Add https://github.com/romedtino/simple-wyze-vac as an Integration
- Install/Add simple-wyze-vac
- Restart Home Assistant
- Navigate to
Configuration
- Navigate to
Devices & Services
- Click
ADD INTEGRATION
on the bottom right - Select
Simple Wyze Vac
- Enter your
username
,password
,key_id
andapi_key
(optionaly, the TOTP value see TOTP section)
If it all worked out, you should now have Wyze vacuum entity(ies)
- TOTP (Note: This is NOT the same thing as the 6 digit code you get from your Authenticator app. Please see TOTP section)
- Start
- Stop / Pause
- Return to Base
- Filter lifespan information (Main filter, main brush and side brush)
- Camera entity to show last vacuum map
- Room names as toggleable switches (For area cleaning)
- Room names as vacuum attributes
- Battery Level
- Optional Polling
Simple Wyze Vac has a few available service commands.
There are three options to sweep rooms - simple_wyze_vac.sweep_rooms
, sweep_auto
or sweep_rooms
. See details below.
Using built-in service and choosing the switch entities/rooms you want to do a sweep or in YAML
service: simple_wyze_vac.sweep_rooms
data:
entity_id: vacuum.YOUR_VACUUM_NAME_HERE
rooms:
- switch.swv_kitchen
- switch.swv_entryway
Automatically run area cleaning
based on the rooms (switch entities provided by Simple Wyze Vac) that are ON
. For example, in the attached screenshot, invoking a sweep_auto
will do an area cleaning of the Living Room.
service: vacuum.send_command
data:
command: sweep_auto
target:
entity_id: vacuum.YOUR_VACUUM_NAME_HERE
(Must use serivce call) Example:
service: vacuum.send_command
data:
command: sweep_rooms
params:
rooms:
- Hallway
- Kitchen
target:
entity_id: vacuum.YOUR_VACUUM_NAME_HERE
Options are quiet
standard
strong
service: vacuum.set_fan_speed
data:
fan_speed: quiet
target:
entity_id: vacuum.YOUR_VACUUM_NAME_HERE
Since the integration no longer polls, you can query the status of the vacuum by sending a custom command update
service: vacuum.send_command
data:
command: update
target:
entity_id: vacuum.YOUR_VACUUM_NAME_HERE
You can also refresh the login token if it has been awhile since you queried status and your login token has expired
service: vacuum.send_command
data:
command: refresh_token
target:
entity_id: vacuum.YOUR_VACUUM_NAME_HERE
With multi-room support, it is possible to use send a service command to switch rooms
Example:
service: vacuum.send_command
data:
command: set_current_map
params:
map: YOUR MAP NAME HERE
target:
entity_id: vacuum.YOUR_VACUUM_NAME_HERE
To enable polling
- Navigate to the Simple Wyze Vac
Devices & Services
page underConfiguration
- Select
Configure
- Check
Enable polling
and provide the interval. The interval value is inHH:MM:SS
format. For example00:01:00
would poll every 1 minute.
- Location is currently not supported but it is considered "supported" by HA so the button doesn't crash the component when using vacuum-card defaults if you use it.
There's a lovely Lovelace vacuum-card here in which you can implement your vacuum like so:
Here is my YAML configuration of the card
type: custom:vacuum-card
entity: vacuum.theovac
image: default
show_toolbar: true
show_status: true
show_name: true
compact_view: false
stats:
default:
- attribute: filter
unit: hours
subtitle: Filter
- attribute: side_brush
unit: hours
subtitle: Side brush
- attribute: main_brush
unit: hours
subtitle: Main brush
shortcuts:
- name: Clean living room
service: script.vacuum_room_clean
icon: mdi:sofa
service_data:
rooms:
- Living Room
- name: Update
service: script.vacuum_update_state
icon: mdi:update
and the contents of the scripts it invokes
alias: Vacuum Room Clean
variables:
rooms:
- Living Room
sequence:
- service: vacuum.send_command
data:
command: sweep_rooms
params:
rooms: ' {{ rooms }} '
target:
entity_id: vacuum.theovac
mode: single
alias: Vacuum Update State
sequence:
- service: vacuum.send_command
data:
command: update
target:
entity_id: vacuum.theovac
mode: single
There is support for at showing the last sweep map. With the exposed camera entity, in your vacuum-card (if you're using it) you can add camera.{vacuum_name}_camera
e.g.
map: camera.wyzevac_camera
which should then show the last sweep map
TIP - Wrap your vacuum card in a 'conditional' card and use the vacuum state of 'docked' to test if it is docked and undocked. This way, you can still have the vacuum logo and not the map when the vacuum is not running. Another option is to create a helper input_boolean
and use that instead to toggle between showing the map and showing the vacuum like so:
type: conditional
conditions:
- entity: input_boolean.map_toggle
state: 'off'
card:
type: custom:vacuum-card
entity: vacuum.theovac
image: default
show_toolbar: true
show_status: true
show_name: true
compact_view: false
stats:
default:
- attribute: filter
unit: hours
subtitle: Filter
- attribute: side_brush
unit: hours
subtitle: Side Brush
- attribute: main_brush
unit: hours
subtitle: Main Brush
shortcuts:
- name: Toggle Map
service: input_boolean.toggle
service_data:
entity_id: input_boolean.map_toggle
icon: mdi:map
view_layout:
position: sidebar
view_layout:
position: sidebar
wyze_sdk
implemented support for using TOTP (Time-Based One-Time Password). Specifically, mintotp which works great!
- If you already have 2FA setup on your Wyze account you will have to reapply it. If you already have Simple Wyze Vac integrated, you will have to remove it and readd it.
- To remove it, navigate to the Wyze app and go -
Accounts -> Security -> Two-Factor Authentication
and remove verification - Back in
Accounts -> Security -> Two-Factor Authentication
, select Verification by Authenticator app. - Read the instructions from Wyze BUT make sure to copy and KEEP the value in step 3. This is your Base32 SECRET used to generate TOTP.
- Go ahead and setup your TOTP on the Authenticator of your choosing.
- Re-add
Simple Wyze Vac
underAdd Integration
of Home Assistant. - Enter your
username
,password
,key_id
,api_key
and for TOTP, copy the Base32 SECRET you got from the Wyze app Submit
and you should now be authenticated with 2FA enabled!
- @shauntarves/wyze-sdk - This would not be possible without this awesomesauce
- aarongodfrey - Helped figuring out what in the world I am doing
- Samuel - More info on how custom components work
- markdown-toc - For markdown TOC generator