make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.38k stars 530 forks source link

PR: Sunbeam heated blanket bedwarmer SINGLE (I just modified the device.yaml for the DUAL) #2452

Open backcountrymountains opened 1 week ago

backcountrymountains commented 1 week ago

Log message

2024-11-03 12:24:36.279 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Loaded device config sunbeam_dual_bedwarmer.yaml
2024-11-03 12:24:36.279 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Not match for Bed warmer, missing required DPs: [{'105': 'str'}, {'15': 'bool'}, {'25': 'bool'}]
2024-11-03 12:24:36.280 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Not match for Bed warmer, DPs have incorrect type: [{'103': 'int'}]

DPS information

{
  "result": {
    "model": "{\"modelId\":\"000001y726\",\"services\":[{\"actions\":[],\"code\":\"\",\"description\":\"\",\"events\":[],\"name\":\"默认服务\",\"properties\":[
{\"abilityId\":13,\"accessMode\":\"ro\",\"code\":\"fault\",\"description\":\"\",\"extensions\":{\"scope\":\"fault\",\"attribute\":\"128\"},\"name\":\"故障告警\",\"typeSpec\":{\"type\":\"bitmap\",\"label\":[\"e1\",\"e2\",\"e3\",\"e4\",\"e5\",\"e6\",\"e7\",\"e8\",\"e9\",\"e10\",\"e11\"],\"maxlen\":11}},
{\"abilityId\":14,\"accessMode\":\"rw\",\"code\":\"switch_1\",\"description\":\"\",\"extensions\":{\"attribute\":\"128\"},\"name\":\"开关1\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":20,\"accessMode\":\"rw\",\"code\":\"level_1\",\"description\":\"\",\"extensions\":{\"attribute\":\"128\"},\"name\":\"档位1\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"level_1\",\"level_2\",\"level_3\",\"level_4\",\"level_5\",\"level_6\",\"level_7\",\"level_8\",\"level_9\",\"level_10\"]}},
{\"abilityId\":24,\"accessMode\":\"rw\",\"code\":\"preheat_1\",\"description\":\"\",\"extensions\":{\"attribute\":\"128\"},\"name\":\"预热1\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":26,\"accessMode\":\"rw\",\"code\":\"countdown_set_1\",\"description\":\"\",\"extensions\":{\"attribute\":\"128\"},\"name\":\"倒计时1\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"30m\",\"1h\",\"1h30m\",\"2h\",\"2h30m\",\"3h\",\"3h30m\",\"4h\",\"4h30m\",\"5h\",\"5h30m\",\"6h\",\"6h30m\",\"7h\",\"7h30m\",\"8h\",\"8h30m\",\"9h\",\"9h30m\",\"10h\",\"Stay_On\"]}},
{\"abilityId\":28,\"accessMode\":\"rw\",\"code\":\"countdown_left_1\",\"description\":\"\",\"extensions\":{\"attribute\":\"128\"},\"name\":\"倒计时剩余时间\",\"typeSpec\":{\"type\":\"value\",\"max\":86400,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"sec\"}},
{\"abilityId\":101,\"accessMode\":\"rw\",\"code\":\"Schedule\",\"description\":\"\",\"name\":\"Schedule\",\"typeSpec\":{\"type\":\"raw\",\"maxlen\":128}},
{\"abilityId\":102,\"accessMode\":\"ro\",\"code\":\"PHeatCountdownLeft_1\",\"description\":\"\",\"name\":\"预热剩余时间1\",\"typeSpec\":{\"type\":\"value\",\"max\":1800,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"sec\"}},
{\"abilityId\":103,\"accessMode\":\"ro\",\"code\":\"Confirmation\",\"description\":\"\",\"extensions\":{\"trigger\":\"direct\"},\"name\":\"Confirmation\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"User_Confirmation\",\"45_Minutes_Before\",\"15_Mintutes_Left\",\"One_Hour_Later\",\"No_Operation\"]}}]}]}"
  },
  "success": true,
  "t": 1730663944431,
  "tid": "13ce6ae09a1e11ef989e0e99a92fb6a3"
}

Product ID

vrwpecr7ijucirtl

Product Name

Sunbeam Bedding Single - S1

Information about how the device functions

I named the file: sunbeam_single_bedwarmer.yaml and the following works fine:

name: Bed warmer
products:
  - id: vrwpecr7ijucirtl
    name: Sunbeam single heated blanket/mattress pad
primary_entity:
  entity: switch
  name: Switch
  icon: "mdi:bed"
  dps:
    - id: 13
      type: bitfield
      name: fault_code
      optional: true
    - id: 14
      type: boolean
      name: switch
    - id: 101
      type: string
      name: schedule
      optional: true
    - id: 103
      type: string
      name: confirmation
      optional: true
secondary_entities:
  - entity: binary_sensor
    name: Fault
    class: problem
    category: diagnostic
    dps:
      - id: 13
        type: bitfield
        name: sensor
        optional: true
        mapping:
          - dps_val: 0
            value: false
          - dps_val: null
            value: false
          - value: true
  - entity: select
    name: Level
    category: config
    icon: "mdi:thermometer"
    dps:
      - id: 20
        type: string
        name: option
        optional: true
        mapping:
          - dps_val: level_1
            value: "1"
          - dps_val: level_2
            value: "2"
          - dps_val: level_3
            value: "3"
          - dps_val: level_4
            value: "4"
          - dps_val: level_5
            value: "5"
          - dps_val: level_6
            value: "6"
          - dps_val: level_7
            value: "7"
          - dps_val: level_8
            value: "8"
          - dps_val: level_9
            value: "9"
          - dps_val: level_10
            value: "10"
  - entity: switch
    name: Preheat
    icon: "mdi:heatwave"
    category: config
    dps:
      - id: 24
        type: boolean
        name: switch
  - entity: select
    name: Auto-off
    icon: "mdi:timer"
    category: config
    dps:
      - id: 26
        type: string
        name: option
        optional: true
        mapping:
          - dps_val: "30m" 
            value: "30 min"
          - dps_val: "1h"
            value: "1h"
          - dps_val: "1h30m"
            value: "1.5h"
          - dps_val: "2h"
            value: "2h"
          - dps_val: "2h30m"
            value: "2.5h"
          - dps_val: "3h"
            value: "3h"
          - dps_val: "3h30m"
            value: "3.5h"
          - dps_val: "4h"
            value: "4h"
          - dps_val: "4h30m"
            value: "4.5h"
          - dps_val: "5h"
            value: "5h"
          - dps_val: "5h30m"
            value: "5.5h"
          - dps_val: "6h"
            value: "6h"
          - dps_val: "6h30m"
            value: "6.5h"
          - dps_val: "7h"
            value: "7h"
          - dps_val: "7h30m"
            value: "7.5h"
          - dps_val: "8h"
            value: "8h"
          - dps_val: "8h30m"
            value: "8.5h"
          - dps_val: "9h"
            value: "9h"
          - dps_val: "9h30m"
            value: "9.5h"
          - dps_val: "10h"
            value: "10h" 
  - entity: sensor
    name: Time remaining
    class: duration
    category: diagnostic
    dps:
      - id: 28
        type: integer
        name: sensor
        optional: true
        unit: s
  - entity: sensor
    name: Preheat remaining
    class: duration
    category: diagnostic
    dps:
      - id: 102
        type: integer
        name: sensor
        optional: true
        unit: s

I just shamelessly stole the configuration for the dual zone blanket/bedwarmer and made it work for the single zone blanket bedwarmer. The single only has one zone so no combined/A/B switches are necessary.

Thanks!

make-all commented 1 week ago

These log messages are not the one that is needed. They do not tell the full story of what the device is sending, only why the sunbeam_dual_bedwarmer is not considered a match.

backcountrymountains commented 1 week ago

True, I've tried to attach the whole log for tuya-local trying to link the device. Is that sufficient or is there other log info you need?Thanks. Justin Blanket Log.log