make-all / tuya-local

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

Request support for Smart Plug+ #2407

Closed Michael-Kaempf closed 3 weeks ago

Michael-Kaempf commented 3 weeks ago

Log message

Test protocol error 914: Check device key or version

DPS information

"1": {
                "code": "switch_1",
                "type": "Boolean",
                "values": {}
            },
            "9": {
                "code": "countdown_1",
                "type": "Integer",
                "values": {
                    "unit": "s",
                    "min": 0,
                    "max": 86400,
                    "scale": 0,
                    "step": 1
                }
            },
            "17": {
                "code": "add_ele",
                "type": "Integer",
                "values": {
                    "min": 0,
                    "max": 50000,
                    "scale": 3,
                    "step": 100
                }
            },
            "18": {
                "code": "cur_current",
                "type": "Integer",
                "values": {
                    "unit": "mA",
                    "min": 0,
                    "max": 30000,
                    "scale": 0,
                    "step": 1
                }
            },
            "19": {
                "code": "cur_power",
                "type": "Integer",
                "values": {
                    "unit": "W",
                    "min": 0,
                    "max": 80000,
                    "scale": 1,
                    "step": 1
                }
            },
            "20": {
                "code": "cur_voltage",
                "type": "Integer",
                "values": {
                    "unit": "V",
                    "min": 0,
                    "max": 5000,
                    "scale": 1,
                    "step": 1
                }
            },
            "21": {
                "code": "test_bit",
                "type": "Integer",
                "values": {
                    "min": 0,
                    "max": 5,
                    "scale": 0,
                    "step": 1
                }
            },
            "22": {
                "code": "voltage_coe",
                "type": "Integer",
                "values": {
                    "min": 0,
                    "max": 1000000,
                    "scale": 0,
                    "step": 1
                }
            },
            "23": {
                "code": "electric_coe",
                "type": "Integer",
                "values": {
                    "min": 0,
                    "max": 1000000,
                    "scale": 0,
                    "step": 1
                }
            },
            "24": {
                "code": "power_coe",
                "type": "Integer",
                "values": {
                    "min": 0,
                    "max": 1000000,
                    "scale": 0,
                    "step": 1
                }
            },
            "25": {
                "code": "electricity_coe",
                "type": "Integer",
                "values": {
                    "min": 0,
                    "max": 1000000,
                    "scale": 0,
                    "step": 1
                }
            },
            "26": {
                "code": "fault",
                "type": "Bitmap",
                "values": {
                    "label": [
                        "ov_cr",
                        "ov_vol",
                        "ov_pwr",
                        "ls_cr",
                        "ls_vol",
                        "ls_pow"
                    ],
                    "maxlen": 6
                }
            },
            "38": {
                "code": "relay_status",
                "type": "Enum",
                "values": {
                    "range": [
                        "off",
                        "on",
                        "memory"
                    ]
                }
            },
            "39": {
                "code": "overcharge_switch",
                "type": "Boolean",
                "values": {}
            },
            "40": {
                "code": "light_mode",
                "type": "Enum",
                "values": {
                    "range": [
                        "relay",
                        "pos",
                        "none",
                        "on"
                    ]
                }
            },
            "41": {
                "code": "child_lock",
                "type": "Boolean",
                "values": {}
            },
            "42": {
                "code": "cycle_time",
                "type": "String",
                "values": "{\"maxlen\":255}"
            },
            "43": {
                "code": "random_time",
                "type": "String",
                "values": "{\"maxlen\":255}"
            },
            "44": {
                "code": "switch_inching",
                "type": "String",
                "values": "{\"maxlen\":255}"
            }
        }

Product ID

gbtxrqfy9xcsakyp

Product Name

Smart Plug+

Information about how the device functions

Tested with the following Python code it was working as expected:

import tinytuya

tinytuya.set_debug(True, False)

d = tinytuya.OutletDevice(
    dev_id='bfd54a66cd90fe17d79q6u',
    address='192.168.xxx.xxx',      # Or set to 'Auto' to auto-discover IP address
    local_key='XXXXXXXXXXXXXX',
    dev_type='default',
    version=3.4)

# Get Status
data = d.status() 
print('set_status() result %r' % data)

# Turn Off
d.turn_off()

# Turn On
d.turn_on()

Providing same data to the input of HomeAssistant it failed with error:

image

Device seems to be very similar to the device configuration custom_components/tuya_local/devices/smartplugv2_energyv3.yaml, but uses protocol version 3.4.

make-all commented 3 weeks ago

The log message is telling you what the issue is here. As this is the standard dps layout for smartplugs. it is not a matter of a new device needing to be supported.

Michael-Kaempf commented 3 weeks ago

No. The log is telling nothing usefull. It is working with python test script but not with the ingeration. So it seems to be an failure at another point.

Please reopen and comment as bug.