Bläddra i källkod

Adds support for Catit Pixi Smart Feeder (Model: 43752) (#3889)

* Adds support for Catit Pixi Smart Feeder.

Model: 43752

---------

Co-authored-by: Jason Rumney <make-all@users.noreply.github.com>
Colin Nolan 3 månader sedan
förälder
incheckning
a5b44b028b
1 ändrade filer med 87 tillägg och 3 borttagningar
  1. 87 3
      custom_components/tuya_local/devices/catit_pixi_smart_feeder.yaml

+ 87 - 3
custom_components/tuya_local/devices/catit_pixi_smart_feeder.yaml

@@ -7,12 +7,16 @@ products:
     manufacturer: GiotoHun
   - id: ojqmjnoxqygqldsp
     manufacturer: Puppy Kitty
-    name: Automatic pet feeder
+  - id: s3rvixmeqx62vud5
+    manufacturer: Catit
+    model: Pixi Smart Feeder
+    model_id: "43752"
 entities:
   - entity: button
-    name: Quick Feed
+    name: Quick feed
     icon: "mdi:food-drumstick"
     dps:
+      # Feeds the meal size, regardless of dps value
       - id: 2
         type: boolean
         name: button
@@ -22,6 +26,7 @@ entities:
     category: config
     hidden: true
     dps:
+      # Not thought to be used with Catit 43752
       - id: 1
         type: base64
         name: value
@@ -34,6 +39,8 @@ entities:
       - id: 15
         name: sensor
         type: integer
+        # Only present after feeding on Catit 43752
+        optional: true
   - entity: button
     translation_key: factory_reset
     category: config
@@ -45,7 +52,6 @@ entities:
   - entity: number
     icon: "mdi:paw"
     name: Manual feed
-    category: config
     dps:
       - id: 3
         name: value
@@ -53,6 +59,8 @@ entities:
         range:
           min: 1
           max: 12
+        # Only present after feeding on Catit 43752
+        optional: true
   - entity: binary_sensor
     name: Food shortage
     class: problem
@@ -85,6 +93,7 @@ entities:
     icon: "mdi:paw"
     category: diagnostic
     dps:
+      # Not observed in Catit 43752
       - id: 4
         type: string
         name: sensor
@@ -95,3 +104,78 @@ entities:
           - dps_val: null
             value: null
           - value: false
+  - entity: sensor
+    name: Last meal details
+    category: diagnostic
+    dps:
+      # Takes value such as `R:0  C:1  T:1761264924`,
+      # where `R=result`, `C=meal_size`, `T=unix_time`.
+      # Extracting the timestamp with Tuya Local is not currently
+      # possible - use a template sensor:
+      # ```
+      # template:
+      #   sensor:
+      #     - name: Catit Pixi Smart Feeder last meal time
+      #       state: >
+      #         {% set s = states("sensor.your_last_meal_details") %}
+      #         {% if s in [""] %}
+      #           unknown
+      #         {% else %}
+      #           {% set ts = namespace(val=None) %}
+      #           {% for p in s.split() %}
+      #             {% if p.startswith("T:") %}
+      #               {% set ts.val = (p[2:]|int) %}
+      #             {% endif %}
+      #           {% endfor %}
+      #           {% if ts.val is none %}
+      #             unknown
+      #           {% else %}
+      #             {{ (ts.val | int) | timestamp_utc }}
+      #           {% endif %}
+      #         {% endif %}
+      #       device_class: timestamp
+      # ```
+      # Value persists until next feed, or device power off
+      - id: 104
+        name: sensor
+        type: string
+        optional: true
+  - entity: sensor
+    name: IP address
+    category: diagnostic
+    dps:
+      - id: 107
+        name: sensor
+        type: string
+        # Present at all times on Catit 43752 but unsure about other products
+        optional: true
+  - entity: switch
+    name: Sound enabled
+    category: config
+    dps:
+      - id: 103
+        name: switch
+        type: boolean
+        # Present at all times on Catit 43752 but unsure about other products
+        optional: true
+  - entity: switch
+    name: Feed button enabled
+    category: config
+    dps:
+      - id: 102
+        name: switch
+        type: boolean
+        # Present at all times on Catit 43752 but unsure about other products
+        optional: true
+  - entity: number
+    name: Meal size
+    category: config
+    dps:
+      - id: 101
+        name: value
+        type: integer
+        # Present at all times on Catit 43752 but unsure about other products
+        optional: true
+        range:
+          min: 1
+          max: 12