[App][Pro] Tuya Cloud

Hello everyone,since a few days(maybe the last Homey update?),all my Tuya devices(plugs and sensors) doesn’t update their status in Homey,example:if i open a window the sensor alarm is still off…If a flow stop a the plug every night at 3a.m ,the plug is still on in Homey.
No problem to control the plug inHomey manually the on/off button works…and after a restart of the app the status is updated!
I remove a sensor and try to reconnect in Homey but the app can’t find it…
I precise in the Smartlife app everything is working well,sensor appear and every devices status are update and in Iot platform all my devices appears online…
If someone can help?Thanks
Tuya version:Experimental 1.1.12

Would like to know this as well as I would very much like to have the energy readings from my tuya socket into homey.

Sorry for late reaction, I was ill and it’s going a little better now.

I don’t have any influence on the data pushed to the app by Tuya, if the power is absense, I can’t do anything about it. Also the update rate of values are not something I can do anything about, it’s get pushed by Tuya. Only if it’s an error in my app when receiving gives an error I can fix it. Till now I did not see an error here. As soon as the app received a message, it gets processed as raw flow. If the value is used in adevice, that value gets updated in Homey.

The link is to the documentation to instruction and status set and below the link is the code currently used to get power, so no kwh, but only power values.
Standard Status Set-Tuya IoT Development Platform-Tuya Developer

if (statusMap.code === 'cur_power') {
     this.setCapabilityValue("measure_power", statusMap.value/10).catch(this.error);
 }

@Tirrazo, this app is open source and you can contribute to it and/or check the code for erros if you believe this is the case. I have not seen an error yet in the app with passing power.
jurgenheine/com.tuya.cloud: Connect homey to the Tuya cloud (github.com)

@HvN and @Peter_Kawa, both big thanks for helping to find a solution to this issue :clap: :+1:

@Peter_Kawa , I saw your example of logging events :+1: :slight_smile:. For logging it should be enough to log text event received only. The boolean and nummeric values should be passed as text also. they are also passed as boolean or nummeric so they can be used directly without type conversion in flows.

2 Likes

Hello all,

I just tried to add my sockets to Homey, but they only get added as a light (the socket has a led ring).

I want to have them added as a socket too. I tried to add them as sockets but then there are no decided found.

Can someone give me a pointer?

Thanks,
Frank


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