[App][Pro] Tuya Cloud

If your socket is representing itself as a light instead of a socket, you can add it as a light and not as a socket. Tuya should give it it’s own device type, they already have plenty of them. To use it, you can go the raw flows way as described in opening post and see also

Hi Jurgen,

I managed to get the details you refer to. So I can use flows to switch the device on and off
(something I also could do with scenes created in the Tuya app). But the main reason I ask is that I am missing the energy monitoring functionality. I even see them coming in the the above ‘Text event received’.

I think it is not possible, but can I change something in the Tuya IoT platform so I will announce itself as a socket?

This are the details I receive when calling the Get Device Specification api call in Tuya IoT platform.
(And just “No” is an acceptable answer ;))

{
  "result": {
    "category": "dj",
    "functions": [
      {
        "code": "switch_led",
        "lang_config": {
          "false": "OFF",
          "true": "ON"
        },
        "name": "Led Name",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "bright_value",
        "lang_config": {
          "unit": ""
        },
        "name": "Bright",
        "type": "Integer",
        "values": "{\"unit\":\"\",\"min\":25,\"max\":255,\"scale\":0,\"step\":1}"
      },
      {
        "code": "work_mode",
        "lang_config": {
          "colour": "Colour",
          "scene": "Scene",
          "scene_1": "Scene 1",
          "scene_2": "Scene 2",
          "scene_3": "Scene 3",
          "scene_4": "Scene 4",
          "white": "White"
        },
        "name": "Mode",
        "type": "Enum",
        "values": "{\"range\":[\"white\",\"colour\",\"scene\",\"scene_1\",\"scene_2\",\"scene_3\",\"scene_4\"]}"
      },
      {
        "code": "colour_data",
        "lang_config": {
          "unit": ""
        },
        "name": "Colour Data",
        "type": "Json",
        "values": "{\"h\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1},\"v\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1}}"
      },
      {
        "code": "scene_data",
        "lang_config": {
          "unit": ""
        },
        "name": "Scene Data",
        "type": "Json",
        "values": "{\"h\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1},\"v\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1}}"
      },
      {
        "code": "flash_scene_1",
        "lang_config": {
          "unit": ""
        },
        "name": "Soft",
        "type": "Json",
        "values": "{\"h\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1},\"v\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1}}"
      },
      {
        "code": "flash_scene_2",
        "lang_config": {
          "unit": ""
        },
        "name": "Colourful",
        "type": "Json",
        "values": "{\"h\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1},\"v\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1}}"
      },
      {
        "code": "flash_scene_3",
        "lang_config": {
          "unit": ""
        },
        "name": "Exciting",
        "type": "Json",
        "values": "{\"h\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1},\"v\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1}}"
      },
      {
        "code": "flash_scene_4",
        "lang_config": {
          "unit": ""
        },
        "name": "Wonderful",
        "type": "Json",
        "values": "{\"h\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1},\"v\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1}}"
      },
      {
        "code": "switch",
        "lang_config": {
          "false": "OFF",
          "true": "ON"
        },
        "name": "switch name",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "countdown_1",
        "lang_config": {
          "unit": "s"
        },
        "name": "countdown",
        "type": "Integer",
        "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
      }
    ],
    "status": [
      {
        "code": "switch_led",
        "lang_config": {
          "false": "OFF",
          "true": "ON"
        },
        "name": "Led Name",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "work_mode",
        "lang_config": {
          "colour": "Colour",
          "scene": "Scene",
          "scene_1": "Scene 1",
          "scene_2": "Scene 2",
          "scene_3": "Scene 3",
          "scene_4": "Scene 4",
          "white": "White"
        },
        "name": "Mode",
        "type": "Enum",
        "values": "{\"range\":[\"white\",\"colour\",\"scene\",\"scene_1\",\"scene_2\",\"scene_3\",\"scene_4\"]}"
      },
      {
        "code": "bright_value",
        "lang_config": {
          "unit": ""
        },
        "name": "Bright",
        "type": "Integer",
        "values": "{\"unit\":\"\",\"min\":25,\"max\":255,\"scale\":0,\"step\":1}"
      },
      {
        "code": "colour_data",
        "lang_config": {
          "unit": ""
        },
        "name": "Colour Data",
        "type": "Json",
        "values": "{\"h\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1},\"v\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1}}"
      },
      {
        "code": "scene_data",
        "lang_config": {
          "unit": ""
        },
        "name": "Scene Data",
        "type": "Json",
        "values": "{\"h\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1},\"v\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1}}"
      },
      {
        "code": "flash_scene_1",
        "lang_config": {
          "unit": ""
        },
        "name": "Soft",
        "type": "Json",
        "values": "{\"h\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1},\"v\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1}}"
      },
      {
        "code": "flash_scene_2",
        "lang_config": {
          "unit": ""
        },
        "name": "Colourful",
        "type": "Json",
        "values": "{\"h\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1},\"v\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1}}"
      },
      {
        "code": "flash_scene_3",
        "lang_config": {
          "unit": ""
        },
        "name": "Exciting",
        "type": "Json",
        "values": "{\"h\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1},\"v\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1}}"
      },
      {
        "code": "flash_scene_4",
        "lang_config": {
          "unit": ""
        },
        "name": "Wonderful",
        "type": "Json",
        "values": "{\"h\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":360,\"step\":1},\"s\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1},\"v\":{\"min\":1,\"scale\":0,\"unit\":\"\",\"max\":255,\"step\":1}}"
      },
      {
        "code": "switch",
        "lang_config": {
          "false": "OFF",
          "true": "ON"
        },
        "name": "switch name",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "cur_current",
        "lang_config": {
          "unit": "mA"
        },
        "name": "Current",
        "type": "Integer",
        "values": "{\"unit\":\"mA\",\"min\":0,\"max\":30000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "cur_power",
        "lang_config": {
          "unit": "W"
        },
        "name": "Power",
        "type": "Integer",
        "values": "{\"unit\":\"W\",\"min\":0,\"max\":50000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "cur_voltage",
        "lang_config": {
          "unit": "V"
        },
        "name": "Voltage",
        "type": "Integer",
        "values": "{\"unit\":\"V\",\"min\":0,\"max\":2500,\"scale\":0,\"step\":1}"
      },
      {
        "code": "countdown_1",
        "lang_config": {
          "unit": "s"
        },
        "name": "countdown",
        "type": "Integer",
        "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
      }
    ]
  },
  "success": true,
  "t": 1664122164154,
  "tid": "6bf0048a3cec11ed9f8a22dacb9008b9"
}

You could try with a virtual socket with measuring enabled? This “replaces” your original socket (move it to a zone with a name like z_donottouch, so it is kind of hidden)
Screenshot from 2022-09-25 19-48-22

I made a complete flowset plus virtual socket for this issue, you can import it right away:

1 Like

Wow! That looks promising. Will buy Advanced flow and will test is out.

I have tested it and it works, but not the way I want
 but i gives me the possibility to do what I want.
I need to link the lights off action to the power off action.

Is it oke for you if I shared a little changed flow in The Flow Exchange(r) - Exchange Your Flows with Others! - #18 by Peter_Kawa?

Again thanks for the nice flow your created!! :partying_face:

1 Like

Of course it is okay

I managed to get it all working thanks to @Peter_Kawa.

See my solution: The Flow Exchange(r) - Exchange Your Flows with Others! - #20 by Frekel

And again a big thanks to @Peter_Kawa for this excellent flow I just needed to tweak :wink:

2 Likes

Nice to hear, Frekel!
A little housekeeping, would you be so kind to cut & paste your post into this topic?: https://community.homey.app/t/share-your-device-advanced-virtual-devices-from-device-capabilities/68676

2 Likes

@Jurgen_Heine Thanks for developing this great app. Recently I tried to integrate the Tuya Wi-Fi presence into Homey, but I found that the status in Homey app won’t change while it function normally in smart life app, I can see the status change. I look into the Tuya IoT platform and I can’t find any timing options for status push.

The only option to make the status change in Homey is to restart the app, and it will get the latest status from Tuya cloud. But after that, the status is keeping the same.

May I know if know any specific reason why it can’t update in the homey app? Thanks

Does it send text events maybe?
Try this:

Just ignored this question, I found the issue, I dont have device status notification API added into Tuya cloud project

1 Like

Hi Jurgen

I had to restore my homey today and suddenly i get the message Missing Capability Listener: onOff when I try to turn a plug (Tuya) on.

When i try to turn on a tuya light i get no response

When i use the tuya app i have no issues

I am on the official API
Homey app 6.11.5.956
Tuya app 1.1.12

I tried: different wifi channels

Restore and reboot

Seams like i have no connection to tuya at all

a00c91a8-bdf2-49a6-b833-73987cfd74dc

According to log is this because the cloud development trial is expired. See this in more logs starting last week. A couple of weeks ago I got myself a e-mail that I had to log in on portal otherwise the account get’s expired.

1 Like

Tnx Jurgen, again as swift as always. Now i have to figur out how to renew

1 Like

Let me know if you solve it.

Just log in to https://iot.tuya.com/cloud I think.

1 Like

Same behavior overhere. I only did not restore my homey. Everything just stopped working while I didn’t change anything.

I also get no error message when switching lights and missing capability listener when switching plugs. All devices can still be operated via smartlive app and all devices are available in tuya iot cloud.

I logged in in the iot cloud but that does not fix the problem.

So I have extended and it got approved. I restarted the app, but nothing works yet. Is there a timeframe?

So I followed HvN his post.

  • Signed out from the Tuya App
  • Tuya IoT Platform → Cloud → Deployment → Open/Edit project → Devices → Link Tuya App Account-> Unlink (app account)
  • Add App Account (same page as above one).
  • Signed on in the Tuya App (existing account)
  • Tuya App → + Sign (right top corner) → Add Devices → Scanning icon (right top corner) → scan the QR code.
  • Homey Tuya App Settings → Re-run the configuration (save). All done.

This actually gave me hope but didnt work.

This is what i did to solve it.

  1. Create a new account at Tuya
  2. Follow the create project steps and link app
  3. Reconfigure your app in homey
  4. reset the app
  5. extend your IOT service with 6 months

And it worked again.

Silly but not managing my tuya with Kaku gave the family stress.

And my dogs drink fountain :slight_smile:

2 Likes

Just looked at it myself, according Tuya you have only to extend, see also Q3 of Tuya integration FAQ in the First post. (I have edited first post to show images larger). I my case everything is still working, but IOT services was already expired for almost a half year. But the device status notification will expire in december.

Thank you. It was a bit hidden but it seemed to be expired since 2-10-22. That explains a lot. I now extended it for 6 months. Does this mean we have to extend every 6 months from now on?