Xenomes/Domoticz-TinyTUYA-Plugin

on/on/on/on/on

Closed this issue · 24 comments

When a device is on, the Tuya polling system (check for the status of a device) keeps turning on the device instead of simply changing the status once to match that of Tuya. This isn't the case when a device is off.

screenshot

Is this normal behaviour?

Addon: this only seems to occur with RGBWW lights, not with dimmers or switches.

Hi Vespino, I was a bit busy the last couple of weeks. I will try to fix this this week.

Found the problem, fixed in 1.8.3

The issue remains...

There is one 'on' after the last push to the light, i don't know if i can resolve this.
afbeelding

My RGBWW lights keep logging “on” every 60-70 seconds.

Can you make an json dump with debug_discovery.py? So i can check the code with your json.

This is the part for my RGBWW (or RGBCW apparently) light that seems to have this issue:

  {
    "name": "Vloerlamp",
    "id": "<id>",
    "key": "Deleted",
    "mac": "<mac>",
    "uuid": "<uuid>",
    "sn": "<dn>",
    "category": "dj",
    "product_name": "Calex A60 RGBCW",
    "product_id": "<product_id>",
    "biz_type": 0,
    "model": "sky",
    "sub": false,
    "icon": "https://images.tuyaeu.com/smart/icon/ay1541056239985fDGjj/b813c6c1f9e8ce9d6cb60c36158165f5.png"
  }

Is this what you're looking for?

Yes, and the part with functions and status of

This is the only output given, the list of devices. How can I provide more info?

You should get a list with the layout as shown at post #100.

Very strange, the json snippet I posted is the only output I’m getting. I had the log level “info” turned off, but even after turning it on, the output remains the same.

I only have to run the one file, debug_discovery.py?

Edit to fill in the credentials and run.

I ran the command with flags and only got this output. Weird, right? My log is now flooded with these entries:

2024-04-10 21:27:58.356 TinyTUYA: Update devices in Domoticz
2024-04-10 21:29:08.404 TinyTUYA: Update devices in Domoticz
2024-04-10 21:30:18.397 TinyTUYA: Update devices in Domoticz
2024-04-10 21:31:28.463 TinyTUYA: Update devices in Domoticz

In the hardware section debug is set to none. Can I run the command with a debug flag Python or all or something like that?

Strange, it should create a dump.json file with the info, the script runs standalone it don't interfere with Domoticz.

I am Sorry, there has be a error with the script... i will sort it out.

Where was a incomplete version uploaded, i downgrade to the correct one.

Here you go.

Properties of device: <device>
{
  "result": {
    "category": "dj",
    "functions": [
      {
        "code": "switch_led",
        "desc": "{}",
        "name": "\u5f00\u5173",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "work_mode",
        "desc": "{\"range\":[\"white\",\"colour\",\"scene\",\"music\"]}",
        "name": "\u5de5\u4f5c\u6a21\u5f0f",
        "type": "Enum",
        "values": "{\"range\":[\"white\",\"colour\",\"scene\",\"music\"]}"
      },
      {
        "code": "bright_value_v2",
        "desc": "{\"min\":10,\"max\":1000,\"scale\":0,\"step\":1}",
        "name": "\u4eae\u5ea6",
        "type": "Integer",
        "values": "{\"min\":10,\"max\":1000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "temp_value_v2",
        "desc": "{\"min\":0,\"max\":1000,\"scale\":0,\"step\":1}",
        "name": "\u8272\u6e29",
        "type": "Integer",
        "values": "{\"min\":0,\"max\":1000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "colour_data_v2",
        "desc": "{\"h\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1},\"v\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}}",
        "name": "\u5f69\u5149\u6a21\u5f0f\u503c",
        "type": "Json",
        "values": "{\"h\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1},\"v\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}}"
      },
      {
        "code": "scene_data_v2",
        "desc": "{\"scene_num\":{\"min\":1,\"scale\":0,\"max\":8,\"step\":1},\"scene_units\": {\"unit_change_mode\":{\"range\":[\"static\",\"jump\",\"gradient\"]},\"unit_switch_duration\":{\"min\":0,\"scale\":0,\"max\":100,\"step\":1},\"unit_gradient_duration\":{\"min\":0,\"scale\":0,\"max\":100,\"step\":1},\"bright\":{\"min\":0,\"scale\":0,\"max\":1000,\"step\":1},\"temperature\":{\"min\":0,\"scale\":0,\"max\":1000,\"step\":1},\"h\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1},\"v\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}}}",
        "name": "\u573a\u666f\u6a21\u5f0f\u503c",
        "type": "Json",
        "values": "{\"scene_num\":{\"min\":1,\"scale\":0,\"max\":8,\"step\":1},\"scene_units\": {\"unit_change_mode\":{\"range\":[\"static\",\"jump\",\"gradient\"]},\"unit_switch_duration\":{\"min\":0,\"scale\":0,\"max\":100,\"step\":1},\"unit_gradient_duration\":{\"min\":0,\"scale\":0,\"max\":100,\"step\":1},\"bright\":{\"min\":0,\"scale\":0,\"max\":1000,\"step\":1},\"temperature\":{\"min\":0,\"scale\":0,\"max\":1000,\"step\":1},\"h\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1},\"v\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}}}"
      },
      {
        "code": "countdown_1",
        "desc": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}",
        "name": "\u5012\u8ba1\u65f6",
        "type": "Integer",
        "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
      },
      {
        "code": "music_data",
        "desc": "{\"change_mode\":{\"range\":[\"direct\",\"gradient\"]}, \"bright\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}, \"temperature\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}, \"h\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1},\"v\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1}}",
        "name": "\u97f3\u4e50\u706f\u6a21\u5f0f\u503c",
        "type": "Json",
        "values": "{\"change_mode\":{\"range\":[\"direct\",\"gradient\"]}, \"bright\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}, \"temperature\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}, \"h\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1},\"v\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1}}"
      },
      {
        "code": "control_data",
        "desc": "{\"change_mode\":{\"range\":[\"direct\",\"gradient\"]}, \"bright\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}, \"temperature\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}, \"h\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1},\"v\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1}}",
        "name": "\u8c03\u8282\u6a21\u5f0f\u503c",
        "type": "Json",
        "values": "{\"change_mode\":{\"range\":[\"direct\",\"gradient\"]}, \"bright\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}, \"temperature\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}, \"h\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1},\"v\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1}}"
      },
      {
        "code": "rhythm_mode",
        "desc": "{\"maxlen\":255}",
        "name": "\u751f\u7269\u8282\u5f8b",
        "type": "Raw",
        "values": "{\"maxlen\":255}"
      },
      {
        "code": "sleep_mode",
        "desc": "{\"maxlen\":255}",
        "name": "\u5165\u7761",
        "type": "Raw",
        "values": "{\"maxlen\":255}"
      },
      {
        "code": "wakeup_mode",
        "desc": "{\"maxlen\":255}",
        "name": "\u5524\u9192",
        "type": "Raw",
        "values": "{\"maxlen\":255}"
      },
      {
        "code": "remote_switch",
        "desc": "{}",
        "name": "\u9065\u63a7\u5668\u5f00\u5173",
        "type": "Boolean",
        "values": "{}"
      }
    ],
    "status": [
      {
        "code": "switch_led",
        "name": "\u5f00\u5173",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "work_mode",
        "name": "\u6a21\u5f0f",
        "type": "Enum",
        "values": "{\"range\":[\"white\",\"colour\",\"scene\",\"music\"]}"
      },
      {
        "code": "bright_value_v2",
        "name": "\u4eae\u5ea6",
        "type": "Integer",
        "values": "{\"min\":10,\"max\":1000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "temp_value_v2",
        "name": "\u51b7\u6696",
        "type": "Integer",
        "values": "{\"min\":0,\"max\":1000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "colour_data_v2",
        "name": "\u5f69\u5149\u6a21\u5f0f",
        "type": "Json",
        "values": "{\"h\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1},\"v\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}}"
      },
      {
        "code": "scene_data_v2",
        "name": "\u60c5\u666f\u6a21\u5f0f",
        "type": "Json",
        "values": "{\"scene_num\":{\"min\":1,\"scale\":0,\"max\":8,\"step\":1},\"scene_units\": {\"unit_change_mode\":{\"range\":[\"static\",\"jump\",\"gradient\"]},\"unit_switch_duration\":{\"min\":0,\"scale\":0,\"max\":100,\"step\":1},\"unit_gradient_duration\":{\"min\":0,\"scale\":0,\"max\":100,\"step\":1},\"bright\":{\"min\":0,\"scale\":0,\"max\":1000,\"step\":1},\"temperature\":{\"min\":0,\"scale\":0,\"max\":1000,\"step\":1},\"h\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1},\"v\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}}}"
      },
      {
        "code": "countdown_1",
        "name": "\u5012\u8ba1\u65f6",
        "type": "Integer",
        "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
      },
      {
        "code": "music_data",
        "name": "\u97f3\u4e50\u706f\u8c03\u8282",
        "type": "Json",
        "values": "{\"change_mode\":{\"range\":[\"direct\",\"gradient\"]}, \"bright\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}, \"temperature\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}, \"h\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1},\"v\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1}}"
      },
      {
        "code": "control_data",
        "name": "\u8c03\u8282\u63a7\u5236",
        "type": "Json",
        "values": "{\"change_mode\":{\"range\":[\"direct\",\"gradient\"]}, \"bright\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}, \"temperature\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":1000,\"step\":1}, \"h\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1},\"v\":{\"min\":0,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1}}"
      },
      {
        "code": "rhythm_mode",
        "name": "\u751f\u7269\u8282\u5f8b",
        "type": "Raw",
        "values": "{\"maxlen\":\"255\"}"
      },
      {
        "code": "sleep_mode",
        "name": "\u5165\u7761",
        "type": "Raw",
        "values": "{\"maxlen\":\"255\"}"
      },
      {
        "code": "wakeup_mode",
        "name": "\u5524\u9192",
        "type": "Raw",
        "values": "{\"maxlen\":\"255\"}"
      },
      {
        "code": "remote_switch",
        "name": "\u9065\u63a7\u5668\u5f00\u5173",
        "type": "Boolean",
        "values": "{}"
      }
    ]
  },
  "success": true,
  "t": 1712813729507,
  "tid": "4e9f78cef7c511ee84d70e9d2b17c2e7"
}
Status of device: <device>
{
  "result": [
    {
      "code": "switch_led",
      "value": false
    },
    {
      "code": "work_mode",
      "value": "white"
    },
    {
      "code": "bright_value_v2",
      "value": 307
    },
    {
      "code": "temp_value_v2",
      "value": 186
    },
    {
      "code": "colour_data_v2",
      "value": "{\"h\":273,\"s\":160,\"v\":450}"
    },
    {
      "code": "scene_data_v2",
      "value": "{\"scene_num\":1,\"scene_units\":[{\"bright\":200,\"h\":0,\"s\":0,\"temperature\":0,\"unit_change_mode\":\"static\",\"unit_gradient_duration\":13,\"unit_switch_duration\":14,\"v\":0}]}"
    },
    {
      "code": "countdown_1",
      "value": 0
    },
    {
      "code": "music_data",
      "value": ""
    },
    {
      "code": "control_data",
      "value": ""
    },
    {
      "code": "rhythm_mode",
      "value": "AAAAAAA="
    },
    {
      "code": "sleep_mode",
      "value": "AAA="
    },
    {
      "code": "wakeup_mode",
      "value": "AAA="
    },
    {
      "code": "remote_switch",
      "value": true
    }
  ],
  "success": true,
  "t": 1712813729638,
  "tid": "4eb32dcbf7c511eebfdcf20bbc22db8f"
}

Yes perfect, hopefully i can replicate the issue now.

I was able to find the problem and make a fix for it. If you check out the latest version, you can test it.

Done. Now waiting for the sun to set.

Excellent, it works 👌🏻

Perfect!