athombv / com.tuya

Tuya app for Homey
https://homey.app/a/com.tuya
15 stars 11 forks source link

Smart plug with energy monitor #188

Closed andreaslundgren closed 2 days ago

andreaslundgren commented 2 weeks ago

Homey version

Homey premium with bridge 86

Tuya app version

1.2.3

App diagnostics report ID

No response

Description

Energy monitor doesnt seem to report watt or ampere correct, only voltage. Works in smart life though

Device specification

 {
   "device": {
     "active_time": 1724762034,
     "biz_type": 18,
     "category": "cz",
     "create_time": 1724762034,
     "icon": "smart/icon/ay1563289077386BG9pz/ee6fa97f5bc00defc486df6eb441fd42.png",
     "id": "bf044083f417d4f08fdgbz",
     "ip": "<redacted>",
     "lat": "<redacted>",
     "local_key": "<redacted>",
     "lon": "<redacted>",
     "model": "SH-P01E16",
     "name": "energimätare",
     "online": true,
     "owner_id": "<redacted>",
     "product_id": "3fmwdzhayui5miu7",
     "product_name": "SH-P01E16",
     "status": [
       {
         "code": "switch_1",
         "value": true
       },
       {
         "code": "countdown_1",
         "value": 0
       },
       {
         "code": "add_ele",
         "value": 0
       },
       {
         "code": "cur_current",
         "value": 0
       },
       {
         "code": "cur_power",
         "value": 0
       },
       {
         "code": "cur_voltage",
         "value": 2349
       },
       {
         "code": "relay_status",
         "value": "last"
       },
       {
         "code": "light_mode",
         "value": "relay"
       },
       {
         "code": "child_lock",
         "value": false
       },
       {
         "code": "cycle_time",
         "value": ""
       },
       {
         "code": "random_time",
         "value": ""
       },
       {
         "code": "switch_inching",
         "value": ""
       }
     ],
     "sub": false,
     "time_zone": "+02:00",
     "uid": "<redacted>",
     "update_time": 1724762044,
     "uuid": "<redacted>"
   },
   "specifications": {
     "category": "cz",
     "functions": [
       {
         "code": "switch_1",
         "type": "Boolean",
         "values": "{}"
       },
       {
         "code": "countdown_1",
         "type": "Integer",
         "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
       },
       {
         "code": "relay_status",
         "type": "Enum",
         "values": "{\"range\":[\"power_off\",\"power_on\",\"last\"]}"
       },
       {
         "code": "light_mode",
         "type": "Enum",
         "values": "{\"range\":[\"relay\",\"pos\",\"none\"]}"
       },
       {
         "code": "child_lock",
         "type": "Boolean",
         "values": "{}"
       },
       {
         "code": "cycle_time",
         "type": "String",
         "values": "{}"
       },
       {
         "code": "random_time",
         "type": "String",
         "values": "{}"
       },
       {
         "code": "switch_inching",
         "type": "String",
         "values": "{}"
       }
     ],
     "status": [
       {
         "code": "switch_1",
         "type": "Boolean",
         "values": "{}"
       },
       {
         "code": "countdown_1",
         "type": "Integer",
         "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
       },
       {
         "code": "add_ele",
         "type": "Integer",
         "values": "{\"min\":0,\"max\":50000,\"scale\":3,\"step\":100}"
       },
       {
         "code": "cur_current",
         "type": "Integer",
         "values": "{\"unit\":\"mA\",\"min\":0,\"max\":30000,\"scale\":0,\"step\":1}"
       },
       {
         "code": "cur_power",
         "type": "Integer",
         "values": "{\"unit\":\"W\",\"min\":0,\"max\":80000,\"scale\":1,\"step\":1}"
       },
       {
         "code": "cur_voltage",
         "type": "Integer",
         "values": "{\"unit\":\"V\",\"min\":0,\"max\":5000,\"scale\":1,\"step\":1}"
       },
       {
         "code": "relay_status",
         "type": "Enum",
         "values": "{\"range\":[\"power_off\",\"power_on\",\"last\"]}"
       },
       {
         "code": "light_mode",
         "type": "Enum",
         "values": "{\"range\":[\"relay\",\"pos\",\"none\"]}"
       },
       {
         "code": "child_lock",
         "type": "Boolean",
         "values": "{}"
       },
       {
         "code": "cycle_time",
         "type": "String",
         "values": "{}"
       },
       {
         "code": "random_time",
         "type": "String",
         "values": "{}"
       },
       {
         "code": "switch_inching",
         "type": "String",
         "values": "{}"
       }
     ]
   },
   "data_points": "<not available>"
 }
bobvandevijver commented 2 weeks ago

Can you please be a little more descriptive? What kind of values are you seeing, and what would you expect?

andreaslundgren commented 2 weeks ago

Im seeing this in homey Screenshot_20240829-165844 Screenshot_20240829-165933

But expecting this (as in smart life) Screenshot_20240829-165803 Screenshot_20240829-165808

bobvandevijver commented 2 weeks ago

Can you please try to add your device as "other/unknown" while making sure that in Smart Life the socket is showing non-zero current/power readings? I would be interested in the device specification that can be retrieved from the device settings. It will be similar to the one you posted when opening the tickets, but it should have a little bit more information.

andreaslundgren commented 2 weeks ago

Like this? Im getting data in smart life right now.

 {
   "device": {
     "active_time": 1724760836,
     "biz_type": 18,
     "category": "cz",
     "create_time": 1724760836,
     "icon": "smart/icon/ay1563289077386BG9pz/ee6fa97f5bc00defc486df6eb441fd42.png",
     "id": "bf4312e5d53de45bdeu9zp",
     "ip": "<redacted>",
     "lat": "<redacted>",
     "local_key": "<redacted>",
     "lon": "<redacted>",
     "model": "SH-P01E16",
     "name": "energimätare pool/spa",
     "online": true,
     "owner_id": "<redacted>",
     "product_id": "3fmwdzhayui5miu7",
     "product_name": "SH-P01E16",
     "status": [
       {
         "code": "switch_1",
         "value": true
       },
       {
         "code": "countdown_1",
         "value": 0
       },
       {
         "code": "add_ele",
         "value": 100
       },
       {
         "code": "cur_current",
         "value": 1285
       },
       {
         "code": "cur_power",
         "value": 2984
       },
       {
         "code": "cur_voltage",
         "value": 2366
       },
       {
         "code": "relay_status",
         "value": "last"
       },
       {
         "code": "light_mode",
         "value": "relay"
       },
       {
         "code": "child_lock",
         "value": false
       },
       {
         "code": "cycle_time",
         "value": ""
       },
       {
         "code": "random_time",
         "value": ""
       },
       {
         "code": "switch_inching",
         "value": ""
       }
     ],
     "sub": false,
     "time_zone": "+02:00",
     "uid": "<redacted>",
     "update_time": 1724943459,
     "uuid": "<redacted>"
   },
   "specifications": {
     "category": "cz",
     "functions": [
       {
         "code": "switch_1",
         "type": "Boolean",
         "values": "{}"
       },
       {
         "code": "countdown_1",
         "type": "Integer",
         "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
       },
       {
         "code": "relay_status",
         "type": "Enum",
         "values": "{\"range\":[\"power_off\",\"power_on\",\"last\"]}"
       },
       {
         "code": "light_mode",
         "type": "Enum",
         "values": "{\"range\":[\"relay\",\"pos\",\"none\"]}"
       },
       {
         "code": "child_lock",
         "type": "Boolean",
         "values": "{}"
       },
       {
         "code": "cycle_time",
         "type": "String",
         "values": "{}"
       },
       {
         "code": "random_time",
         "type": "String",
         "values": "{}"
       },
       {
         "code": "switch_inching",
         "type": "String",
         "values": "{}"
       }
     ],
     "status": [
       {
         "code": "switch_1",
         "type": "Boolean",
         "values": "{}"
       },
       {
         "code": "countdown_1",
         "type": "Integer",
         "values": "{\"unit\":\"s\",\"min\":0,\"max\":86400,\"scale\":0,\"step\":1}"
       },
       {
         "code": "add_ele",
         "type": "Integer",
         "values": "{\"min\":0,\"max\":50000,\"scale\":3,\"step\":100}"
       },
       {
         "code": "cur_current",
         "type": "Integer",
         "values": "{\"unit\":\"mA\",\"min\":0,\"max\":30000,\"scale\":0,\"step\":1}"
       },
       {
         "code": "cur_power",
         "type": "Integer",
         "values": "{\"unit\":\"W\",\"min\":0,\"max\":80000,\"scale\":1,\"step\":1}"
       },
       {
         "code": "cur_voltage",
         "type": "Integer",
         "values": "{\"unit\":\"V\",\"min\":0,\"max\":5000,\"scale\":1,\"step\":1}"
       },
       {
         "code": "relay_status",
         "type": "Enum",
         "values": "{\"range\":[\"power_off\",\"power_on\",\"last\"]}"
       },
       {
         "code": "light_mode",
         "type": "Enum",
         "values": "{\"range\":[\"relay\",\"pos\",\"none\"]}"
       },
       {
         "code": "child_lock",
         "type": "Boolean",
         "values": "{}"
       },
       {
         "code": "cycle_time",
         "type": "String",
         "values": "{}"
       },
       {
         "code": "random_time",
         "type": "String",
         "values": "{}"
       },
       {
         "code": "switch_inching",
         "type": "String",
         "values": "{}"
       }
     ]
   },
   "data_points": "<not available>"
 }
bobvandevijver commented 2 weeks ago

Okay, that indicates that the values are at least available on the cloud. Can you also generate an app diagnostics report and share its code please?

andreaslundgren commented 2 weeks ago

023b2ebd-1ae8-493c-ac61-d3b30a1e89c7

Is this correct? :)

bobvandevijver commented 2 weeks ago

That is what I am looking for, but it seems the logging I need is not recorded for some unknown reason. I would like to ask you to wait for our coming 1.3.0 release and to generate a new report after installing that version.

andreaslundgren commented 2 weeks ago

Alright, i will do that. Thanks!

bobvandevijver commented 4 days ago

So, I have great news: it seems that we have found why not all data points are reported, which is due to some interesting behaviour on the Tuya side. Luckily, it seems that we can fix that with some adjustment on our side. Work in progress, when I know more I will let you know.

bobvandevijver commented 2 days ago

I believe version 1.3.3 (currently in testing) fixes your issue, so I will close this. If it doesn't, please let us know.