Sunny Home Manager Flow

Hi,
it is possible to get more data from the home manager.
I still need the following data:

  • Current active power in W
  • battery charge level in%
  • Battery charging power in W
  • Battery discharge power in W
    I read out the data beforehand via Modbus. However, these are not permanently available.
    Thanks in advance.
[{"id":"4726af68.c62a98","type":"tab","label":"SMA Energy Meter","disabled":false,"info":""},{"id":"8b085afa.639c98","type":"udp in","z":"4726af68.c62a98","name":"Home Manager","iface":"","port":"9522","ipv":"udp4","multicast":"true","group":"239.12.255.254","datatype":"buffer","x":200,"y":40,"wires":[["59d4009d.51d848"]]},{"id":"59d4009d.51d848","type":"buffer-parser","z":"4726af68.c62a98","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"string","name":"sma","offset":0,"length":3,"offsetbit":0,"scale":"1","mask":""},{"type":"uint32be","name":"Tag=>Tag0","offset":4,"length":1,"offsetbit":0,"scale":">> 4","mask":"0xff0"},{"type":"uint32be","name":"Tag=>Version","offset":4,"length":1,"offsetbit":0,"scale":"0","mask":"0xf"},{"type":"uint32be","name":"Group","offset":8,"length":1,"offsetbit":0,"scale":"0","mask":""},{"type":"uint32be","name":"item10","offset":25,"length":1,"offsetbit":0,"scale":">> 4","mask":"0xFFF0"},{"type":"uint16be","name":"ProtocolID","offset":16,"length":1,"offsetbit":0,"scale":"0","mask":""},{"type":"uint32be","name":"meter_identifier=>SusyID","offset":18,"length":1,"offsetbit":0,"scale":">> 4","mask":"0xFFF0"},{"type":"uint32be","name":"meter_identifier=>SerNo","offset":21,"length":1,"offsetbit":0,"scale":">> 4","mask":"0xFFF0"},{"type":"buffer","name":"data","offset":28,"length":-1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":210,"y":120,"wires":[["1a874f5b.7bace9"]]},{"id":"1a874f5b.7bace9","type":"buffer-parser","z":"4726af68.c62a98","name":"","data":"payload.data","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int16be","name":"measurement","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint8","name":"datatype","offset":2,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"buffer","name":"data","offset":0,"length":-1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":210,"y":200,"wires":[["7a1f91a6.30fe3"]]},{"id":"457c119d.7b5e1","type":"buffer-parser","z":"4726af68.c62a98","name":"","data":"payload.data","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"uint32be","name":"value","offset":4,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"buffer","name":"data","offset":8,"length":-1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload2","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":730,"y":220,"wires":[["49a55b26.ca7154"]]},{"id":"5e4bb7ec.91d56","type":"buffer-parser","z":"4726af68.c62a98","name":"","data":"payload.data","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"biguint64be","name":"value","offset":4,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"buffer","name":"data","offset":12,"length":-1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload2","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":730,"y":180,"wires":[["49a55b26.ca7154"]]},{"id":"49a55b26.ca7154","type":"function","z":"4726af68.c62a98","name":"Daten","func":"var sma_units = {\n    \"W\": 10,\n    \"VA\": 10,\n    \"var\": 10,\n    \"kWh\": 3600000,\n    \"kVAh\": 3600000,\n    \"kvarh\": 3600000,\n    \"A\": 1000,\n    \"V\": 1000,\n    \"-\": 1000,\n    \"Hz\": 1000,\n};\nvar sma_channels = {\n    //# gesamt\n    1: ['P Bezug', 'W', 'kWh'],\n    2: ['P Einspeisung', 'W', 'kWh'],\n    3: ['Q induktiv', 'var', 'kvarh'],\n    4: ['Q kapazitiv', 'var', 'kvarh'],\n    9: ['S Bezug', 'VA', 'kVAh'],\n    10: ['S Einspeisung', 'VA', 'kVAh'],\n    13: ['cosphi', '-'],\n    14: ['Frequenz', 'Hz'],\n    //# L1\n    21: ['P1 Bezug', 'W', 'kWh'],\n    22: ['P1 Einspeisung', 'W', 'kWh'],\n    23: ['Q1 ind.', 'var', 'kvarh'],\n    24: ['Q1 kap.', 'var', 'kvarh'],\n    29: ['S1 Bezug', 'VA', 'kVAh'],\n    30: ['S1 Einspeisung', 'VA', 'kVAh'],\n    31: ['I L1', 'A'],\n    32: ['U L1', 'V'],\n    33: ['cosphi L1', '-'],\n    //# L2\n    41: ['P2 Bezug', 'W', 'kWh'],\n    42: ['P2 Einspeisung', 'W', 'kWh'],\n    43: ['Q2 ind.', 'var', 'kvarh'],\n    44: ['Q2 kap.', 'var', 'kvarh'],\n    49: ['S2 Bezug', 'VA', 'kVAh'],\n    50: ['S2 Einspeisung', 'VA', 'kVAh'],\n    51: ['I L2', 'A'],\n    52: ['U L2', 'V'],\n    53: ['cosphi L2', '-'],\n    //# L3\n    61: ['P3 Bezug', 'W', 'kWh'],\n    62: ['P3 Einspeisung', 'W', 'kWh'],\n    63: ['Q3 ind.', 'var', 'kvarh'],\n    64: ['Q3 kap.', 'var', 'kvarh'],\n    69: ['S3 Bezug', 'VA', 'kVAh'],\n    70: ['S3 Einspeisung', 'VA', 'kVAh'],\n    71: ['I L3', 'A'],\n    72: ['U L3', 'V'],\n    73: ['cosphi L3', '-'],\n};\n\nmsg.result = msg.result || {};\n\nfunction decode_item_header(datatype, measurement) {\n    if (datatype == 4)\n        return 'momentan'\n    else if (datatype == 8)\n        return 'Zähler';\n}\n\n\nvar pl2 = msg.payload2;\nvar pl = msg.payload;\n\nvar measurement = pl.measurement;\nvar datatype = pl.datatype;\nvar ch = sma_channels[measurement] || [];\nvar valuename = ch[0], unit = ch[1]; unitForCounter = ch[2];\n\nvar hasValue = pl2.hasOwnProperty('value');\nif (valuename && hasValue) {\n    var value = pl2.value;\n    var typeName = decode_item_header(datatype, measurement);\n    var t = typeof value;\n    var divisor = 1;\n    if (typeName == \"Zähler\" && unitForCounter ) {\n        divisor = sma_units[unitForCounter] || 1;\n        msg.result[valuename + \" \" + typeName + \" Einheit\"] = unitForCounter;\n    } else {\n        divisor = sma_units[unit] || 1;\n        msg.result[valuename + \" \" + typeName + \" Einheit\"] = unit;\n    }\n    \n    if (t === \"number\") {\n        msg.result[valuename + \" \" + typeName] = value / divisor;\n    } else if (t === \"bigint\") {\n        msg.result[valuename + \" \" + typeName] = Number(value / BigInt(divisor));\n    } else {\n        msg.result[valuename + \" \" + typeName] = value;\n    }\n}\n\n\n/** @type {Buffer} */ var buf = pl2.data;\nif (buf && buf.length >= 8) {\n    msg.payload = {\n        data: pl2.data\n    };\n    return [msg,null];\n}\nmsg.payload = msg.result;\nreturn [null, msg];","outputs":2,"noerr":0,"initialize":"","finalize":"","x":910,"y":220,"wires":[["7a9f5d09.5e9f6c"],["64165746.d2915","8dccb4401b3cd18c","c6156b1fd8c1deeb","2e6e0406f7802183","3c5fb680a06b8025"]]},{"id":"dd2add4e.38aa08","type":"buffer-parser","z":"4726af68.c62a98","name":"","data":"payload.data","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"buffer","name":"data","offset":8,"length":-1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload2","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":730,"y":260,"wires":[["49a55b26.ca7154"]]},{"id":"31eee24.1fa321e","type":"link in","z":"4726af68.c62a98","name":"","links":["7a9f5d09.5e9f6c"],"x":75,"y":200,"wires":[["1a874f5b.7bace9"]]},{"id":"7a9f5d09.5e9f6c","type":"link out","z":"4726af68.c62a98","name":"","links":["31eee24.1fa321e"],"x":915,"y":180,"wires":[]},{"id":"64165746.d2915","type":"debug","z":"4726af68.c62a98","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1130,"y":120,"wires":[]},{"id":"7a1f91a6.30fe3","type":"switch","z":"4726af68.c62a98","name":"8-counter, 4-actual, 0-version, other","property":"payload.datatype","propertyType":"msg","rules":[{"t":"eq","v":"8","vt":"num"},{"t":"eq","v":"4","vt":"num"},{"t":"eq","v":"0","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":4,"x":450,"y":200,"wires":[["5e4bb7ec.91d56"],["457c119d.7b5e1"],["dd2add4e.38aa08"],["dd2add4e.38aa08"]]},{"id":"0445991291fb5adf","type":"loxone-control-out","z":"4726af68.c62a98","name":"Bezug Gesamt","miniserver":"cc4d6d68.c76de","control":"17ba5083-013f-49cd-ffff4328c8ef95c0","x":1640,"y":180,"wires":[],"info":"{\r\n   \"payload\":\"566\",\r\n  \r\n}"},{"id":"8dccb4401b3cd18c","type":"function","z":"4726af68.c62a98","name":"Bezug Zähler","func":"return {payload: msg.payload[\"P Bezug Zähler\"]};\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1400,"y":180,"wires":[["0445991291fb5adf"]]},{"id":"0983644a0a85f576","type":"loxone-control-out","z":"4726af68.c62a98","name":"Einspeisung Gesamt","miniserver":"cc4d6d68.c76de","control":"17c54820-0348-c2c8-ffff4328c8ef95c0","x":1660,"y":240,"wires":[],"info":"{\r\n   \"payload\":\"566\",\r\n  \r\n}"},{"id":"c6156b1fd8c1deeb","type":"function","z":"4726af68.c62a98","name":"Einspeisung Zähler","func":"return {payload: msg.payload[\"P Einspeisung Zähler\"]};\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1410,"y":240,"wires":[["0983644a0a85f576"]]},{"id":"b36010494dcb5357","type":"loxone-control-out","z":"4726af68.c62a98","name":"Bezug","miniserver":"cc4d6d68.c76de","control":"17e09a28-003a-1202-ffff4328c8ef95c0","x":1610,"y":300,"wires":[],"info":"{\r\n   \"payload\":\"566\",\r\n  \r\n}"},{"id":"2e6e0406f7802183","type":"function","z":"4726af68.c62a98","name":"Bezug Momentan","func":"return {payload: msg.payload[\"P Bezug momentan\"]};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1410,"y":300,"wires":[["b36010494dcb5357"]]},{"id":"3c5fb680a06b8025","type":"function","z":"4726af68.c62a98","name":"Einspeisung Momentan","func":"return {payload: msg.payload[\"P Einspeisung momentan\"]};\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1430,"y":360,"wires":[["d6f46a8a0f0ba8e7"]]},{"id":"d6f46a8a0f0ba8e7","type":"loxone-control-out","z":"4726af68.c62a98","name":"Einspeisung","miniserver":"cc4d6d68.c76de","control":"17e09b6c-028d-536f-ffff4328c8ef95c0","x":1650,"y":360,"wires":[]},{"id":"cc4d6d68.c76de","type":"loxone-miniserver","host":"192.168.178.10","port":"80","enctype":"0","active":true}]

As we don't have your house ((un)fortunately?) we cannot emulate your flow.

Could you produce example input messages and expected output payloads ?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.