Преглед изворни кода

Add support for Lefant LS1 Pro vacuum

Issue #639
Jason Rumney пре 2 година
родитељ
комит
b88248f657

+ 1 - 0
ACKNOWLEDGEMENTS.md

@@ -261,3 +261,4 @@ Further device support has been made with the assistance of users.  Please consi
 - [robertrebor](https://github.com/robertreor) for assisting with support for generic Illuminance sensors.
 - [aurelmarius](https://github.com/aurelmarius) for assisting with support for Ditua DT-1522-YN aroma diffuser.
 - [ssorgatem](https://github.com/ssorgatem) for contributing support for Ledlux thermostat and another variant of quad powerstrip with USB and timers.
+- [remoteassist](https://github.com/remoteassist) for assisting with support for Lefant LS1 Pro vacuums.

+ 2 - 1
DEVICES.md

@@ -323,9 +323,10 @@ of device.
 
 - Kabum Smart 500 vacuum cleaner
 - Kyvol E30 vacuum cleaner
+- Lefant LS1 Pro vacuum cleaner
 - Lefant M213 vacuum cleaner (also works for Lefant M213S and APOSEN A550)
 - Lenovo E1 vacuum cleaner
-- Mellerware City Move vacuum cleaner (high likelihood of mismatch)
+- Mellerware City Move vacuum cleaner
 - Rinkmo D2 vacuum cleaner
 
 ### Lawnmowers

+ 131 - 0
custom_components/tuya_local/devices/lefant_ls1_vacuum.yaml

@@ -0,0 +1,131 @@
+name: Lefant vacuum
+products:
+  - id: 4tt4wulynvwcqicp
+    name: Lefant LS1 Pro
+primary_entity:
+  entity: vacuum
+  dps:
+    - id: 1
+      type: boolean
+      name: power
+    - id: 2
+      type: boolean
+      name: activate
+    - id: 3
+      type: boolean
+      name: charge
+    - id: 4
+      type: string
+      name: command
+      mapping:
+        - dps_val: smart
+          value: smart
+        - dps_val: chargego
+          value: return_to_base
+        - dps_val: zone
+          value: clean_spot
+        - dps_val: pose
+          value: pause
+    - id: 5
+      type: string
+      name: status
+      mapping:
+        - dps_val: standby
+          value: standby
+        - dps_val: zone_clean
+          value: zone
+        - dps_val: part_clean
+          value: partial
+        - dps_val: cleaning
+          value: cleaning
+        - dps_val: paused
+          value: paused
+        - dps_val: goto_pos
+          value: seeking_spot
+        - dps_val: pos_arrived
+          value: located_spot
+        - dps_val: pos_unarrive
+          value: left_spot
+        - dps_val: goto_charge
+          value: returning
+        - dps_val: charging
+          value: charging
+        - dps_val: charge_done
+          value: charged
+        - dps_val: sleep
+          value: sleep
+    - id: 8
+      type: integer
+      name: battery
+    - id: 9
+      type: string
+      name: fan_speed
+      mapping:
+        - dps_val: gentle
+          value: Low
+        - dps_val: normal
+          value: Medium
+        - dps_val: strong
+          value: High
+    - id: 11
+      type: boolean
+      name: locate
+      optional: true
+    - id: 12
+      type: string
+      name: direction_control
+      optional: true
+      mapping:
+        - dps_val: forward
+          value: forward
+        - dps_val: backward
+          value: reverse
+        - dps_val: turn_left
+          value: left
+        - dps_val: turn_right
+          value: right
+        - dps_val: stop
+          value: stop
+    - id: 27
+      type: boolean
+      name: break_clean
+    - id: 28
+      type: bitfield
+      name: error
+secondary_entities:
+  - entity: sensor
+    name: Clean time
+    class: duration
+    category: diagnostic
+    dps:
+      - id: 6
+        type: integer
+        name: sensor
+        unit: min
+  - entity: sensor
+    name: Clean area
+    category: diagnostic
+    icon: "mdi:floor-plan"
+    dps:
+      - id: 7
+        type: integer
+        name: sensor
+        unit: m2
+        mapping:
+          - scale: 10
+  - entity: sensor
+    name: Water tank
+    category: diagnostic
+    class: enum
+    icon: "mdi:cup-water"
+    dps:
+      - id: 10
+        type: string
+        mapping:
+          - dps_val: low
+            value: Low
+          - dps_val: middle
+            value: Medium
+          - dps_val: high
+            value: High
+

+ 3 - 3
custom_components/tuya_local/vacuum.py

@@ -111,16 +111,16 @@ class TuyaLocalVacuum(TuyaLocalEntity, StateVacuumEntity):
             return STATE_ERROR
         elif status in [SERVICE_RETURN_TO_BASE, "returning"]:
             return STATE_RETURNING
-        elif status == "standby":
+        elif status in ["standby", "sleep"]:
             return STATE_IDLE
         elif status == "paused":
             return STATE_PAUSED
         elif status in ["charging", "charged"]:
             return STATE_DOCKED
         elif self._power_dps and self._power_dps.get_value(self._device) is False:
-            return STATE_DOCKED
+            return STATE_IDLE
         elif self._active_dps and self._active_dps.get_value(self._device) is False:
-            return STATE_DOCKED
+            return STATE_PAUSED
         else:
             return STATE_CLEANING