Open RetoWettstein opened 11 months ago
In fact the value is base64 encoded binary data ... because of the fact that it is not documents that well the adapter can only decode what he knows.
So you could use a JavaScript script totake the value, base64 decode it into a Buffer and then read and interpret the data
In fact the value is base64 encoded binary data ... because of the fact that it is not documents that well the adapter can only decode what he knows.
So you could use a JavaScript script totake the value, base64 decode it into a Buffer and then read and interpret the data
Thank you so much for this quick answer. Top
If you know whats in and how to parse add details here and I might be abel to add it to the adapter
Ok will do it. I am on a good way to parse it. Found out: AWsAFQAH encoded in binary is: 000000010110101100000000000101010000000000000111 0000000101101011 = 336 = 33.6 Volt = Panel 1 Voltage 0000000000010101 = 21 = 2.1 A = Panel 1 Current 0000000000000111 = 7 = 0.07kW oder 70 W = Panel 1 Power The Binary includes 3 Block with 16 characters. Each Block is a Value. But i am struggling to convert the Base64 string into a binary string in Java. I am just a beginner ;)
java? You mean JavaScript? But in fact it should be something like
const buf = Buffer.from(data, "'base64");
const voltage = buf.readUInt16LE(0) / 10; // or BE?
const current = buf.readUInt16LE(2) / 10; // or BE?
...
Something like this? Check https://nodejs.org/api/buffer.html
Hi Apollon77
First of all, thank you so much for your help. And of course i mean JavaScript! Actually i decoded it and interpreted the data. Here the results:
pv1_dc_data -> Base64 example string: "ATsAEgAF" = pv1
const buf = Buffer.from(pv1,'base64'); const pv1voltage = (buf.readUint16BE(0)/10); // unit Volt const pv1current = (buf.readUint16BE(2)/10); // unit Ampere const pv1power = (buf.readUint16BE(4)*10); // unit Watt
pv2_dc_data -> Base64 example string: "AWsAFQAH" = pv2
const buf = Buffer.from(pv2,'base64'); const pv2voltage = (buf.readUint16BE(0)/10); // unit Volt const pv2current = (buf.readUint16BE(2)/10); // unit Ampere const pv2power = (buf.readUint16BE(4)*10);; // unit Watt
phase_a -> Base64 example string: "CXQAASwAAF4B9A==" = phase_a
const buf = Buffer.from(phase_a,'base64'); const voltage = (buf.readUint16BE(0)/10); // unit Volt const current = (buf.readUint16BE(3)/1000); // unit Ampere const power = buf.readUint16BE(6);; // unit Watt const frequency = (buf.readUint16BE(8)/10); // unit Hertz
Hi Folk
I am running IoBroker with the Tuya adapter for my Photovoltaic power converter from Tuya. It works quite finde. But some values are encrypted. See picture. The Value: AVcAFwAH should show the Pv1 DC data like: 33.4 Volt, 2.3 Amps, 0.07 kW. How can i convert this alphanumeric value in decimal values?
Hope someone could help me. Thank in advance