miio.integrations.viomi.vacuum.viomivacuum module
Viomi Vacuum.
# https://github.com/rytilahti/python-miio/issues/550#issuecomment-552780952 # https://github.com/homebridge-xiaomi-roborock-vacuum/homebridge-xiaomi-roborock-vacuum/blob/ee10cbb3e98dba75d9c97791a6e1fcafc1281591/miio/lib/devices/vacuum.js # https://github.com/homebridge-xiaomi-roborock-vacuum/homebridge-xiaomi-roborock-vacuum/blob/ee10cbb3e98dba75d9c97791a6e1fcafc1281591/miio/lib/devices/viomivacuum.js
Features:
Main: - Area/Duration - Missing (get_clean_summary/get_clean_record - Battery - battery_life - Dock - set_charge - Start/Pause - set_mode_withroom - Modes (Vacuum/Vacuum&Mop/Mop) - set_mop/is_mop - Fan Speed (Silent/Standard/Medium/Turbo) - set_suction/suction_grade - Water Level (Low/Medium/High) - set_suction/water_grade
Settings: - Cleaning history - MISSING (cleanRecord) - Scheduled cleanup - get_ordertime - Vacuum along the edges - get_mode/set_mode - Secondary cleanup - set_repeat/repeat_cleaning - Mop or vacuum & mod mode - set_moproute/mop_route - DND(DoNotDisturb) - set_notdisturb/get_notdisturb - Voice On/Off - set_sound_volume/sound_volume - Remember Map - remember_map - Virtual wall/restricted area - MISSING - Map list - get_maps/rename_map/delete_map/set_map - Area editor - MISSING - Reset map - MISSING - Device leveling - MISSING - Looking for the vacuum-mop - Consumables statistics - get_properties - Remote Control - MISSING
Misc: - Get Properties - Language - set_language - Led - set_light - Rooms - get_ordertime (hack) - Clean History Path - MISSING (historyPath) - Map plan - MISSING (map_plan)
- class miio.integrations.viomi.vacuum.viomivacuum.ViomiBinType(value)[source]
Bases:
Enum
An enumeration.
- NoBin = 0
- Vacuum = 1
- VacuumAndWater = 3
- Water = 2
- class miio.integrations.viomi.vacuum.viomivacuum.ViomiCarpetTurbo(value)[source]
Bases:
Enum
An enumeration.
- Medium = 1
- Off = 0
- Turbo = 2
- class miio.integrations.viomi.vacuum.viomivacuum.ViomiConsumableStatus(data: List[int])[source]
Bases:
ConsumableStatus
Consumable container for viomi vacuums.
Note that this exposes mop and mop_left that are not available in the base class, while returning zeroed timedeltas for sensor_dirty and sensor_dirty_left which it doesn’t report.
- descriptors() DescriptorCollection[PropertyDescriptor]
Return the dict of sensors exposed by the status container.
Use @sensor and @setting decorators to define properties.
- embed(name: str, other: DeviceStatus)
Embed another status container to current one.
This makes it easy to provide a single status response for cases where responses from multiple I/O calls is wanted to provide a simple interface for downstreams.
Internally, this will prepend the name of the other class to the attribute names, and override the __getattribute__ to lookup attributes in the embedded containers.
- class miio.integrations.viomi.vacuum.viomivacuum.ViomiEdgeState(value)[source]
Bases:
Enum
An enumeration.
- Off = 0
- On = 2
- Unknown = 1
- Unknown2 = 5
- class miio.integrations.viomi.vacuum.viomivacuum.ViomiLanguage(value)[source]
Bases:
Enum
An enumeration.
- CN = 1
- EN = 2
- class miio.integrations.viomi.vacuum.viomivacuum.ViomiMode(value)[source]
Bases:
Enum
An enumeration.
- CleanSpot = 4
- CleanZone = 3
- Mop = 2
- Vacuum = 0
- VacuumAndMop = 1
- class miio.integrations.viomi.vacuum.viomivacuum.ViomiMovementDirection(value)[source]
Bases:
Enum
An enumeration.
- Backward = 4
- Forward = 1
- Left = 2
- Right = 3
- Stop = 5
- Unknown = 10
- class miio.integrations.viomi.vacuum.viomivacuum.ViomiPositionPoint(pos_x, pos_y, phi, update, plan_multiplicator=1)[source]
Bases:
object
Vacuum position coordinate.
- property pos_x
X coordinate with multiplicator.
- property pos_y
Y coordinate with multiplicator.
- class miio.integrations.viomi.vacuum.viomivacuum.ViomiRoutePattern(value)[source]
Bases:
Enum
Mopping pattern.
- S = 0
- Y = 1
- class miio.integrations.viomi.vacuum.viomivacuum.ViomiVacuum(ip: str, token: str | None = None, start_id: int = 0, debug: int = 0, lazy_discover: bool = False, timeout: int | None = None, *, model: str | None = None)[source]
Bases:
Device
Interface for Viomi vacuums (viomi.vacuum.v7).
- actions() DescriptorCollection[ActionDescriptor]
Return device actions.
- carpet_mode(mode: ViomiCarpetTurbo)[source]
Set the carpet mode.
This seems doing nothing on STYJ02YM
- clean_mode(mode: ViomiMode)[source]
Set the cleaning mode.
[vacuum, vacuumAndMop, mop, cleanzone, cleanspot]
- configure_wifi(ssid, password, uid=0, extra_params=None)
Configure the wifi settings.
- consumable_status() ViomiConsumableStatus [source]
Return information about consumables.
- descriptors() DescriptorCollection[Descriptor]
Return a collection containing all descriptors for the device.
- get_current_position() ViomiPositionPoint | None [source]
Return the current position.
- classmethod get_device_group()
- get_maps() List[Dict[str, Any]] [source]
Return map list.
- [{‘name’: ‘MapName1’, ‘id’: 1598622255, ‘cur’: False},
- {‘name’: ‘MapName2’, ‘id’: 1599508355, ‘cur’: True},
…]
- get_positions(plan_multiplicator=1) List[ViomiPositionPoint] [source]
Return the last positions.
plan_multiplicator scale up the coordinates values
- get_properties(properties, *, property_getter='get_prop', max_properties=None)
Request properties in slices based on given max_properties.
This is necessary as some devices have limitation on how many properties can be queried at once.
If max_properties is None, all properties are requested at once.
- get_rooms(map_id: int | None = None, map_name: str | None = None, refresh: bool = False)[source]
Return room ids and names.
- info(*, skip_cache=False) DeviceInfo
Get (and cache) miIO protocol information from the device.
This includes information about connected wlan network, and hardware and software versions.
- Parameters:
bool (skip_cache) – Skip the cache
- move(direction: ViomiMovementDirection, duration=0.5)[source]
Manual movement.
- raw_command(command, parameters)
Send a raw command to the device. This is mostly useful when trying out commands which are not implemented by a given device instance.
- send(command: str, parameters: Any | None = None, retry_count: int | None = None, *, extra_parameters=None) Any
Send a command to the device.
Basic format of the request: {“id”: 1234, “method”: command, “parameters”: parameters}
extra_parameters allows passing elements to the top-level of the request. This is necessary for some devices, such as gateway devices, which expect the sub-device identifier to be on the top-level.
- send_handshake()
Send initial handshake to the device.
- sensors() DescriptorCollection[PropertyDescriptor]
Return read-only properties.
- set_dnd(disable: bool, start_hr: int, start_min: int, end_hr: int, end_min: int)[source]
Set do-not-disturb.
- set_edge(state: ViomiEdgeState)[source]
Vacuum along edges.
This is valid for a single cleaning.
- set_fan_speed(speed: ViomiVacuumSpeed)[source]
Set fanspeed [silent, standard, medium, turbo].
- set_language(language: ViomiLanguage)[source]
Set the device’s audio language.
This seems doing nothing on STYJ02YM
- set_route_pattern(route_pattern: ViomiRoutePattern)[source]
Set the mop route pattern.
- set_water_grade(watergrade: ViomiWaterGrade)[source]
Set water grade.
[low, medium, high]
- settings() DescriptorCollection[PropertyDescriptor]
Return settable properties.
- status() ViomiVacuumStatus [source]
Retrieve properties.
- supports_miot() bool
Return True if the device supports miot commands.
This requests a single property (siid=1, piid=1) and returns True on success.
- update_state()
Return current update state.
- retry_count = 10
- supported_models = ['viomi.vacuum.v6', 'viomi.vacuum.v7', 'viomi.vacuum.v8', 'viomi.vacuum.v10', 'viomi.vacuum.v13']
- timeout = 5
- class miio.integrations.viomi.vacuum.viomivacuum.ViomiVacuumSpeed(value)[source]
Bases:
Enum
An enumeration.
- Medium = 2
- Silent = 0
- Standard = 1
- Turbo = 3
- class miio.integrations.viomi.vacuum.viomivacuum.ViomiVacuumState(value)[source]
Bases:
Enum
An enumeration.
- Cleaning = 3
- Docked = 5
- Idle = 1
- IdleNotDocked = 0
- Mopping = 7
- Paused = 2
- Returning = 4
- Unknown = -1
- VacuumingAndMopping = 6
- class miio.integrations.viomi.vacuum.viomivacuum.ViomiVacuumStatus(data)[source]
Bases:
DeviceStatus
- descriptors() DescriptorCollection[PropertyDescriptor]
Return the dict of sensors exposed by the status container.
Use @sensor and @setting decorators to define properties.
- embed(name: str, other: DeviceStatus)
Embed another status container to current one.
This makes it easy to provide a single status response for cases where responses from multiple I/O calls is wanted to provide a simple interface for downstreams.
Internally, this will prepend the name of the other class to the attribute names, and override the __getattribute__ to lookup attributes in the embedded containers.
- property bin_type: ViomiBinType
Type of the inserted bin.
- property charging: bool
True if battery is charging.
Note: When the battery is at 100%, device reports that it is not charging.
- property edge_state: ViomiEdgeState
Vaccum along the edges.
The settings is valid once 0: Off 1: Unknown 2: On 5: Unknown
- property fanspeed: ViomiVacuumSpeed
Current fan speed.
- property route_pattern: ViomiRoutePattern | None
Pattern mode.
- property state
State of the vacuum.
- property vacuum_state: VacuumState
Return simplified vacuum state.
- property water_grade: ViomiWaterGrade
Water grade.