make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.39k stars 535 forks source link

Request support for Shinco 30D Dehumidifier #509

Closed shiner66 closed 1 year ago

shiner66 commented 1 year ago

Log Message:

Device matches None with quality of 0%. DPS: {'updated_at': 1678219663.544819, '1': True, '2': '0', '3': 55, '4': 35, '5': False, '6': '0', '7': False, '8': True, '11': 0, '12': '0', '13': 0, '102': False}

Get Device Specification Attribute returns:

{
  "result": {
    "category": "cs",
    "functions": [
      {
        "code": "anion",
        "dp_id": 5,
        "type": "Boolean",
        "values": "{}"
      }
    ],
    "status": [
      {
        "code": "anion",
        "dp_id": 5,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "fault",
        "dp_id": 11,
        "type": "Bitmap",
        "values": "{\"label\":[\"E1\",\"E2\"]}"
      },
      {
        "code": "countdown_left",
        "dp_id": 13,
        "type": "Integer",
        "values": "{\"unit\":\"min\",\"min\":0,\"max\":1440,\"scale\":0,\"step\":1}"
      }
    ]
  },
  "success": true,
  "t": 1678220631667,
  "tid": "f986ac8ebd2511ed98e69e0bfac44282"
}

Datapoints info:

Power: 1
Mode: 2
Humidity (Enviroment report): 3
Set Humidity (Integer): 4
Anion (Even if it has no function it seems): 5
Inside Drying (Dries the unit after use to prevent mold): 101
Wind Speed (Fan Speed HIGH/LOW): 6
Water Pump (For devices with pump to sink capability): 102
Child Lock: 7
Swing: 8
Fault: 11
Countdown (1 Hours increment): 12
Remaining Time (Countdown, 1 minute increment): 13

From standard set, other instructions are deemed not standard by Tuya:

fault   Bitmap  
{
  "label": [
    "E1",
    "E2"
  ]
}
countdown_left  Integer 
{
  "unit": "min",
  "min": 0,
  "max": 1440,
  "scale": 0,
  "step": 1
}

Also, I tried to edit one of the already existant device files with the revelant DPIs, just to see if it get recognized that way, but no avail, still says that there are no compatible devices (disregard model info):

name: Eeese Adam dehumidifier
primary_entity:
  entity: humidifier
  class: dehumidifier
  dps:
    - id: 1
      name: switch
      type: boolean
      mapping:
      - dps_val: false
        icon: "mdi:air-humidifier-off"
        icon_priority: 1
      - dps_val: true
        icon: "mdi:air-humidifier"
        icon_priority: 4
    - id: 4
      name: humidity
      type: integer
      range:
        min: 25
        max: 80
      mapping:
        - step: 5
    - id: 2
      name: mode
      type: string
      mapping:
        - dps_val: manual
          value: Manual
        - dps_val: laundry
          value: Dry clothes
          icon: "mdi:tshirt-crew-outline"
          icon_priority: 3
    - id: 11
      type: bitfield
      name: error
      mapping:
        - dps_val: 1
          icon: "mdi:cup-water"
          icon_priority: 2
      hidden: true
secondary_entities:
  - entity: fan
    dps:
      - id: 1
        type: boolean
        name: switch
      - id: 2
        type: string
        name: dehumidifier_mode
        hidden: true
      - id: 6
        type: string
        name: speed
        mapping:
          - dps_val: low
            value: 50
            constraint: dehumidifier_mode
            conditions:
              - dps_val: laundry
                invalid: true
          - dps_val: high
            value: 100
  - entity: sensor
    name: Current humidity
    class: humidity
    dps:
      - id: 3
        type: integer
        name: sensor
        unit: "%"
        class: measurement
  - entity: binary_sensor
    name: Tank
    class: problem
    category: diagnostic
    dps:
      - id: 11
        type: bitfield
        name: sensor
        mapping:
          - dps_val: 0
            value: false
          - value: true
  - entity: lock
    name: Child lock
    category: config
    dps:
      - id: 7
        type: boolean
        name: lock
        mapping:
          - dps_val: true
            icon: "mdi:hand-back-right-off"
          - dps_val: false
            icon: "mdi:hand-back-right"
  - entity: select
    name: Timer
    icon: "mdi:timer"
    category: config
    dps:
      - id: 12
        type: string
        name: option
        mapping:
          - dps_val: cancel
            value: "Off"
          - dps_val: 1h
            value: 1 hour
          - dps_val: 2h
            value: 2 hours
          - dps_val: 3h
            value: 3 hours
          - dps_val: 4h
            value: 4 hours
          - dps_val: 5h
            value: 5 hours
          - dps_val: 6h
            value: 6 hours
          - dps_val: 7h
            value: 7 hours
          - dps_val: 8h
            value: 8 hours
          - dps_val: 9h
            value: 9 hours
          - dps_val: 10h
            value: 10 hours
          - dps_val: 11h
            value: 11 hours
          - dps_val: 12h
            value: 12 hours
          - dps_val: 13h
            value: 13 hours
          - dps_val: 14h
            value: 14 hours
          - dps_val: 15h
            value: 15 hours
          - dps_val: 16h
            value: 16 hours
          - dps_val: 17h
            value: 17 hours
          - dps_val: 18h
            value: 18 hours
          - dps_val: 19h
            value: 19 hours
          - dps_val: 20h
            value: 20 hours
          - dps_val: 21h
            value: 21 hours
          - dps_val: 22h
            value: 22 hours
          - dps_val: 23h
            value: 23 hours
          - dps_val: 24h
            value: 24 hours

Device manual (Different model, but operates in pretty much the same way): https://cdn.manomano.com/files/pdf/20084625.pdf

shiner66 commented 1 year ago

Hello, After testing the support there are a few issues:

Auto and Continouos modes are swapped around, simple fix.

The entity isn't exposing any humidity sensor, I can set correctly the requested humidity, but I can't see the current humidity.

There is no exposed settings for fan speed or any other dps outside of current mode/on-off/humidity setpoint.

(I don't know if i'm supposed to open a new issue or continue on this, please advise and sorry)

Edit: Also I can correctly see all the dps in diagnostic, so the issue seems to be in exposing them to the user.

make-all commented 1 year ago

The config contains a Humidity sensor and a fan entity where the speed can be changed. These are separate entities, as Home Assistant changed their philosophy after the monolithic climate plaform which tried to be all things at once.

shiner66 commented 1 year ago

The config contains a Humidity sensor and a fan entity where the speed can be changed. These are separate entities, as Home Assistant changed their philosophy after the monolithic climate plaform which tried to be all things at once.

EDIT: The fan entity has now appeared with a 1/0 setting, switching it makes the fan speed switch, but it also switches operating mode (High fan speed -> continuous, Low -> Auto, that's not device behaviour)

Still missing humidiy sensor entity

Also, does that mean that the Dehum card won't never work as inteded, as you need multiple entities to work toghether?

make-all commented 1 year ago

If you mean this card, it should be fully functional, as the card itself does not include current humidity or fan control, only what is possible using the underlying humidifier platform.

image

shiner66 commented 1 year ago

If you mean this card, it should be fully functional, as the card itself does not include current humidity or fan control, only what is possible using the underlying humidifier platform.

image

Thanks, so it didn't work as I thought. Issue with fan speed / mode toggle is still revelant, and still missing the humidity sensor, thank you very much for the work you put in!

make-all commented 1 year ago

There was a typo in the config, which was preventing the secondary entities from showing,

I don't know what the fan was that showed up before, but the correct one should start showing up if you update to the latest release.

shiner66 commented 1 year ago

Hi, Idk either what that fan entity was lol, but I swear it was there. Now the entities seem to be all correctly showing. One little last bug, fan speeds are reversed, 100% is low, any less than that is high. Also, maybe a 100 step instead of 50 is more appropriate, as actually you have 3 steps with a setting that really has 2. E.g. right now fan steps are 100>50>0% where 50 and 0% are functionally the same. I will do deeper testing on all the child entities tomorrow, but for now it seems that's the only issue left, thanks again!

make-all commented 1 year ago

Home Assistant treatss 0% as OFF in my experience, which is why I went with 100% and 50%. I'm not sure where that logic is implemented and why it is not working that way for you.

shiner66 commented 1 year ago

Hello, The fan is working correctly, but timer select and time remaining is messed up. The menu is all over the place and whatever time I select tiem display flashes as "25" which is not even supposed to exist as it allows up to 24 hours timer and HA reports a 1 hour timer is set, which seems to be true based on the Smart Life app.

I will probably tweak a bit faults entity as it is really needed only to indicate when the tank is full vs a generic fault (the other option would be the compressor has exploded altogheter), but just a cosmetic fix.

shiner66 commented 8 months ago

Hello, Would it be possible to add also the 50D to the devices supported? The DPS should be exactly the same.

@make-all shall i create a new issue?