فهرست منبع

feat!(lawn_mower): support stop action and idle activity

Issue #6478

Breaking change: requires HA 2026.9
Jason Rumney 8 ساعت پیش
والد
کامیت
70cab728f3

+ 2 - 2
custom_components/tuya_local/devices/README.md

@@ -694,9 +694,9 @@ Humidifer can also cover dehumidifiers (use class to specify which).
 - **code_type** (optional, accepts integers): a dp to set the type of code being sent. The current implementation only supports type `0`. This is only used when a separate **control** dp is also supplied, otherwise the parameter is included in the JSON sent to the **send** dp.
 - **code_type** (optional, accepts integers): a dp to set the type of code being sent. The current implementation only supports type `0`. This is only used when a separate **control** dp is also supplied, otherwise the parameter is included in the JSON sent to the **send** dp.
 
 
 ### `lawn_mower`
 ### `lawn_mower`
-- **activity** (required, string): a dp to report the current activity of the mower. Valid activities are `mowing`, `paused`, `docked`, `error`, `returning` (from LawnMowerActivities in https://github.com/home-assistant/core/blob/dev/homeassistant/components/lawn_mower/const.py). Any additional activities should be mapped to one of those, and exposed through an extra attribute or sensor entity that shows all the statuses that the mower is reporting.
+- **activity** (required, string): a dp to report the current activity of the mower. Valid activities are `mowing`, `paused`, `docked`, `idle`, `returning`, `error` (from LawnMowerActivities in https://github.com/home-assistant/core/blob/dev/homeassistant/components/lawn_mower/const.py). Any additional activities should be mapped to one of those, and exposed through an extra attribute or sensor entity that shows all the statuses that the mower is reporting.
 
 
-- **command** (required, string): a dp to send commands to the mower. Recognised commands are `start_mowing`, `pause` and `dock`. Any additional commands should be implemented via a `button` or `select` entity.
+- **command** (required, string): a dp to send commands to the mower. Recognised commands are `start_mowing`, `pause`, `stop` `dock`. Any additional commands should be implemented via a `button` or `select` entity.
 
 
 ### `light`
 ### `light`
 - **switch** (optional, boolean): a dp to control the on/off state of the light
 - **switch** (optional, boolean): a dp to control the on/off state of the light

+ 24 - 5
custom_components/tuya_local/devices/moebot_s_mower.yaml

@@ -14,7 +14,7 @@ entities:
         type: string
         type: string
         mapping:
         mapping:
           - dps_val: STANDBY
           - dps_val: STANDBY
-            value: docked
+            value: idle
           - dps_val: MOWING
           - dps_val: MOWING
             value: mowing
             value: mowing
           - dps_val: CHARGING
           - dps_val: CHARGING
@@ -22,7 +22,7 @@ entities:
           - dps_val: EMERGENCY
           - dps_val: EMERGENCY
             value: error
             value: error
           - dps_val: LOCKED
           - dps_val: LOCKED
-            value: docked
+            value: idle
           - dps_val: PAUSED
           - dps_val: PAUSED
             value: paused
             value: paused
           - dps_val: PARK
           - dps_val: PARK
@@ -44,19 +44,37 @@ entities:
         mapping:
         mapping:
           - dps_val: StartMowing
           - dps_val: StartMowing
             value: start_mowing
             value: start_mowing
+            available: not_paused
           - dps_val: StartFixedMowing
           - dps_val: StartFixedMowing
             value: start_mowing
             value: start_mowing
             hidden: true
             hidden: true
           - dps_val: PauseWork
           - dps_val: PauseWork
             value: pause
             value: pause
           - dps_val: CancelWork
           - dps_val: CancelWork
-            value: pause
-            hidden: true
+            value: stop
           - dps_val: ContinueWork
           - dps_val: ContinueWork
             value: start_mowing
             value: start_mowing
-            hidden: true
+            available: is_paused
           - dps_val: StartReturnStation
           - dps_val: StartReturnStation
             value: dock
             value: dock
+      - id: 115
+        type: string
+        optional: true
+        name: is_paused
+        hidden: true
+        mapping:
+          - dps_val: PauseWork
+            value: true
+          - value: false
+      - id: 115
+        type: string
+        optional: true
+        name: not_paused
+        hidden: true
+        mapping:
+          - dps_val: PauseWork
+            value: false
+          - value: true
       - id: 101
       - id: 101
         name: raw_activity
         name: raw_activity
         type: string
         type: string
@@ -89,6 +107,7 @@ entities:
             value: true
             value: true
   - entity: button
   - entity: button
     name: Cancel mowing
     name: Cancel mowing
+    deprecated: lawn_mower.stop  # 2026-11-01
     icon: "mdi:mower"
     icon: "mdi:mower"
     dps:
     dps:
       - id: 115
       - id: 115

+ 24 - 5
custom_components/tuya_local/devices/parkside_bluetooth_mower.yaml

@@ -15,7 +15,7 @@ entities:
         type: string
         type: string
         mapping:
         mapping:
           - dps_val: STANDBY
           - dps_val: STANDBY
-            value: docked
+            value: idle
           - dps_val: MOWING
           - dps_val: MOWING
             value: mowing
             value: mowing
           - dps_val: CHARGING
           - dps_val: CHARGING
@@ -23,7 +23,7 @@ entities:
           - dps_val: EMERGENCY
           - dps_val: EMERGENCY
             value: error
             value: error
           - dps_val: LOCKED
           - dps_val: LOCKED
-            value: docked
+            value: idle
           - dps_val: PAUSED
           - dps_val: PAUSED
             value: paused
             value: paused
           - dps_val: PARK
           - dps_val: PARK
@@ -47,22 +47,40 @@ entities:
         mapping:
         mapping:
           - dps_val: StartMowing
           - dps_val: StartMowing
             value: start_mowing
             value: start_mowing
+            available: not_paused
           - dps_val: StartFixedMowing
           - dps_val: StartFixedMowing
             value: start_mowing
             value: start_mowing
             hidden: true
             hidden: true
           - dps_val: PauseWork
           - dps_val: PauseWork
             value: pause
             value: pause
           - dps_val: CancelWork
           - dps_val: CancelWork
-            value: pause
-            hidden: true
+            value: stop
           - dps_val: ContinueWork
           - dps_val: ContinueWork
             value: start_mowing
             value: start_mowing
-            hidden: true
+            available: is_paused
           - dps_val: StartReturnStation
           - dps_val: StartReturnStation
             value: dock
             value: dock
           - dps_val: EDGE
           - dps_val: EDGE
             value: start_mowing
             value: start_mowing
             hidden: true
             hidden: true
+      - id: 115
+        type: string
+        optional: true
+        name: is_paused
+        hidden: true
+        mapping:
+          - dps_val: PauseWork
+            value: true
+          - value: false
+      - id: 115
+        type: string
+        optional: true
+        name: not_paused
+        hidden: true
+        mapping:
+          - dps_val: PauseWork
+            value: false
+          - value: true
       - id: 101
       - id: 101
         name: raw_activity
         name: raw_activity
         type: string
         type: string
@@ -99,6 +117,7 @@ entities:
             value: true
             value: true
   - entity: button
   - entity: button
     name: Cancel work
     name: Cancel work
+    deprecated: lawn_mower.stop  # 2026-11-01
     icon: "mdi:mower"
     icon: "mdi:mower"
     dps:
     dps:
       - id: 115
       - id: 115

+ 8 - 0
custom_components/tuya_local/lawn_mower.py

@@ -56,6 +56,8 @@ class TuyaLocalLawnMower(TuyaLocalEntity, LawnMowerEntity):
                 self._attr_supported_features |= LawnMowerEntityFeature.PAUSE
                 self._attr_supported_features |= LawnMowerEntityFeature.PAUSE
             if SERVICE_DOCK in available_commands:
             if SERVICE_DOCK in available_commands:
                 self._attr_supported_features |= LawnMowerEntityFeature.DOCK
                 self._attr_supported_features |= LawnMowerEntityFeature.DOCK
+            if SERVICE_STOP in available_commands:
+                self._attr_supported_features |= LawnMowerEntityFeature.STOP
 
 
     @property
     @property
     def activity(self) -> LawnMowerActivity | None:
     def activity(self) -> LawnMowerActivity | None:
@@ -79,3 +81,9 @@ class TuyaLocalLawnMower(TuyaLocalEntity, LawnMowerEntity):
         if self._command_dp:
         if self._command_dp:
             _LOGGER.info("%s returning to dock", self._config.config_id)
             _LOGGER.info("%s returning to dock", self._config.config_id)
             await self._command_dp.async_set_value(self._device, SERVICE_DOCK)
             await self._command_dp.async_set_value(self._device, SERVICE_DOCK)
+
+    async def async_stop(self):
+        """Stop mowing without returning."""
+        if self._command_dp:
+            _LOGGER.info("%s stopping lawn mowing", self._config.config_id)
+            await self._command_dp.async_set_value(self._device, SERVICE_STOP)

+ 1 - 1
custom_components/tuya_local/manifest.json

@@ -18,5 +18,5 @@
         "tinytuya==1.20.0",
         "tinytuya==1.20.0",
         "tuya-device-sharing-sdk~=0.2.4"
         "tuya-device-sharing-sdk~=0.2.4"
     ],
     ],
-    "version": "2026.10.0"
+    "version": "2026.11.0"
 }
 }