localtuya icon indicating copy to clipboard operation
localtuya copied to clipboard

Vacuum: Not all DPs are visible and device is always "Cleaning"

Open Bonfra04 opened this issue 1 year ago • 5 comments

The problem

While trying to configure my Rowenta X-Plorer S75 I need to compile the various DPs into the provided fields. Fetching from the Tuya IoT Platform I can see that the DP for Power is "1" image But in the dropdown selector in the HA UI this dp is not visible image

Also, the "Mode" DP is not shown and, I think, this is the reason why the Dashboard shows the device to be always "Cleaning" image

In general, some features are just not available since there is no DP to put in the field that requires it. I don't know if fixing this will also fix all of the other bugs I have such as wrong states displayed and wrong commands sent, but I hope so.

Environment

  • Localtuya version: 5.2.1
  • Home Assistant Core version: 2023.11.3
  • [x] Are you using the Tuya/SmartLife App in parallel ?

Steps to reproduce

  1. Get your hands on a Rowenta X-Plorer S75
  2. Get the local key
  3. Start configuring it with localtuya

DP dump

INFO:localtuya:localtuya version 1.0.0
INFO:localtuya:Python 3.11.2 (main, Feb 12 2023, 00:48:52) [GCC 12.2.0] on linux
INFO:localtuya:Using pytuya version '10.0.0'
INFO:localtuya:Detecting list of available DPS of device bf5501f2986b37884asibv [192.168.1.110], protocol 3.3.
DEBUG:localtuya.pytuya:[bf5...ibv] Sending command 10 (device type: type_0a)
DEBUG:localtuya.pytuya:[bf5...ibv] Sending payload: b'{"gwId":"bf5501f2986b37884asibv","devId":"bf5501f2986b37884asibv","uid":"bf5501f2986b37884asibv","t":"1700909756"}'
DEBUG:localtuya.pytuya:[bf5...ibv] Command 10 waiting for sequence number 1
DEBUG:localtuya.pytuya:[bf5...ibv] Dispatching message CMD 10 TuyaMessage(seqno=1, cmd=10, retcode=0, payload=b'G"@\xca\xcf\xa3\xb3\xd3c\x8d\xd1\xd8p\xb0Z\x85\xd07\x00\xec\x95\xfc\xa5\xb9\xc0\xb2\xce\xdbJ\tr\xf3\x01-hY=\x9d:\xc6\x85.\xaa\xe4\t\xfc\xaf!\xf8R\x98\xa7\x8f\xfc\xcc\xc1\xb2\x8c\x1au\x7f*\xd1\xf1\x19\xe3m.&\xe85\xdfdA_%\x95\xf9\xd4X`\xd0\xaf\x8a\xcf-\x01e\t\xc6]\xcc@\xaf\x11\xea7~q\xd1\x90u\xd4\xce9T\x0c\x1a\xae\x9b\x17\xe6:\xa5l\xf4U\x83s\\u\xc8\r\xd018\t\xc8[\xf6\xf4\x81yI4"nl\x17=\xd2J\x9cY\x94\x00\x92\xe5\x8eY\xc2;\x02\xcd$\x9dc\xe84\xa1\xf9\xd6\xbcX\x1au\xd2\xcf\x0fG\xf3\nl\xc5\xf5\xbb]2s\xe0Uj$KO\xce\x07*\xa5&n\xe2\xb2\x9cC\x84\x90\x9d\xf5JZ\xcd\x87v\xda\x97XllQ\x02K\xd2\xcb/\xcb\xddzn\xb4kRrh>\xe4\xcb\xccR\x95\x16~\x8d\xa0\x8b%\x07\x13]\x8c', crc=367778409, crc_good=True)
DEBUG:localtuya.pytuya:[bf5...ibv] Deciphered data = '{"dps":{"101":false,"102":false,"103":true,"104":"backcharge","105":"fullcharge","106":100,"107":0,"108":0,"109":"quiet","113":false,"116":22525,"117":435,"118":17,"119":22525,"120":22525,"121":22525,"122":0,"137":true,"144":false}}'
AVAILABLE DPS ARE [{'101': False, '102': False, '103': True, '104': 'backcharge', '105': 'fullcharge', '106': 100, '107': 0, '108': 0, '109': 'quiet', '113': False, '116': 22525, '117': 435, '118': 17, '119': 22525, '120': 22525, '121': 22525, '122': 0, '137': True, '144': False}]
INFO:localtuya:COMPLETE response from device bf5501f2986b37884asibv [192.168.1.110].

**** deviceInfo returned OK ****

TuyaDebug (Tuya DPs dump) [1.0.0]

Device bf5501f2986b37884asibv at 192.168.1.110 key @0!;7#52])H$?o%3 protocol 3.3 dev_type type_0a:
    DPS [101] VALUE [False]
    DPS [102] VALUE [False]
    DPS [103] VALUE [True]
    DPS [104] VALUE [backcharge]
    DPS [105] VALUE [fullcharge]
    DPS [106] VALUE [100]
    DPS [107] VALUE [0]
    DPS [108] VALUE [0]
    DPS [109] VALUE [quiet]
    DPS [113] VALUE [False]
    DPS [116] VALUE [22525]
    DPS [117] VALUE [435]
    DPS [118] VALUE [17]
    DPS [119] VALUE [22525]
    DPS [120] VALUE [22525]
    DPS [121] VALUE [22525]
    DPS [122] VALUE [0]
    DPS [137] VALUE [True]
    DPS [144] VALUE [False]

Additional information

Here is the full json of the Query Properties from the IoT Platform

{
  "result": {
    "properties": [
      {
        "code": "power",
        "custom_name": "",
        "dp_id": 1,
        "time": 1694461120771,
        "value": false
      },
      {
        "code": "power_go",
        "custom_name": "",
        "dp_id": 2,
        "time": 1694461120771,
        "value": false
      },
      {
        "code": "mode",
        "custom_name": "",
        "dp_id": 3,
        "time": 1694461120771,
        "value": "standby"
      },
      {
        "code": "seek",
        "custom_name": "",
        "dp_id": 13,
        "time": 1694461120771,
        "value": false
      },
      {
        "code": "clean_switch",
        "custom_name": "",
        "dp_id": 101,
        "time": 1700906641004,
        "value": false
      },
      {
        "code": "pause_switch",
        "custom_name": "",
        "dp_id": 102,
        "time": 1700906641032,
        "value": false
      },
      {
        "code": "charge_switch",
        "custom_name": "",
        "dp_id": 103,
        "time": 1700906641051,
        "value": true
      },
      {
        "code": "clean_mode",
        "custom_name": "",
        "dp_id": 104,
        "time": 1700906622072,
        "value": "backcharge"
      },
      {
        "code": "robot_state",
        "custom_name": "",
        "dp_id": 105,
        "time": 1700907948001,
        "value": "fullcharge"
      },
      {
        "code": "battery",
        "custom_name": "",
        "dp_id": 106,
        "time": 1700907942575,
        "value": 100
      },
      {
        "code": "cur_clean_time",
        "custom_name": "",
        "dp_id": 107,
        "time": 1700906594283,
        "value": 0
      },
      {
        "code": "cur_clean_area",
        "custom_name": "",
        "dp_id": 108,
        "time": 1700906594300,
        "value": 0
      },
      {
        "code": "fan_mode",
        "custom_name": "",
        "dp_id": 109,
        "time": 1700905818907,
        "value": "quiet"
      },
      {
        "code": "remote_ctrl",
        "custom_name": "",
        "dp_id": 111,
        "time": 1694461120771,
        "value": "forward"
      },
      {
        "code": "seek_robot",
        "custom_name": "",
        "dp_id": 112,
        "time": 1694461120771,
        "value": false
      },
      {
        "code": "disturb_switch",
        "custom_name": "",
        "dp_id": 113,
        "time": 1700870961940,
        "value": false
      },
      {
        "code": "material_reset",
        "custom_name": "",
        "dp_id": 115,
        "time": 1694461120771,
        "value": "gettime"
      },
      {
        "code": "total_clean_time",
        "custom_name": "",
        "dp_id": 116,
        "time": 1700906598073,
        "value": 22525
      },
      {
        "code": "total_clean_area",
        "custom_name": "",
        "dp_id": 117,
        "time": 1700906598098,
        "value": 435
      },
      {
        "code": "total_clean_count",
        "custom_name": "",
        "dp_id": 118,
        "time": 1700906598186,
        "value": 17
      },
      {
        "code": "side_brush_time",
        "custom_name": "",
        "dp_id": 119,
        "time": 1700906598215,
        "value": 22525
      },
      {
        "code": "main_brush_time",
        "custom_name": "",
        "dp_id": 120,
        "time": 1700906598248,
        "value": 22525
      },
      {
        "code": "filter_time",
        "custom_name": "",
        "dp_id": 121,
        "time": 1700906598273,
        "value": 22525
      },
      {
        "code": "robot_fault",
        "custom_name": "",
        "dp_id": 122,
        "time": 1700906495028,
        "value": 0
      },
      {
        "code": "path_comm",
        "custom_name": "",
        "dp_id": 123,
        "time": 1700906641144,
        "value": "ITHINKTHISSHOULDBERDACTED"
      },
      {
        "code": "cmd_comm",
        "custom_name": "",
        "dp_id": 124,
        "time": 1700870960512
      },
      {
        "code": "request_data",
        "custom_name": "",
        "dp_id": 125,
        "time": 1694461120771,
        "value": "map"
      },
      {
        "code": "comm_flag",
        "custom_name": "",
        "dp_id": 126,
        "time": 1694461120771,
        "value": "1"
      },
      {
        "code": "comm_raw",
        "custom_name": "",
        "dp_id": 127,
        "time": 1700870426113,
        "value": "ITHINKTHISSHOULDBERDACTED"
      },
      {
        "code": "message_report",
        "custom_name": "",
        "dp_id": 128,
        "time": 1700870459801,
        "value": "3"
      },
      {
        "code": "reset_map",
        "custom_name": "",
        "dp_id": 129,
        "time": 1694461120771,
        "value": false
      },
      {
        "code": "sn",
        "custom_name": "",
        "dp_id": 130,
        "time": 1700870962206,
        "value": "ITHINKTHISSHOULDBERDACTED"
      },
      {
        "code": "uuid",
        "custom_name": "",
        "dp_id": 131,
        "time": 1700870962285,
        "value": "ITHINKTHISSHOULDBERDACTED"
      },
      {
        "code": "device_info",
        "custom_name": "",
        "dp_id": 132,
        "time": 1700904498775,
        "value": "ITHINKTHISSHOULDBERDACTED"
      },
      {
        "code": "yuliu",
        "custom_name": "",
        "dp_id": 135,
        "time": 1700870960512
      },
      {
        "code": "yuliu1",
        "custom_name": "",
        "dp_id": 136,
        "time": 1700870960512
      },
      {
        "code": "auto_boost",
        "custom_name": "",
        "dp_id": 137,
        "time": 1700904626511,
        "value": true
      },
      {
        "code": "room_mode_switch",
        "custom_name": "",
        "dp_id": 144,
        "time": 1700870961987,
        "value": false
      }
    ]
  }
}

Bonfra04 avatar Nov 25 '23 11:11 Bonfra04

same problem here mate, but im using a different vacuum

renash2me avatar Nov 29 '23 00:11 renash2me

@renash2me I managed to work around the problem by editing the entity JSON in the .storage directory: There the config of the vacuum is hardcoded programmatically and should not be modified by hand. If you manage to corrupt this file your home assistant configuration would be reset. That being said in the JSON file there is a part regarding the localtuya vacuum entity. There you can add DPs to the list (following the general format of the already present ones) and then pick this new DP for the UI.

File is at: /config/.storage/core.config_entities this is an example:

{
        "entry_id": "REDACTED",
        "version": 2,
        "domain": "localtuya",
        "title": "localtuya",
        "data": {
          "region": "eu",
          "username": "localtuya",
          "no_cloud": true,
          "client_id": "",
          "client_secret": "",
          "user_id": "",
          "devices": {
            "REDACTED": {
              "friendly_name": "Spazzino",
              "host": "REDACTED",
              "local_key": "REDACTED",
              "protocol_version": "3.3",
              "enable_debug": true,
              "entities": [
                {
                  "friendly_name": "Spazzino",
                  "idle_status_value": "idle",
                  "powergo_dp": 2,
                  "docked_status_value": "chargring,fullcharge",
                  "returning_status_value": "tocharge",
                  "battery_dp": 106,
                  "mode_dp": 104,
                  "modes": "smart,pose,zone,backcharge,curpointing,selectroom",
                  "return_mode": "backcharge",
                  "fan_speed_dp": 109,
                  "fan_speeds": "quiet,auto,strong,max",
                  "fault_dp": 122,
                  "paused_state": "pause",
                  "stop_status": "pause",
                  "id": 105,
                  "platform": "vacuum"
                }
              ],
              "add_entities": false,
              "device_id": "REDACTED",
              "dps_strings": [
                "2 (power_go)",
                "3 (mode)",
                "101 (value: False)",
                "102 (value: False)",
                "103 (value: True)",
                "104 (clean_mode)",
                "105 (robot_state)",
                "106 (battery)",
                "107 (value: 0)",
                "108 (value: 0)",
                "109 (fan_mode)",
                "113 (value: False)",
                "116 (value: 22549)",
                "117 (value: 436)",
                "118 (value: 18)",
                "119 (value: 22549)",
                "120 (value: 22549)",
                "121 (value: 22549)",
                "122 (robot_fault)",
                "137 (value: True)",
                "144 (value: False)"
              ],
              "product_key": "REDACTED"
            }
          },
          "updated_at": "1700991489139"
        },
        "options": {},
        "pref_disable_new_entities": false,
        "pref_disable_polling": false,
        "source": "user",
        "unique_id": "",
        "disabled_by": null
      }

As you can see the list of DPs is not standard as I added some. Then I can use the numerical value in the dropdowns in the UI. Beware that the ID DP that you choose at the start and cannot later change shall not be altered here as it will render the device unusable.

As for how I found which DP did what it was just a trial and error trying to guess which current value read from the IoT platform could better satisfy the name in the JSON file (which IMHO is more descriptive than the UI names).

I'm not closing this Issue since anyway even if its all correct somehow the status of the device is only available if HAOS and the vacuum are connected to the internet. If any of the two is offline the status is always set to unknown. Which doesn't make sense since all the other commands work fine

Bonfra04 avatar Nov 29 '23 08:11 Bonfra04

Thanks!!

renash2me avatar Nov 29 '23 20:11 renash2me

Same problem here, with a Vacum Kabum Smart 900.

Any solution?

guilhermelirio avatar Mar 30 '24 01:03 guilhermelirio

Same issue for for the Blaupunkt Bluebot XBOOST , status either in Error or in Cleaning

              "model": "BLUEBOT XBOOST",
              "device_id": "redacted",
              "dps_strings": [
                "1 (value: False)",
                "11 (value: 0)",
                "14 (value: 33)",
                "25 (value: True)",
                "26 (value: turn_left)",
                "27 (value: standby)",
                "28 (value: sleep)",
                "30 (value: high)",
                "31 (value: False)",
                "32 (value: 23)",
                "33 (value: 19)",
                "34 (value: 01902300299)"
              ]

Kipjr avatar Jun 08 '24 16:06 Kipjr