Some initial cleanup, new codes + support for mops
This commit is contained in:
parent
608d388450
commit
28d8212a01
|
|
@ -34,7 +34,7 @@ async def async_setup(hass, entry) -> bool:
|
||||||
async def update_device(device):
|
async def update_device(device):
|
||||||
entry = async_get_config_entry_for_device(hass, device["gwId"])
|
entry = async_get_config_entry_for_device(hass, device["gwId"])
|
||||||
|
|
||||||
if entry == None:
|
if entry is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
if not entry.state.recoverable:
|
if not entry.state.recoverable:
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ from homeassistant.core import callback
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.data_entry_flow import FlowResult
|
from homeassistant.data_entry_flow import FlowResult
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
from homeassistant.helpers.selector import selector
|
|
||||||
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_ACCESS_TOKEN,
|
CONF_ACCESS_TOKEN,
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ class RoboVacEntityFeature(IntEnum):
|
||||||
ZONE = 256
|
ZONE = 256
|
||||||
MAP = 512
|
MAP = 512
|
||||||
BOOST_IQ = 1024
|
BOOST_IQ = 1024
|
||||||
|
MOP = 2048
|
||||||
|
|
||||||
|
|
||||||
ROBOVAC_SERIES = {
|
ROBOVAC_SERIES = {
|
||||||
|
|
@ -89,7 +90,7 @@ ROBOVAC_SERIES_FEATURES = {
|
||||||
| RoboVacEntityFeature.AUTO_RETURN
|
| RoboVacEntityFeature.AUTO_RETURN
|
||||||
| RoboVacEntityFeature.ROOM
|
| RoboVacEntityFeature.ROOM
|
||||||
| RoboVacEntityFeature.ZONE
|
| RoboVacEntityFeature.ZONE
|
||||||
| RoboVacEntityFeature.BOOST_IQ,
|
| RoboVacEntityFeature.MOP,
|
||||||
"X": RoboVacEntityFeature.CLEANING_TIME
|
"X": RoboVacEntityFeature.CLEANING_TIME
|
||||||
| RoboVacEntityFeature.CLEANING_AREA
|
| RoboVacEntityFeature.CLEANING_AREA
|
||||||
| RoboVacEntityFeature.DO_NOT_DISTURB
|
| RoboVacEntityFeature.DO_NOT_DISTURB
|
||||||
|
|
@ -107,6 +108,11 @@ ROBOVAC_SERIES_FAN_SPEEDS = {
|
||||||
"X": ["Pure", "Standard", "Turbo", "Max"],
|
"X": ["Pure", "Standard", "Turbo", "Max"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ROBOVAC_MOP_SETTINGS = {
|
||||||
|
"R": ["low", "middle", "high"],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SUPPORTED_ROBOVAC_MODELS = list(
|
SUPPORTED_ROBOVAC_MODELS = list(
|
||||||
set([item for sublist in ROBOVAC_SERIES.values() for item in sublist])
|
set([item for sublist in ROBOVAC_SERIES.values() for item in sublist])
|
||||||
|
|
|
||||||
|
|
@ -580,7 +580,7 @@ class Message:
|
||||||
if payload_data:
|
if payload_data:
|
||||||
try:
|
try:
|
||||||
payload_data = cipher.decrypt(command, payload_data)
|
payload_data = cipher.decrypt(command, payload_data)
|
||||||
except ValueError as e:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
payload_text = payload_data.decode("utf8")
|
payload_text = payload_data.decode("utf8")
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,11 @@ class TUYA_CODES(StrEnum):
|
||||||
DO_NOT_DISTURB = "107"
|
DO_NOT_DISTURB = "107"
|
||||||
BOOST_IQ = "118"
|
BOOST_IQ = "118"
|
||||||
|
|
||||||
|
class TUYA_CODES_V2(StrEnum):
|
||||||
|
BATTERY_LEVEL = "163"
|
||||||
|
VACUUM_MODE = "158"
|
||||||
|
MOP_MODE = "10"
|
||||||
|
|
||||||
|
|
||||||
TUYA_CONSUMABLES_CODES = ["142", "116"]
|
TUYA_CONSUMABLES_CODES = ["142", "116"]
|
||||||
|
|
||||||
|
|
@ -332,7 +337,7 @@ class RoboVacEntity(StateVacuumEntity):
|
||||||
self.tuyastatus = self.vacuum._dps
|
self.tuyastatus = self.vacuum._dps
|
||||||
|
|
||||||
# for 15C
|
# for 15C
|
||||||
self._attr_battery_level = self.tuyastatus.get(TUYA_CODES.BATTERY_LEVEL)
|
self._attr_battery_level = self.tuyastatus.get(TUYA_CODES.BATTERY_LEVEL) or self.tuyastatus.get(TUYA_CODES_V2.BATTERY_LEVEL)
|
||||||
self.tuya_state = self.tuyastatus.get(TUYA_CODES.STATE)
|
self.tuya_state = self.tuyastatus.get(TUYA_CODES.STATE)
|
||||||
self.error_code = self.tuyastatus.get(TUYA_CODES.ERROR_CODE)
|
self.error_code = self.tuyastatus.get(TUYA_CODES.ERROR_CODE)
|
||||||
self._attr_mode = self.tuyastatus.get(TUYA_CODES.MODE)
|
self._attr_mode = self.tuyastatus.get(TUYA_CODES.MODE)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue