SMA Energy Meter in Home Assistant

to decode the voltage from Phase1 (Parameter 32.4.0) you can do it similar to the actual grid consumption 1.4.0 the offset is then 0.32.4.0 (in hex 00200400).

So add a 5. output and the code below

/* to get the actual Voltage of Phase1 we need the offset 0.32.4.0 note 32 = 0x20 in hex*/
offset = msg.payload.indexOf("00200400", 0, "hex")+ 4;
var voltage_p1 = parseInt((msg.payload[offset+0]*0x1000000 + 
                           msg.payload[offset+1]*0x10000 + 
                           msg.payload[offset+2]*0x100  +
                           msg.payload[offset+3]) / 1000);
msg5.payload = voltage_p1.toString();

and of course add msg5 to the return statement at the end

return [msg1, msg2, msg3, msg4, msg5 ];
1 Like