tuya-local
tuya-local copied to clipboard
smartplugv2_energy do not update correctly
Hi, first of all thanks. Your solution was the first that triggered the measuring on the tuya-plug at all. Even the direct call via Tinytuya did only send 0 for the Voltage, Power and Current JSON Values. Even on heavy load
It looks like that the Tuya-Plug could send every 5 minutes an update. But not always. Sometimes the update waits for 10 or 15 minutes. I turned the device off and it stays for over 40 minutes at the same power-level
Do you have an idea how to trigger to receive an update for the current , Power and Voltage Value ?

Edit:
2022-01-12 21:41:56 DEBUG (SyncWorker_0) [custom_components.tuya_local.device] Refreshing device state for Hombli Energy Monitoring Smart Plug. 2022-01-12 21:41:56 DEBUG (SyncWorker_0) [custom_components.tuya_local.device] Hombli Energy Monitoring Smart Plug refreshed device state: {"dps": {"1": true, "9": 0, "18": 7626, "19": 16701, "20": 2176, "26": 0, "updated_at": 1642020116.8599658}} 2022-01-12 21:41:56 DEBUG (SyncWorker_0) [custom_components.tuya_local.device] new cache state (including pending properties): {"1": true, "9": 0, "18": 7626, "19": 16701, "20": 2176, "26": 0, "updated_at": 1642020116.8599658} 2022-01-12 21:41:56 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Energy Monitoring Smart Plug: Mapped dps 19 value from 16701 to 1670.1 2022-01-12 21:41:56 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Energy Monitoring Smart Plug: Mapped dps 18 value from 7626 to 7.626 2022-01-12 21:41:56 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Energy Monitoring Smart Plug: Mapped dps 19 value from 16701 to 1670.1 2022-01-12 21:41:56 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Energy Monitoring Smart Plug: Mapped dps 20 value from 2176 to 217.6 2022-01-12 21:41:56 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Energy Monitoring Smart Plug: Mapped dps 20 value from 2176 to 217.6 2022-01-12 21:41:56 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Energy Monitoring Smart Plug: Mapped dps 19 value from 16701 to 1670.1 2022-01-12 21:41:57 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Considering mapping for range of value 2022-01-12 21:41:57 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Considering mapping for range of value 2022-01-12 21:41:57 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Considering mapping for step of value 2022-01-12 21:41:57 INFO (MainThread) [custom_components.tuya_local.helpers.device_config] Step for value is 60 with scale 60 2022-01-12 21:41:57 DEBUG (MainThread) [custom_components.tuya_local.helpers.device_config] Energy Monitoring Smart Plug: Mapped dps 9 value from 0 to 0.0
I think this is a known issue with some smartplugs, where the statistical data is not automatically returned with every poll, and needs to be explicitly requested. Some new mechanism to make that explicit request needs to be added.
Hi,
If I block tuya from accessing the internet current/power/voltage no longer refresh: Current load is 1200W. This happens on all smartplugs v2 with no internet.
2022-11-10 16:14:44.826 DEBUG (SyncWorker_33) [custom_components.tuya_local.device] PrizaBuc refreshed device state: {"devId": "180405233c61058f7e1c", "dps": {"1": true, "9": 0, "18": 0, "19": 0, "20": 2327, "21": 1, "22": 639, "23": 30848, "24": 17400, "25": 1196, "updated_at": 1668089684.8259835}} 2022-11-10 16:15:14.772 DEBUG (SyncWorker_27) [custom_components.tuya_local.device] Refreshing device state for PrizaBuc. 2022-11-10 16:15:26.372 DEBUG (SyncWorker_27) [custom_components.tuya_local.device] PrizaBuc refreshed device state: {"devId": "180405233c61058f7e1c", "dps": {"1": true, "9": 0, "18": 0, "19": 0, "20": 2327, "21": 1, "22": 639, "23": 30848, "24": 17400, "25": 1196, "updated_at": 1668089726.3725836}} 2022-11-10 16:16:14.777 DEBUG (SyncWorker_15) [custom_components.tuya_local.device] Refreshing device state for PrizaBuc. 2022-11-10 16:16:14.824 DEBUG (SyncWorker_15) [custom_components.tuya_local.device] PrizaBuc refreshed device state: {"devId": "180405233c61058f7e1c", "dps": {"1": true, "9": 0, "18": 0, "19": 0, "20": 2327, "21": 1, "22": 639, "23": 30848, "24": 17400, "25": 1196, "updated_at": 1668089774.824153}} 2022-11-10 16:16:44.779 DEBUG (SyncWorker_38) [custom_components.tuya_local.device] Refreshing device state for PrizaBuc. 2022-11-10 16:16:44.943 DEBUG (SyncWorker_38) [custom_components.tuya_local.device] PrizaBuc refreshed device state: {"devId": "180405233c61058f7e1c", "dps": {"1": true, "9": 0, "18": 0, "19": 0, "20": 2327, "21": 1, "22": 639, "23": 30848, "24": 17400, "25": 1196, "updated_at": 1668089804.9435012}}
I'm not certain, but protocol version 3.2 may help with this. 2022.12.1 allows you to change the protocol version manually to help with misdetection issues.