I am now out of my depth, and I am callng on the geniuses that hang out around this forum
I have installed a breaker, with power & energy metering. The breaker seem to lose connection to Wifi every now and again, and even though according to my network, it is still active, there is no comms from this device, and even the Smartlife app says it is offline.
Strangely, though, I have been able to add parts of it to Local Tuya, allowing me to switch the device off and on, even though everything else says it is offline.
To get back to point, the breaker is a three phase breaker, with the phases being called phase a, phase b and phase c.
I am OK in keeping this device local, but have run into a problem I just cannot solve, not for lack of trying, I think my brain is just too small…
Typically on these devices, you have DP_IDs for
- Power
- Current
- Voltage
They might require a multiplier to make sense of the value. For instance, the power might read 205, which need to be multiplied by 0.1 to get the accurate reading of 20.5W. This is undertandable, and I am manging just fine setting it up.
However, this breaker have a very stange method that it employs related to the data. So, Phase A has a single DPID, containing a text string. Apparently doing some Endian Big End (or something) magic, this text string contains the power, current and voltage.
Herewith an extract from Tuya IOT Data model for this device (Translated - as it is mostly Chinese). Relevant section underlined.
I am also posting a value here that I can see on Tuya IOT, and the readings I get from Smartlife.
Tuya IOT - Phase A:
{
“code”: “phase_a”,
“custom_name”: “”,
“dp_id”: 6,
“time”: 1716297638366,
“value”: “CWgABtwAABE=”
},
Smartlife - that is about 1.7A, 18W and 240.8V. It changes quickly, so that is why I am calling it “about”.
“model”: “{"modelId":"dzx2ek","services":[{"actions":,"code":"","description":"","events":,"name":"默认服务", "properties":[{"abilityId”:1,"accessMode":"ro","code":"total_forward_energy","description":"","extensions":{" iconName":"icon-dp_lightning","attribute":"1152"},"name":"Positive Total Active Power","typeSpec":{"type":"value","max":999999999," min":0,"scale":2,"step":1,"unit":"kW-h"}}},{"abilityId":6,"accessMode":"ro","code":"phase_a","description":"1 Phase A voltage, current and power\\n2, big-end mode, HEX format, 8 bytes in total\n3, unit accuracy: voltage, 2 bytes, unit 0.1V. current, 3 bytes, unit 0.001A. phase A active power, 3 bytes, unit 0.0001kW\n4, message format\n4, example: 08 80 00 03 E8 00 27 10 means phase A 217.6V, A-phase current 1.000A, A-phase power 10.000KW\n5, communication logic: \\n1) user into the panel, active query. The user enters the panel, the panel immediately sends down 0x08 to the meter, the meter reports the data to the cloud platform, the panel gets the data and then displays it. Note: Latest WIFI support. \\n2) The meter reports data based on a certain period. Suggestion: In WIFI mode, report once every 15 seconds. in NB mode, report once every 1 hour.
As such, how do I convert the Phase A: CWgABtwAABE= value to understandable power, current and voltage?
Like I said, I just cannot make progress here, not for lack of trying.