-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tuya integration - power value is 10x to high #63978
Comments
tuya documentation |
Hey there @tuya, @zlinoliver, @METISU, @frenck, mind taking a look at this issue as it has been labeled with an integration ( |
Hi @Moridium , I just can confirm this is the case for original issue too (11.3 W SmartLife vs 114W HA) ;) Do you take voltage from some kind of endpoint or sth? + What class of device do you have? (socket, switch)? |
Hi @OldShaterhan |
I wonder why in your case voltage is probably correct and in my case both voltage and power are 10x greater. Could you confirm if your current level seems to be fine? I think this is Tuya API related, but I'm not that deep and I'm not sure... |
Btw. when you noticed that value got broken? I have my values (voltage, current, power) entities enabled since yesterday (earlier it was disabled by default by integration and I found it mainly due that. |
I noticed this sometime around start of December, the energy prices exploded so i needed to analyse where the consumption where. I therefore bought these plugs on amazon, since they had lots of comments on working with HA. |
It seems potentially to be related to sth mentioned in Local Tuya: https://github.com/rospogrigio/localtuya#energy-monitoring-values . Also I tried to contact Tuya support, they suggest it works as intended... Not sure how this could be dealt. |
From version 2022.2 onwards you will have a diagnostic tool that will provide you with the data needed to find the answer to this problem. Please, when you update your version can you export this information from your device (by going to the device and clicking the download diagnostics button) and post it here? |
I have the same problem with one of my wall plugs. This is the dignostics of a problematic device (shows ~1600W instead of ~160W) Note that in the status field of the problematic device, both power and voltagage is multiplied by 10. But in the entity state, voltage is correct, but power is still x10, Diagnostics JSON of problematic device{
"home_assistant": {
"installation_type": "Home Assistant Container",
"version": "2022.2.0b6",
"dev": false,
"hassio": false,
"virtualenv": false,
"python_version": "3.9.7",
"docker": true,
"arch": "x86_64",
"timezone": "Europe/Stockholm",
"os_name": "Linux",
"os_version": "5.4.0-96-generic",
"run_as_root": true
},
"custom_components": {},
"integration_manifest": {
"domain": "tuya",
"name": "Tuya",
"documentation": "https://www.home-assistant.io/integrations/tuya",
"requirements": [
"tuya-iot-py-sdk==0.6.6"
],
"dependencies": [
"ffmpeg"
],
"codeowners": [
"@Tuya",
"@zlinoliver",
"@METISU",
"@frenck"
],
"config_flow": true,
"iot_class": "cloud_push",
"dhcp": ['snip'],
"is_built_in": true
},
"data": {
"endpoint": "https://openapi.tuyaeu.com",
"auth_type": 0,
"country_code": "46",
"app_type": "smartlife",
"mqtt_connected": true,
"disabled_by": null,
"disabled_polling": false,
"name": "V\u00e4rmelampa",
"model": "FK-PW802EC-F",
"category": "cz",
"product_id": "ipabufmlmodje1ws",
"product_name": "",
"online": true,
"sub": false,
"time_zone": "+01:00",
"active_time": "2022-01-22T12:55:50+00:00",
"create_time": "2022-01-21T20:32:42+00:00",
"update_time": "2022-01-22T12:55:53+00:00",
"function": {
"switch_1": {
"type": "Boolean",
"value": {}
},
"countdown_1": {
"type": "Integer",
"value": {
"unit": "s",
"min": 0,
"max": 86400,
"scale": 0,
"step": 1
}
},
"add_ele": {
"type": "Integer",
"value": {
"unit": "kwh",
"min": 0,
"max": 50000,
"scale": 3,
"step": 100
}
}
},
"status_range": {
"switch_1": {
"type": "Boolean",
"value": {}
},
"add_ele": {
"type": "Integer",
"value": {
"unit": "kwh",
"min": 0,
"max": 50000,
"scale": 3,
"step": 100
}
},
"cur_current": {
"type": "Integer",
"value": {
"unit": "mA",
"min": 0,
"max": 30000,
"scale": 0,
"step": 1
}
},
"cur_power": {
"type": "Integer",
"value": {
"unit": "W",
"min": 0,
"max": 50000,
"scale": 0,
"step": 1
}
},
"cur_voltage": {
"type": "Integer",
"value": {
"unit": "V",
"min": 0,
"max": 5000,
"scale": 1,
"step": 1
}
},
"test_bit": {
"type": "Integer",
"value": {
"unit": "",
"min": 0,
"max": 5,
"scale": 0,
"step": 1
}
},
"voltage_coe": {
"type": "Integer",
"value": {
"unit": "",
"min": 0,
"max": 1000000,
"scale": 0,
"step": 1
}
},
"electric_coe": {
"type": "Integer",
"value": {
"unit": "",
"min": 0,
"max": 1000000,
"scale": 0,
"step": 1
}
},
"power_coe": {
"type": "Integer",
"value": {
"unit": "",
"min": 0,
"max": 1000000,
"scale": 0,
"step": 1
}
},
"electricity_coe": {
"type": "Integer",
"value": {
"unit": "",
"min": 0,
"max": 1000000,
"scale": 0,
"step": 1
}
},
"countdown_1": {
"type": "Integer",
"value": {
"unit": "s",
"min": 0,
"max": 86400,
"scale": 0,
"step": 1
}
}
},
"status": {
"switch_1": true,
"countdown_1": 0,
"add_ele": 82,
"cur_current": 435,
"cur_power": 1642,
"cur_voltage": 2246,
"test_bit": 1,
"voltage_coe": 632,
"electric_coe": 10795,
"power_coe": 10197,
"electricity_coe": 4090
},
"home_assistant": {
"name": "V\u00e4rmelampa",
"name_by_user": null,
"disabled": false,
"disabled_by": null,
"entities": [
{
"disabled": false,
"disabled_by": null,
"entity_category": null,
"device_class": "current",
"original_device_class": "current",
"icon": null,
"original_icon": null,
"unit_of_measurement": "A",
"state": {
"entity_id": "sensor.varmelampa_current",
"state": "0.435",
"attributes": {
"state_class": "measurement",
"unit_of_measurement": "A",
"device_class": "current",
"friendly_name": "V\u00e4rmelampa Current"
},
"last_changed": "2022-02-02T14:11:07.866079+00:00",
"last_updated": "2022-02-02T14:11:07.866079+00:00"
}
},
{
"disabled": false,
"disabled_by": null,
"entity_category": null,
"device_class": "voltage",
"original_device_class": "voltage",
"icon": null,
"original_icon": null,
"unit_of_measurement": "V",
"state": {
"entity_id": "sensor.varmelampa_voltage",
"state": "224.6",
"attributes": {
"state_class": "measurement",
"unit_of_measurement": "V",
"device_class": "voltage",
"friendly_name": "V\u00e4rmelampa Voltage"
},
"last_changed": "2022-02-02T14:39:52.873138+00:00",
"last_updated": "2022-02-02T14:39:52.873138+00:00"
}
},
{
"disabled": false,
"disabled_by": null,
"entity_category": null,
"device_class": "outlet",
"original_device_class": "outlet",
"icon": null,
"original_icon": null,
"unit_of_measurement": null,
"state": {
"entity_id": "switch.honshus_varmelampa",
"state": "on",
"attributes": {
"device_class": "outlet",
"friendly_name": "H\u00f6nshus V\u00e4rmelampa"
},
"last_changed": "2022-02-02T12:51:16.096748+00:00",
"last_updated": "2022-02-02T12:51:16.096748+00:00"
}
},
{
"disabled": false,
"disabled_by": null,
"entity_category": null,
"device_class": "power",
"original_device_class": "power",
"icon": null,
"original_icon": null,
"unit_of_measurement": "W",
"state": {
"entity_id": "sensor.honshus_varmelampa_power",
"state": "1642.0",
"attributes": {
"state_class": "measurement",
"unit_of_measurement": "W",
"device_class": "power",
"friendly_name": "H\u00f6nshus V\u00e4rmelampa Power"
},
"last_changed": "2022-02-02T14:39:52.872745+00:00",
"last_updated": "2022-02-02T14:39:52.872745+00:00"
}
}
]
}
}
} This is the dignostics of a device that's working correctly (shows ~1200W which is correct) Diagnostics JSON of working device{
"home_assistant": {
"installation_type": "Home Assistant Container",
"version": "2022.2.0b6",
"dev": false,
"hassio": false,
"virtualenv": false,
"python_version": "3.9.7",
"docker": true,
"arch": "x86_64",
"timezone": "Europe/Stockholm",
"os_name": "Linux",
"os_version": "5.4.0-96-generic",
"run_as_root": true
},
"custom_components": {},
"integration_manifest": {
"domain": "tuya",
"name": "Tuya",
"documentation": "https://www.home-assistant.io/integrations/tuya",
"requirements": [
"tuya-iot-py-sdk==0.6.6"
],
"dependencies": [
"ffmpeg"
],
"codeowners": [
"@Tuya",
"@zlinoliver",
"@METISU",
"@frenck"
],
"config_flow": true,
"iot_class": "cloud_push",
"dhcp": ['snip'],
"is_built_in": true
},
"data": {
"endpoint": "https://openapi.tuyaeu.com",
"auth_type": 0,
"country_code": "46",
"app_type": "smartlife",
"mqtt_connected": true,
"disabled_by": null,
"disabled_polling": false,
"name": "Spa",
"model": "JLCZ8266",
"category": "cz",
"product_id": "fencxse0bnut96ig",
"product_name": "smart plug",
"online": true,
"sub": false,
"time_zone": "+01:00",
"active_time": "2022-01-28T07:32:38+00:00",
"create_time": "2022-01-28T07:32:38+00:00",
"update_time": "2022-01-28T07:32:52+00:00",
"function": {
"switch_1": {
"type": "Boolean",
"value": {}
},
"countdown_1": {
"type": "Integer",
"value": {
"unit": "s",
"min": 0,
"max": 86400,
"scale": 0,
"step": 1
}
}
},
"status_range": {
"switch_1": {
"type": "Boolean",
"value": {}
},
"countdown_1": {
"type": "Integer",
"value": {
"unit": "s",
"min": 0,
"max": 86400,
"scale": 0,
"step": 1
}
},
"add_ele": {
"type": "Integer",
"value": {
"unit": "kwh",
"min": 0,
"max": 50000,
"scale": 3,
"step": 100
}
},
"cur_current": {
"type": "Integer",
"value": {
"unit": "mA",
"min": 0,
"max": 30000,
"scale": 0,
"step": 1
}
},
"cur_power": {
"type": "Integer",
"value": {
"unit": "W",
"min": 0,
"max": 50000,
"scale": 1,
"step": 1
}
},
"cur_voltage": {
"type": "Integer",
"value": {
"unit": "V",
"min": 0,
"max": 5000,
"scale": 1,
"step": 1
}
}
},
"status": {
"switch_1": true,
"countdown_1": 0,
"add_ele": 203,
"cur_current": 5404,
"cur_power": 12018,
"cur_voltage": 2381
},
"home_assistant": {
"name": "Spa",
"name_by_user": "Spa Str\u00f6mbrytare",
"disabled": false,
"disabled_by": null,
"entities": [
{
"disabled": false,
"disabled_by": null,
"entity_category": null,
"device_class": null,
"original_device_class": "outlet",
"icon": null,
"original_icon": null,
"unit_of_measurement": null,
"state": {
"entity_id": "switch.spa_strombrytare_socket_1",
"state": "on",
"attributes": {
"device_class": "outlet",
"friendly_name": "Spa Socket 1"
},
"last_changed": "2022-02-02T12:51:16.096404+00:00",
"last_updated": "2022-02-02T12:51:16.096404+00:00"
}
},
{
"disabled": true,
"disabled_by": "integration",
"entity_category": null,
"device_class": null,
"original_device_class": "current",
"icon": null,
"original_icon": null,
"unit_of_measurement": "A",
"state": null
},
{
"disabled": true,
"disabled_by": "integration",
"entity_category": null,
"device_class": null,
"original_device_class": "voltage",
"icon": null,
"original_icon": null,
"unit_of_measurement": "V",
"state": null
},
{
"disabled": false,
"disabled_by": null,
"entity_category": null,
"device_class": "power",
"original_device_class": "power",
"icon": null,
"original_icon": null,
"unit_of_measurement": "W",
"state": {
"entity_id": "sensor.spa_strombrytare_stromforbrukning",
"state": "1201.8",
"attributes": {
"state_class": "measurement",
"unit_of_measurement": "W",
"device_class": "power",
"friendly_name": "Spa Str\u00f6mf\u00f6rbrukning"
},
"last_changed": "2022-02-02T14:18:33.958088+00:00",
"last_updated": "2022-02-02T14:18:33.958088+00:00"
}
}
]
}
}
} |
Same issue here with Voltage & Current correct and Power displayed by factor of 10 out. Workaround is to use a template to divide power by 10, but would be nice to get correct scaling factor applied in the integration. Relevant snips from diagnostics:
Voltage & Current are scaled correctly, Power isn't scaled correctly
Downloaded Diagnostic: tuya-5f8e2d0c07ac2fa0e27008deadf407ac-6294HA-d812826aeed3155a16f834ec0142ab35.json.txt |
Here is the upstream issue: under status_range:
How do we escalate upstream? tuya-5f8e2d0c07ac2fa0e27008deadf407ac-6294HA-d812826aeed3155a16f834ec0142ab35.json.txt |
You can file a support ticket in the Tuya IoT environment=. |
or, you guys could use the localtuya interface to change your scaling-factor, i.e 1 means 0.1 , if it don't apply for your device, find the right one by "tryNerror" ... if the "scaling-factor" in localtuya-integration don't work , you got a device-problem, i have 1 Tuya , 1 Deltaco and about 8 Nedis devices( linked to local-tuya, well not all with "sensors" but finding the right scaling-factor wasn't hard, though don't rely on tuya's "device specifications", if DP-17 addele, says "scale 3" you might find it showing right with scaling-factor 1 (not 0.1) most( if not all) most devices that telling you "scale 1" try 0.1 ... figure it out don't ask my why ... so as another asked above " it would be nice with the correct scaling factor" ... there seems to be no such thing, it's a device/manufacture thing it seems ... |
My diagnostics (I removed some custom components):
@boheme61 I think it should be doable to have such possibility in the official integration, while this is a part of HA. I use localtuya but I don't find this is an issue. @purcell-lab what do you mean as escalating upstream? I was in contact with Tuya support, but contact with them didn't provide any senseful result: |
if you are referring to official Tuya-integration, you might want to configure(set scaling) for your devices in yaml(as the documentation says n shows), if you use local tuya, you are better of :) |
@boheme61 yes being able to set scaling would be a good workaround. I couldn't find the documentation to make this change in yaml. Can you provide a link? |
I think I get your point, but as it is not available on Tuya IoT platform, it probably should be part of HA configuration, instead of creating additional templates and as result more entities. Scaling through yaml (if template-based) will also disconnect entity from the device if I'm not wrong (additional minus of such method). Also I use localtuya, but as I mentioned - I don't think this is a resolution. Btw. I still don't get why the SmartLife app shows proper values and here it's different. Shouldn't it take same values? I'm not good with understanding it - more explanation may help me understand better ;) |
Thanks localtuya is certainly an option, but it is a workaround and the issue with the core-tuya integration still needs to be addressed. I have seen reference to being able to change scaling factor in yaml for the tuya-core integration, but am unable to find any details on configuration. |
I have same problem with Nedis WIFIPO120FWT. Shows correct values in tuya app but 10x in home assistant |
Use this ( custom:template-entity-row )(download from github, or hacs), maybe other cards support something similar as below
PS: Sorry i haven't seen all commends(feedback) on my post :) , before now And to those of you who still don't understand, 1 device, is different from another device, and other brands etc. etc. ... ex.My brand new ASUS Router's "Uptime_Sensor" reports uptime in seconds, 99DAYS, 23HOURS, 35MIN in seconds is =XXXMANY, so why has the developer of the integration not made sure that MY device, SHOWS what I WANT The Other Day someone complained i HA, that his "Current-Sensor" showed "Value" in "mA" , (WHY, he wanted A, period) ... So People sit on their free time and make an APP/ ADD-ON/Integration, maybe because he/she need it, or think it's fun, or both, they maybe develop it around their "specific" Devices( Why Not ?), ... and eventually follow up on(Adapt to) HA's requirements for Add-ons / integrations, ... to give other People, who use HA for Free, can have benefits for/use this particular "Integration" , for Free ... And your focus seems more related to complains, and your opinions whether it's a Bug/FR, or why it shows different on your phone-app/connected to your free cloud service ... short answer,... im pretty sure it's not a BUG, what your Device/Cloud service gives you, i don't know( i do know Toya, don't really support other brands correct(as mentioned above), and even their own, DON'T report what you "see"(whether it's your/my cloud-service, that recon-ice thedevice and "correct it, to local circumstances, or what( i don't care ) ... i do know a device is hardly ever capable of satisfies everyones need, support every possible measurement_unit( an enduser want), and in many case they have an "internal" process( as my Router above ) that requires other measurement specification,( and sensor therefore shows) that ANY enduser would want to see "Uptime in Seconds", Temperature-Sensors capable of 5-6 digit i.e 1.235644 C. who wants to see that ? ... sure they sell them as "Very Sensible/Correct" sensors ... Who Cares, i want only 2 digits.
And i think the commends here proves that it is actually "present" at Tuya.iot |
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. |
Issue still happens. |
A few things I noted when (redoing) setup of my iBBQ-4T which uses Tuya. The Probe temps defaulted to 100x the actual temp, so 84.40 was really 8440. So, I redid the integration and used ºF for the unit of measurement (only way I could enter the degree symbol was copy/paste), this resulted in 8440 ºF. Then I tried to enter 0.01 for a scaling factor and could not do it, the GUI would not take 0,01 as soon as you enter the second "0" it makes the whole thing zero. Cut/paste came to the rescue and I took a text editor and put in my "0.01" and pasted it into the scaling factor. Now my probes show this: |
I am having the same problem with a lot of gosund smart plugs. They all show a 10 times higher power consumption reading :( |
Here, have a workaround... I wouldn't expect changes on this issue soon. - platform: template
sensors:
# Copy this Block for every power sensor
plug_pc_power_real:
value_template: "{{ states('sensor.plug_pc_power') | float / 10 }}"
unit_of_measurement: "W"
friendly_name: "plug PC Power (Real)"
device_class: power
# Copy this Block for every voltage sensor
plug_pc_voltage_real:
value_template: "{{ states('sensor.plug_pc_voltage') | float / 10 }}"
unit_of_measurement: "V"
friendly_name: "plug PC Voltage (Real)"
device_class: voltage
# Copy this block for every metric
- platform: integration
source: sensor.plug_pc_power_real
name: plug PC Power spent
unit_prefix: k
round: 2
|
@max06 Thanks, I also thought of using templates to "fix" this issue, however it feels unsatifying since its just a workaround and does'nt fix the actual issue. |
It was easier than waiting for something... 😂 |
Hi, same issue here, for me only 1 of 7 have the scale issue in HA (no issue in smart-life app), Tuya app, says that fw are up-to-date, anyones knows how to update tuya fw ? |
tuya/tuya-home-assistant#938 - reported here as well. |
Hi, I had the same problem but I modified the tuya integration and imported it as a custom component in HACS. The mod just removes the scaling on the output. |
Thank you @Szaki-dev, I installed your fork and it works great! |
I have the same problem. Just starting with HA. This is the first device I added. |
Got the same problem. It could be solved by the maintainer of this integration by providing a scaling field on every sensor like the localtuya has... avoiding the ping-pong game between the manufacturer-Tuya-HA... |
I solved the problem (and several others) by simply switching to localtuya. |
Can I talk with You about this fix? |
Hi, Make sure you run the latest version of HA. Try removing then reinstalling the devices. If the error still persists DM me on discord (szakidev). |
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. |
Issue still persists for me. |
Same here. The problem persists with the latest version. |
@olekdata , problem is that it requires localtuya - HomeAssistant built-in integration has no option to do so. |
For me the problem is local guys. The normal integration has correct values |
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. |
Still valid. |
I've got the same issue on my Tekin Sockets .. shows power as 10x actually watts shown in SL app. |
Still a thing in 2025 ... |
Still have the issue on 2025.2 as of today. Tuya EP2-AR socket. Diagnostics attached. tuya-01JCH0BE7T147KYR4MXM7TVPST-EP2-AR-bbddcc5395729930c8a1964fbaf60dcf.json |
The problem
Hi!
![image](https://user-images.githubusercontent.com/92825738/149162782-56d36da5-767e-40be-8c62-71eb1caf6080.png)
I’m having a 10x multiplier error with my Tuya integrated smart plug. I noticed another issue about this #63949, but the differens is that for me the error is for the power sensor part not the voltage.
Instead of 117,0 W as shown in the Tuya app HA presents this as 1170,0W
This error also makes my function for calculating kWh useless. (Using Integration - Riemann sum integral) since kWh doesn’t seam to integrated from the Tuya app where its presented.
What version of Home Assistant Core has the issue?
Home Assistant 2021.12.9
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Supervised
Integration causing the issue
Tuya
Link to integration documentation on our website
https://www.home-assistant.io/integrations/tuya
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: