Re: Alternative Anbindung von Huawei WR
Verfasst: Sa Aug 05, 2023 1:20 pm
Danke, das erklärt mir einiges. Euch allen einen schönen Samstag
Hier könnte man noch eine Plausibilitätsprüfung einbauen, falls der Dongle Mist liefert oder eben gar keine Werte.jub hat geschrieben: ↑Sa Aug 05, 2023 2:20 pm Der flow von node-red ist ganz einfach - ich werd ihn hier später posten.
Per modbus-tcp werden 2 Registerbereiche vom Huawei Dongle (bzw WR) abgerufen, die landen in einem Buffer (weil modbus nur 16 bit pro Register speichert und die zu einem 32bit Wert kombiniert werden), hier passiert auch die Anpassung der Werte (also Gain, ob Wh oder kWh..). Dann die richtigen Vorzeichen setzen und per mqtt zur openWB (bei mir ein RevPi) schicken.
https://discourse.nodered.org/t/can-nod ... es/53356/5
gesehen?
Code: Alles auswählen
[{"id":"b6433abaf3452d51","type":"tab","label":"Flow 2","disabled":false,"info":"","env":[]},{"id":"7f8b26b894d97108","type":"inject","z":"b6433abaf3452d51","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"7","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":180,"wires":[["ff11a835ca1eb501","e4535fe748ac9bd5"]]},{"id":"ff11a835ca1eb501","type":"modbus-getter","z":"b6433abaf3452d51","name":"Register_37101__counter","showStatusActivities":false,"showErrors":false,"showWarnings":true,"logIOActivities":false,"unitid":"1","dataType":"HoldingRegister","adr":"37101","quantity":"64","server":"09c8a378fd3874d1","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":true,"delayOnStart":false,"startDelayTime":"","x":310,"y":120,"wires":[["af6e83944a61ed6e"],[]]},{"id":"af6e83944a61ed6e","type":"buffer-parser","z":"b6433abaf3452d51","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int32be","name":"openWB/set/counter/0/get/voltages","offset":0,"length":3,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32be","name":"openWB/set/counter/0/get/currents","offset":12,"length":3,"offsetbit":0,"scale":"/100","mask":""},{"type":"int32be","name":"openWB/set/counter/0/get/power","offset":24,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"openWB/set/counter/0/get/power_factors","offset":32,"length":1,"offsetbit":0,"scale":"/1000","mask":""},{"type":"int16be","name":"openWB/set/counter/0/get/frequency","offset":34,"length":1,"offsetbit":0,"scale":"/100","mask":""},{"type":"int32be","name":"openWB/set/counter/0/get/powers","offset":62,"length":3,"offsetbit":0,"scale":"1","mask":""},{"type":"int32be","name":"openWB/set/counter/0/get/exported","offset":36,"length":1,"offsetbit":0,"scale":"/100","mask":""},{"type":"int32be","name":"openWB/set/counter/0/get/imported","offset":40,"length":1,"offsetbit":0,"scale":"*10","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"value","resultTypeType":"return","multipleResult":true,"fanOutMultipleResult":true,"setTopic":true,"outputs":8,"x":610,"y":120,"wires":[["c73dc80384325c68"],["07c7a13aad3ce048"],["a4ba529e5e0ecae8"],["b5decb0388f34f12"],["c73dc80384325c68"],["d6b1fcfd7fdfab02"],["c73dc80384325c68"],["c73dc80384325c68"]]},{"id":"a4ba529e5e0ecae8","type":"function","z":"b6433abaf3452d51","name":"mal -1","func":"msg.payload = (msg.payload)*-1;\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":970,"y":60,"wires":[["c73dc80384325c68"]]},{"id":"07c7a13aad3ce048","type":"function","z":"b6433abaf3452d51","name":"drei mal -1","func":"msg.payload[0] = (msg.payload[0]) * -1;\nmsg.payload[1] = (msg.payload[1]) * -1;\nmsg.payload[2] = (msg.payload[2]) * -1;\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":990,"y":20,"wires":[["c73dc80384325c68"]]},{"id":"c73dc80384325c68","type":"mqtt out","z":"b6433abaf3452d51","name":"","topic":"","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"1e239b880d809812","x":1250,"y":300,"wires":[]},{"id":"b5decb0388f34f12","type":"function","z":"b6433abaf3452d51","name":"array","func":"msg.payload0 = (msg.payload);\nmsg.payload1 = (msg.payload);\nmsg.payload2 = (msg.payload);\nmsg.payload = [msg.payload0, msg.payload1, msg.payload2];\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":970,"y":100,"wires":[["c73dc80384325c68"]]},{"id":"e4535fe748ac9bd5","type":"modbus-getter","z":"b6433abaf3452d51","name":"Register_32064__inverter","showStatusActivities":false,"showErrors":false,"showWarnings":true,"logIOActivities":false,"unitid":"1","dataType":"HoldingRegister","adr":"32064","quantity":"86","server":"09c8a378fd3874d1","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":true,"delayOnStart":false,"startDelayTime":"","x":330,"y":240,"wires":[["081fb832f71c338b"],[]]},{"id":"081fb832f71c338b","type":"buffer-parser","z":"b6433abaf3452d51","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int32be","name":"total input","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int32be","name":"openWB/set/pv/1/get/exported","offset":84,"length":1,"offsetbit":0,"scale":"*10","mask":""},{"type":"int32be","name":"openWB/set/pv/1/get/power","offset":32,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"value","resultTypeType":"return","multipleResult":true,"fanOutMultipleResult":true,"setTopic":true,"outputs":3,"x":630,"y":360,"wires":[[],["c73dc80384325c68"],["fcf2a0becc5d88ac"]]},{"id":"d6b1fcfd7fdfab02","type":"function","z":"b6433abaf3452d51","name":"drei mal -1","func":"msg.payload[0] = (msg.payload[0]) * -1;\nmsg.payload[1] = (msg.payload[1]) * -1;\nmsg.payload[2] = (msg.payload[2]) * -1;\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":990,"y":160,"wires":[["c73dc80384325c68"]]},{"id":"fcf2a0becc5d88ac","type":"function","z":"b6433abaf3452d51","name":"mal -1","func":"msg.payload = (msg.payload)*-1;\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":970,"y":400,"wires":[["c73dc80384325c68"]]},{"id":"09c8a378fd3874d1","type":"modbus-client","name":"Dongle","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"failureLogEnabled":true,"tcpHost":"192.168.88.27","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"0x3A","unit_id":"1","commandDelay":"10","clientTimeout":"","reconnectOnTimeout":false,"reconnectTimeout":"","parallelUnitIdsAllowed":true,"showWarnings":true,"showLogs":true},{"id":"1e239b880d809812","type":"mqtt-broker","name":"","broker":"192.168.88.22","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]
Schon mal hier geschaut?ArminElectric hat geschrieben: ↑Di Aug 15, 2023 3:11 pm außerdem möchte ich meine Verbrauchshistorie nicht verlieren beim Wechsel auf 2.0 - ich meine dort startet man bei 0 ?!