Ver Fonte

fix(teslasmart_ps300_petsofa): treat fault dp 22 value 1 as healthy (#6286)

## Problem

The fault datapoint (dp 22) on the Tesla Smart Pet Sofa PS300 reports
`1` when there is **no** fault. The current mapping treats every
non-zero value as a fault, so the problem binary sensor sits permanently
at `on` on every working unit.

## Evidence

Diagnostics from a healthy unit that is actively heating:

```json
"cached_state": {
  "1": true,
  "7": "smart",
  "8": 35,
  "16": 27,
  "22": 1,
  "101": 2,
  "102": 21
}
```

The climate entity reports `hvac_action: heating`, board temperature 27
°C and ambient temperature 21 °C. Both sensors read correctly and the
device heats normally, while `binary_sensor.<device>_problem` is `on`
with `fault_code: 1`.

## Fault codes

| dp 22 | meaning                     |
|-------|-----------------------------|
| 1     | no fault                    |
| 2     | cooler plate fault          |
| 4     | fan fault                   |
| 6     | cooler plate and fan fault  |

## Changes

- map `dps_val: 1` to `false` on the problem sensor
- restore the `description` attribute that decodes the fault codes
- add a comment recording that `1` is the healthy value on this device

This mapping was present in an earlier revision of this file and has
since been lost. The generic "non-zero means fault" rule reads as
correct during review, which is why the comment is included — without it
the same regression is likely to happen again.

- Please submit each new device as a separate PR on its own branch.
- Please submit additional translations separately from device
submissions, after review of whether any existing translations can be
used instead.
- Please do not update DEVICES.md or ACKNOWLEDGEMENTS.md as part of your
submission, as these files have high risk of conflicts.
- Once submitted, do not force push your branch unless it is necessary
for conflict resolution.
- If submitting a code change, please submit a bug report first making
it clear what the issue is that you are fixing, and link the report to
your PR.
- **If using AI to code your changes, you must understand what the AI
has done.** Vibe coded contributions without understanding by the
submitter take up a lot of review time and will be deprioritized.
- PRs with all CI errors and warnings fixed will be prioritized, so
please fix what you can (unless the error is outside the scope of your
change).

Please describe in simple terms what you are submitting. Do not paste a
multi-page AI generated rambling story here, as the maintainers do not
have time to read that.
Milan há 3 dias atrás
pai
commit
e0542171cc

+ 15 - 0
custom_components/tuya_local/devices/teslasmart_ps300_petsofa.yaml

@@ -58,6 +58,9 @@ entities:
         name: sensor
         name: sensor
         unit: "C"
         unit: "C"
 
 
+  # The fault datapoint reports 1 when there is NO fault, so 1 has
+  # to be treated as healthy. 2 is a cooler plate fault and 4 is a
+  # fan fault.
   - entity: binary_sensor
   - entity: binary_sensor
     class: problem
     class: problem
     category: diagnostic
     category: diagnostic
@@ -68,10 +71,22 @@ entities:
         mapping:
         mapping:
           - dps_val: 0
           - dps_val: 0
             value: false
             value: false
+          - dps_val: 1
+            value: false
           - value: true
           - value: true
       - id: 22
       - id: 22
         type: bitfield
         type: bitfield
         name: fault_code
         name: fault_code
+      - id: 22
+        type: bitfield
+        name: description
+        mapping:
+          - dps_val: 1
+            value: ok
+          - dps_val: 2
+            value: cooler_fault
+          - dps_val: 4
+            value: fan_fault
       - id: 105
       - id: 105
         type: integer
         type: integer
         name: push_state
         name: push_state