Closed FabianNiesen closed 4 months ago
I can't check that device as I don't own one, but regarding other Tuya energy meters, generally the daily/weekly/monthly data are available only in the Smartlife app, as they are calculated in the Tuya cloud. With a local connection these data are not available.
You could verify if using the HA internal Tuya integration these data are shown. If possible, check also the data coming from your device directly in the Tuya IoT Developer Platform.
Calculating the daily energy usage is possible only in the HA itself, for example you could use the Statistics integration: https://www.home-assistant.io/integrations/statistics/
I have deleted my previous post, because I wrote it without paying much attention to the original issue.
I have smart plugs, and I confirm that the energy values in LocalTuya and in the Tuya IoT Developer Platform are exactly the same. I just set up the Energy dashboard to check its statistics against SmartLife myself.
Hey, hope you're doing well, I have the same bug with 2 of my three smart plugs. For 2 of them (they are Wifi) the consumption in HA is not accurate. For yesterday I have 4.35Kw/h and 1.51Kw/h but the consumption showed in HA is 0.39Kw/h and 0,27Kw/h The only accurate is using zigbee. Can it have something to do with the situation?
For me, I am not interested in sensors for the statics for daily, weekly and monthly consumption. My issue is that the values for the energy dashboard are not correct as it seems. There I have the daily consumption I need. Edit: Sorry for the delayed answer, I was on vacation.
Sorry, @FabianNiesen I didn't really understand your message because I am talking about the same thing (the values displayed on the energy dashboard). As I was saying, on my side, they are displayed correctly but the values are not accurate. Or maybe I misunderstood your message. P.S.: Sorry, English is not my native language. I use Google Translate
sorry @ddcorazon I was referring to @andrus2049 post. Sorry for the confusion.
@andrus2049 for some more information's, the values from today (All devices are unused for over 30 mins to avoid sync delays): the daily consumption in HA Energy Dashboard shows 0,84m kWh, but the Smart Life App (Android) shows 1,333 kWh for today. Other Values from today are HA: 0,03 App: 0,047 / HA 0,09 kWh App 0,194 kWh
The electricity DP is marked as "cloud pull" which means in normally it shouldn't been pulled without the "cloud API help", there are many DPs that aren't very useful for local usage however I let it up to the user whether it wants the entity or delete it.
As andrus said the calculation happen in cloud so usually on locally you won't have the same value however.
Here is my guess, I'm not sure of this but I think maybe the device it self keeps updating the Electricity DP value but the difference here in smart life it's sum the values that the device reporting , mean while localtuya only reports the last value.
I am having issues with zigbee smart plugs not being updated if I don't open the smart life app.
I tried setting the polling interval to 20 seconds but still not being updated. Any help?
@xZetsubou FYI, possibly related:
2024-06-14 18:40:10.400 WARNING (Recorder) [homeassistant.components.sensor.recorder] Entity sensor.k_smart_plug_1g_electricity from integration localtuya has state class total_increasing, but its state is not strictly increasing. Triggered by state 0.22 (0.23) with last_updated set to 2024-06-14T15:36:52.477245+00:00. Please create a bug report at https://github.com/xZetsubou/hass-localtuya/issues
I see such messages time to time. No, I don't expect any fix, because I don't care 😃
I wonder if changing the state class "measurement" instead of total increasing, may fix this. I did make auto configure "configure as total increasing" because I thought it will reports the same cloud values. 👀
The electricity DP is marked as "cloud pull" which means in normally it shouldn't been pulled without the "cloud API help", there are many DPs that aren't very useful for local usage however I let it up to the user whether it wants the entity or delete it.
As andrus said the calculation happen in cloud so usually on locally you won't have the same value however.
Here is my guess, I'm not sure of this but I think maybe the device it self keeps updating the Electricity DP value but the difference here in smart life it's sum the values that the device reporting , mean while localtuya only reports the last value.
So if I want to have SmartPlugs with Tuya, I need to use the cloud integration? Since I want to have a local solution, I need to switch to Tasmotta devices, correct?
I just made a guess if it's correct we can sum the values however can you ensure the at the end of the day if we sum the values it will be the same as Smart Life? you can check the history state of the entity and add them.
Tuya devices exist that provide cumulative energy supplied. I have one but it's a DIN rail device for installation in a box:
This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.
LocalTuya Version
3.2.5
Home Assistant Version
2024.5.4
Environment
What happened?
When I check the daily consumption in HA it showed 0.78 kWh for my washing machine. The Smart Things app reports 1.211kWh for the same day. All sensors are auto discovered, no manual changes. The Eightree smart plugs are detected as "RW 新UI欧规EU02A(ET21) 16A高级计量" with Tuya 3.4 Firmware in Local Tuya. I ordered the devices at Amazon.
Steps to reproduce.
Relevant log output
Diagnostics information.
{ "home_assistant": { "installation_type": "Home Assistant Supervised", "version": "2024.5.4", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.12.2", "docker": true, "arch": "x86_64", "timezone": "Europe/Berlin", "os_name": "Linux", "os_version": "6.1.0-21-amd64", "supervisor": "2024.05.1", "host_os": "Debian GNU/Linux 12 (bookworm)", "docker_version": "26.1.3", "chassis": "vm", "run_as_root": true }, "custom_components": { "vimar": { "documentation": "https://github.com/h4de5/home-assistant-vimar", "version": "2023.8.0", "requirements": [] }, "pysmaplus": { "documentation": "https://github.com/littleyoda/pysma/tree/tripowerX", "version": "0.2.7", "requirements": [ "pysma-plus>=0.2.7" ] }, "localtuya": { "documentation": "https://github.com/xZetsubou/hass-localtuya/", "version": "3.2.5", "requirements": [] }, "hacs": { "documentation": "https://hacs.xyz/docs/configuration/start", "version": "1.34.0", "requirements": [ "aiogithubapi>=22.10.1" ] }, "dwains_dashboard": { "documentation": "https://dwainscheeren.github.io/dwains-lovelace-dashboard/", "version": "3.7.0", "requirements": [] } }, "integration_manifest": { "domain": "localtuya", "name": "Local Tuya", "codeowners": [], "config_flow": true, "dependencies": [], "documentation": "https://github.com/xZetsubou/hass-localtuya/", "integration_type": "hub", "iot_class": "local_push", "issue_tracker": "https://github.com/xZetsubou/hass-localtuya/issues", "requirements": [], "version": "3.2.5", "is_built_in": false }, "data": { "device_config": { "friendly_name": "WLAN Steckdose 2", "device_id": "bfe85c8d3dda26fXXXXXXX", "host": "192.168.177.109", "local_key": "sanitised", "protocol_version": "3.4", "enable_debug": false, "node_id": null, "model": "RW \u65b0UI\u6b27\u89c4EU02A(ET21) 16A\u9ad8\u7ea7\u8ba1\u91cf", "product_key": "keyjup78v54myhan", "dps_strings": [ "1 ( code: switch_1 , value: True )", "9 ( code: countdown_1 , value: 0 )", "17 ( code: add_ele , value: 0, cloud pull )", "18 ( code: cur_current , value: 0 )", "19 ( code: cur_power , value: 0 )", "20 ( code: cur_voltage , value: 2333 )", "21 ( code: test_bit , value: 1 )", "22 ( code: voltage_coe , value: 558 )", "23 ( code: electric_coe , value: 27805 )", "24 ( code: power_coe , value: 15105 )", "25 ( code: electricity_coe , value: 2770 )", "26 ( code: fault , value: 0 )", "38 ( code: relay_status , value: memory )", "39 ( code: overcharge_switch , value: False )", "40 ( code: light_mode , value: relay )", "41 ( code: child_lock , value: False )", "42 ( code: cycle_time , value: )", "43 ( code: random_time , value: )", "44 ( code: switch_inching , value: )" ], "entities": [ { "id": "1", "friendly_name": "Switch 1", "icon": "", "entity_category": "None", "device_class": "outlet", "platform": "switch" }, { "id": "9", "min_value": 0, "max_value": 86400, "step_size": 1, "scaling": 1.0, "unit_of_measurement": "s", "friendly_name": "Switch 1 Timer", "icon": "mdi:timer", "entity_category": "config", "platform": "number" }, { "id": "17", "unit_of_measurement": "kWh", "scaling": 0.001, "friendly_name": "Electricity", "icon": "", "entity_category": "None", "device_class": "energy", "state_class": "total_increasing", "platform": "sensor" }, { "id": "18", "unit_of_measurement": "A", "scaling": 1, "friendly_name": "Current", "icon": "", "entity_category": "None", "device_class": "current", "state_class": "measurement", "platform": "sensor" }, { "id": "19", "unit_of_measurement": "W", "scaling": 0.1, "friendly_name": "Power", "icon": "", "entity_category": "None", "device_class": "power", "state_class": "measurement", "platform": "sensor" }, { "id": "20", "unit_of_measurement": "V", "scaling": 0.1, "friendly_name": "Voltage", "icon": "", "entity_category": "None", "device_class": "voltage", "state_class": "measurement", "platform": "sensor" }, { "id": "26", "state_on": "1", "friendly_name": "Fault", "icon": "", "entity_category": "diagnostic", "device_class": "problem", "platform": "binary_sensor" }, { "id": "38", "select_options": { "off": "OFF", "on": "ON", "memory": "Last State" }, "friendly_name": "Power-on behavior", "icon": "mdi:circle-double", "entity_category": "config", "platform": "select" }, { "id": "39", "friendly_name": "Overcharge", "icon": "mdi:flash-alert", "entity_category": "config", "platform": "switch" }, { "id": "40", "select_options": { "relay": "State", "pos": "Position", "none": "OFF", "on": "on" }, "friendly_name": "Light Mode", "icon": "", "entity_category": "config", "platform": "select" }, { "id": "41", "friendly_name": "Child Lock", "icon": "mdi:account-lock", "entity_category": "config", "platform": "switch" } ] }, "device_cloud_info": { "active_time": 1715017218, "biz_type": 18, "category": "cz", "create_time": 1715017218, "icon": "smart/icon/ay1531122507771gALCb/f16b5ca1980eaaeaf1f876c70478ef2a.jpg", "id": "bfe85c8d3dda26f1XXXXX", "ip": "7...5", "lat": "50.5600", "local_key": "sanitised", "lon": "7.2600", "model": "RW \u65b0UI\u6b27\u89c4EU02A(ET21) 16A\u9ad8\u7ea7\u8ba1\u91cf", "name": "Waschmaschine ", "online": true, "owner_id": "191437229", "product_id": "zfncpzxtmlsyeizo", "product_name": "Smart plug", "status": [ { "code": "switch_1", "value": true }, { "code": "countdown_1", "value": 0 }, { "code": "add_ele", "value": 16 }, { "code": "cur_current", "value": 0 }, { "code": "cur_power", "value": 0 }, { "code": "cur_voltage", "value": 2325 }, { "code": "relay_status", "value": "last" }, { "code": "overcharge_switch", "value": false }, { "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": "eu1715016986843snq6V", "update_time": 1716104110, "uuid": "01d710bca59dcbc4", "dps_data": { "1": { "code": "switch_1", "custom_name": "", "dp_id": 1, "time": 1715076569359, "value": true, "type": "Boolean", "values": "{\"type\": \"bool\"}", "id": 1, "accessMode": "rw" }, "9": { "code": "countdown_1", "custom_name": "", "dp_id": 9, "time": 1715076569359, "value": 0, "type": "Integer", "values": "{\"type\": \"value\", \"max\": 86400, \"min\": 0, \"scale\": 0, \"step\": 1, \"unit\": \"s\"}", "id": 9, "accessMode": "rw" }, "17": { "code": "add_ele", "custom_name": "", "dp_id": 17, "time": 1716048049000, "value": 16, "id": 17, "accessMode": "ro", "values": "{\"type\": \"value\", \"max\": 50000, \"min\": 0, \"scale\": 3, \"step\": 100}" }, "18": { "code": "cur_current", "custom_name": "", "dp_id": 18, "time": 1716047062830, "value": 0, "id": 18, "accessMode": "ro", "values": "{\"type\": \"value\", \"max\": 30000, \"min\": 0, \"scale\": 0, \"step\": 1, \"unit\": \"mA\"}" }, "19": { "code": "cur_power", "custom_name": "", "dp_id": 19, "time": 1716047062830, "value": 0, "id": 19, "accessMode": "ro", "values": "{\"type\": \"value\", \"max\": 80000, \"min\": 0, \"scale\": 1, \"step\": 1, \"unit\": \"W\"}" }, "20": { "code": "cur_voltage", "custom_name": "", "dp_id": 20, "time": 1716061376487, "value": 2303, "id": 20, "accessMode": "ro", "values": "{\"type\": \"value\", \"max\": 5000, \"min\": 0, \"scale\": 1, \"step\": 1, \"unit\": \"V\"}" }, "21": { "code": "test_bit", "custom_name": "", "dp_id": 21, "time": 1715076569603, "value": 1, "id": 21, "accessMode": "ro", "values": "{\"type\": \"value\", \"max\": 5, \"min\": 0, \"scale\": 0, \"step\": 1}" }, "22": { "code": "voltage_coe", "custom_name": "", "dp_id": 22, "time": 1715076569603, "value": 558, "id": 22, "accessMode": "ro", "values": "{\"type\": \"value\", \"max\": 1000000, \"min\": 0, \"scale\": 0, \"step\": 1}" }, "23": { "code": "electric_coe", "custom_name": "", "dp_id": 23, "time": 1715076569603, "value": 27805, "id": 23, "accessMode": "ro", "values": "{\"type\": \"value\", \"max\": 1000000, \"min\": 0, \"scale\": 0, \"step\": 1}" }, "24": { "code": "power_coe", "custom_name": "", "dp_id": 24, "time": 1715076569603, "value": 15105, "id": 24, "accessMode": "ro", "values": "{\"type\": \"value\", \"max\": 1000000, \"min\": 0, \"scale\": 0, \"step\": 1}" }, "25": { "code": "electricity_coe", "custom_name": "", "dp_id": 25, "time": 1715076569603, "value": 2770, "id": 25, "accessMode": "ro", "values": "{\"type\": \"value\", \"max\": 1000000, \"min\": 0, \"scale\": 0, \"step\": 1}" }, "26": { "code": "fault", "custom_name": "", "dp_id": 26, "time": 1715076569400, "value": 0, "id": 26, "accessMode": "ro", "values": "{\"type\": \"bitmap\", \"label\": [\"ov_cr\", \"ov_vol\", \"ov_pwr\", \"ls_cr\", \"ls_vol\", \"ls_pow\"], \"maxlen\": 6}" }, "38": { "code": "relay_status", "custom_name": "", "dp_id": 38, "time": 1715076569428, "value": "memory", "type": "Enum", "values": "{\"type\": \"enum\", \"range\": [\"off\", \"on\", \"memory\"]}", "id": 38, "accessMode": "rw" }, "39": { "code": "overcharge_switch", "custom_name": "", "dp_id": 39, "time": 1715076569382, "value": false, "type": "Boolean", "values": "{\"type\": \"bool\"}", "id": 39, "accessMode": "rw" }, "40": { "code": "light_mode", "custom_name": "", "dp_id": 40, "time": 1715076569487, "value": "relay", "type": "Enum", "values": "{\"type\": \"enum\", \"range\": [\"relay\", \"pos\", \"none\", \"on\"]}", "id": 40, "accessMode": "rw" }, "41": { "code": "child_lock", "custom_name": "", "dp_id": 41, "time": 1715076569479, "value": false, "type": "Boolean", "values": "{\"type\": \"bool\"}", "id": 41, "accessMode": "rw" }, "42": { "code": "cycle_time", "custom_name": "", "dp_id": 42, "time": 1715076569467, "value": "", "type": "String", "values": "{\"type\": \"string\", \"maxlen\": 255}", "id": 42, "accessMode": "rw" }, "43": { "code": "random_time", "custom_name": "", "dp_id": 43, "time": 1715076569448, "value": "", "type": "String", "values": "{\"type\": \"string\", \"maxlen\": 255}", "id": 43, "accessMode": "rw" }, "44": { "code": "switch_inching", "custom_name": "", "dp_id": 44, "time": 1715076569502, "value": "", "type": "String", "values": "{\"type\": \"string\", \"maxlen\": 255}", "id": 44, "accessMode": "rw" } } } } }