-
Notifications
You must be signed in to change notification settings - Fork 8
/
ingeteam_flow.json
1 lines (1 loc) · 39.1 KB
/
ingeteam_flow.json
1
[{"id":"4aa3e13d.f801b","type":"tab","label":"Solar","disabled":false,"info":""},{"id":"5298883b.63d67","type":"modbus-read","z":"4aa3e13d.f801b","name":"Ingeteam IRs","topic":"","showStatusActivities":true,"logIOActivities":false,"showErrors":true,"unitid":"1","dataType":"InputRegister","adr":"6","quantity":"63","rate":"2","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"7c9e7be9.c6b294","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":true,"x":170,"y":160,"wires":[["4e8faafc.742a84"],[]]},{"id":"f8b8031b.ad32a","type":"inject","z":"4aa3e13d.f801b","name":"Get...","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":150,"y":660,"wires":[["10fadcf5.b235ab"]]},{"id":"10fadcf5.b235ab","type":"http request","z":"4aa3e13d.f801b","name":"inverter map","method":"GET","ret":"obj","paytoqs":"ignore","url":"http://ingeteam.casa/inverter/map/1","tls":"","persist":false,"proxy":"","authType":"basic","x":330,"y":660,"wires":[["4fe27c30.272404"]]},{"id":"74cee61b.a09b9","type":"debug","z":"4aa3e13d.f801b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":770,"y":660,"wires":[]},{"id":"dcc296d3.836a08","type":"inject","z":"4aa3e13d.f801b","name":"Get...","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":150,"y":720,"wires":[["c300bc5c.551258"]]},{"id":"c300bc5c.551258","type":"http request","z":"4aa3e13d.f801b","name":"inverter devices","method":"GET","ret":"obj","paytoqs":"ignore","url":"http://ingeteam.casa/plant/devices","tls":"","persist":false,"proxy":"","authType":"basic","x":340,"y":720,"wires":[["4e105c4f.6157b4"]]},{"id":"4e105c4f.6157b4","type":"debug","z":"4aa3e13d.f801b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":550,"y":720,"wires":[]},{"id":"76b1ded7.ae15b","type":"inject","z":"4aa3e13d.f801b","name":"Get...","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":150,"y":780,"wires":[["a2a5e90a.1db0a"]]},{"id":"a2a5e90a.1db0a","type":"http request","z":"4aa3e13d.f801b","name":"plants","method":"GET","ret":"obj","paytoqs":"ignore","url":"http://ingeteam.casa/ingecloud/monitorv2/devices/myself/plants","tls":"","persist":false,"proxy":"","authType":"basic","x":310,"y":780,"wires":[["9dec26c9.2719f"]]},{"id":"9dec26c9.2719f","type":"debug","z":"4aa3e13d.f801b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":550,"y":780,"wires":[]},{"id":"2b45d243.09400e","type":"comment","z":"4aa3e13d.f801b","name":"REST API inverter","info":"","x":170,"y":580,"wires":[]},{"id":"b980633f.6e13c","type":"inject","z":"4aa3e13d.f801b","name":"Get...","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":150,"y":840,"wires":[["22c2340d.0ba29c"]]},{"id":"b6cba319.11da18","type":"http request","z":"4aa3e13d.f801b","name":"historic samples","method":"GET","ret":"obj","paytoqs":"ignore","url":"http://ingeteam.casa/ems/datalogger/samples/{{{date}}}/3","tls":"","persist":false,"proxy":"","authType":"basic","x":460,"y":840,"wires":[["6cc87d64.4faf0c"]]},{"id":"5fbeda25.db0a34","type":"debug","z":"4aa3e13d.f801b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":850,"y":840,"wires":[]},{"id":"22c2340d.0ba29c","type":"moment","z":"4aa3e13d.f801b","name":"Date","topic":"","input":"payload","inputType":"msg","inTz":"Europe/Madrid","adjAmount":0,"adjType":"days","adjDir":"add","format":"YYYYMMDD","locale":"ES","output":"date","outputType":"msg","outTz":"Europe/Madrid","x":290,"y":840,"wires":[["b6cba319.11da18"]]},{"id":"6cc87d64.4faf0c","type":"change","z":"4aa3e13d.f801b","name":"extract phase 1","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.resend[Phase = 1]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":840,"wires":[["5fbeda25.db0a34"]]},{"id":"4fe27c30.272404","type":"change","z":"4aa3e13d.f801b","name":"massage messages","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.(\t $texts := langs.ENGLISH;\t $types := customtypes;\t{\t \"online\": online.{\t \"dir\": add,\t \"tid\": tid,\t \"name\": $lookup($texts, tid),\t \"convert\": of,\t \"unit\": $lookup($texts, m),\t \"btype\": ty,\t \"tdesc\": $lookup($types, ty)\t }^(dir),\t \"holding\": holding.{\t \"dir\": add,\t \"tid\": tid,\t \"name\": $lookup($texts, tid),\t \"cat\": cat,\t \"max\": max,\t \"min\": min,\t \"start\": start,\t \"len\": len,\t \"btype\": ty,\t \"tdesc\": $lookup($types, ty)\t }^(dir,start),\t \"commands\": commands,\t \"data\": data.{\t \"dir\": add,\t \"tid\": tid,\t \"name\": $lookup($texts, tid),\t \"convert\": of,\t \"cat\": cat,\t \"type\": ty,\t \"tdesc\": $lookup($types, ty)\t }^(dir),\t \"properties\": properties\t}) ~> | *.tdesc.values | $merge($each($, function($v, $k) {{$k: $lookup($$.payload.langs.ENGLISH, $v)}})) |\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":660,"wires":[["74cee61b.a09b9"]]},{"id":"c5e867c2.87e408","type":"comment","z":"4aa3e13d.f801b","name":"Error handling","info":"","x":170,"y":980,"wires":[]},{"id":"4f6d2ffd.2b9cc8","type":"catch","z":"4aa3e13d.f801b","name":"","scope":null,"uncaught":false,"x":160,"y":1060,"wires":[["e6adcec5.8498f8"]]},{"id":"e6adcec5.8498f8","type":"debug","z":"4aa3e13d.f801b","name":"Errors","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":390,"y":1060,"wires":[]},{"id":"4e8faafc.742a84","type":"buffer-parser","z":"4aa3e13d.f801b","name":"parse Ingeteam","data":"responseBuffer.buffer","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"uint32be","name":"total_operation","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"web_interface_bits","offset":4,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"stop_event","offset":6,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint32be","name":"alarms","offset":8,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"code1","offset":12,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"code2","offset":14,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"code3","offset":16,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"inverter_status","offset":18,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"grid_conn_wait","offset":20,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"battery_voltage","offset":22,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int16be","name":"battery_current","offset":24,"length":1,"offsetbit":0,"scale":"/100","mask":""},{"type":"int16be","name":"battery_power","offset":26,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"battery_soc","offset":28,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"battery_soh","offset":30,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"battery_chg_voltage","offset":32,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int16be","name":"battery_dchg_voltage","offset":34,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int16be","name":"battery_max_chg_current","offset":36,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"battery_max_dchg_current","offset":38,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"battery_status","offset":40,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"battery_temp","offset":42,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"battery_bms_alarms","offset":44,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"battery_power_reduction_reason","offset":46,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"battery_voltage_inverter_sensor","offset":48,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"uint16be","name":"pv1_voltage","offset":50,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"pv1_current","offset":52,"length":1,"offsetbit":0,"scale":"/100","mask":""},{"type":"uint16be","name":"pv1_power","offset":54,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"pv2_voltage","offset":56,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"pv2_current","offset":58,"length":1,"offsetbit":0,"scale":"/100","mask":""},{"type":"uint16be","name":"pv2_power","offset":60,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"inverter_active_power","offset":62,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"inverter_reactive_power","offset":64,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"inverter_cosphi","offset":66,"length":1,"offsetbit":0,"scale":"/1000","mask":""},{"type":"int16be","name":"active_power_reduction_ratio","offset":68,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"uint16be","name":"active_power_reduction_reason","offset":70,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"reactive_power_setpoint_type","offset":72,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"critical_loads_voltage","offset":74,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"critical_loads_current","offset":76,"length":1,"offsetbit":0,"scale":"/100","mask":""},{"type":"int16be","name":"critical_loads_frequency","offset":78,"length":1,"offsetbit":0,"scale":"/100","mask":""},{"type":"int16be","name":"critical_loads_active_power","offset":80,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"critical_loads_reactive_power","offset":82,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"internal_wattmeter_grid_voltage","offset":84,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"internal_wattmeter_grid_current","offset":86,"length":1,"offsetbit":0,"scale":"/100","mask":""},{"type":"int16be","name":"internal_wattmeter_grid_frequency","offset":88,"length":1,"offsetbit":0,"scale":"/100","mask":""},{"type":"int16be","name":"internal_wattmeter_grid_active_power","offset":90,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"internal_wattmeter_grid_gap","offset":92,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"internal_wattmeter_grid_cosphi","offset":94,"length":1,"offsetbit":0,"scale":"/1000","mask":""},{"type":"uint16be","name":"dc_bus_voltage","offset":96,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"temperature_module_battery","offset":98,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int16be","name":"temperature_module_phpv","offset":100,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int16be","name":"temperature_pcb","offset":102,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"uint16be","name":"temperature_pt100","offset":104,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"positive_isolation_resistance","offset":106,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"negative_isolation_resistance","offset":108,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"rms_differential_current","offset":110,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"digital_output1_status","offset":112,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"digital_output2_status","offset":114,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"digital_input_drm0_status","offset":116,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"digital_input2_status","offset":118,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"digital_input3_status","offset":120,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"hardware_version","offset":122,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"battery_bms_flags","offset":124,"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":380,"y":160,"wires":[["307db9a5.2db70e"]]},{"id":"4c53df23.db3fb","type":"debug","z":"4aa3e13d.f801b","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":830,"y":160,"wires":[]},{"id":"307db9a5.2db70e","type":"function","z":"4aa3e13d.f801b","name":"scale and interpret","func":"let payload=msg.payload;\n\nlet if_bits = [];\n\nif(1<<0 & payload.web_interface_bits) if_bits.push(\"Green Led Blinking\");\nif(1<<1 & payload.web_interface_bits) if_bits.push(\"Green Led On\");\nif(1<<10 & payload.web_interface_bits) if_bits.push(\"Grid/Genset Icon Active\");\nif(1<<11 & payload.web_interface_bits) if_bits.push(\"Battery Icon Active\");\nif(1<<12 & payload.web_interface_bits) if_bits.push(\"Inverter Icon Active\");\nif(1<<13 & payload.web_interface_bits) if_bits.push(\"Autotest menu Enabled\");\nif(1<<14 & payload.web_interface_bits) if_bits.push(\"Critical Loads configured\");\nif(1<<5 & payload.web_interface_bits) if_bits.push(\"Red Led On\");\nif(1<<8 & payload.web_interface_bits) if_bits.push(\"Fan Test Running\");\nif(1<<9 & payload.web_interface_bits) if_bits.push(\"Fan Test Ended\");\nmsg.payload.web_intetface_bits_str = if_bits.join(', ');\n\nlet stop_evt;\nswitch(payload.stop_event){\n case 0:\n stop_evt = \"0\";\n break;\n case 1:\n stop_evt = \"1 - Low Battery SOC or Voltage\";\n break;\n case 10:\n stop_evt = \"10 - Inverter stopped manually\";\n break;\n case 11:\n stop_evt = \"11 - Overdischarge in Battery\";\n break;\n case 12:\n stop_evt = \"12 - Overload in Critical Loads\";\n break;\n case 13:\n stop_evt = \"13 - Short circuit in Critical Loads\";\n break;\n case 14:\n stop_evt = \"14 - Low PV Power\";\n break;\n case 15:\n stop_evt = \"15 - AC Relays Test\";\n break;\n case 16:\n stop_evt = \"16 - Low Inverter Temperature\";\n break;\n case 17:\n stop_evt = \"17 - High Inverter Temperature\";\n break;\n case 18:\n stop_evt = \"18 - Incremental differential current\";\n break;\n case 19:\n stop_evt = \"19 - RMS Differential current\";\n break;\n case 2:\n stop_evt = \"2 - High Battery Voltage\";\n break;\n case 20:\n stop_evt = \"20 - Instantaneous differential current\";\n break;\n case 21:\n stop_evt = \"21 - Insulation Failure\";\n break;\n case 22:\n stop_evt = \"22 - High PV current\";\n break;\n case 23:\n stop_evt = \"23 - DC/DC or AC/DC Error\";\n break;\n case 24:\n stop_evt = \"24 - ADC Error\";\n break;\n case 25:\n stop_evt = \"25 - Configuration change\";\n break;\n case 26:\n stop_evt = \"26 - Reserved\";\n break;\n case 27:\n stop_evt = \"27 - Wrong type of battery\";\n break;\n case 28:\n stop_evt = \"28 - ADC Error\";\n break;\n case 29:\n stop_evt = \"29 - Reset Watchdog\";\n break;\n case 3:\n stop_evt = \"3 - Communication Error with BMS\";\n break;\n case 30:\n stop_evt = \"30 - Alarm in BMS\";\n break;\n case 4:\n stop_evt = \"4 - Inverter stopped from Digital Input\";\n break;\n case 5:\n stop_evt = \"5 - Grid Voltage or Frequency out of range\";\n break;\n case 6:\n stop_evt = \"6 - DC Bus or PV input Overvoltage\";\n break;\n case 7:\n stop_evt = \"7 - DC/AC Fault\";\n break;\n case 8:\n stop_evt = \"8 - DC/DC Fault\";\n break;\n case 9:\n stop_evt = \"9 - HW Battery Overcurrent\";\n break;\n default:\n stop_evt = \"Unknown event\";\n}\nmsg.payload.stop_event_str = stop_evt;\n\n\nlet alarms = [];\nif(1<<0 & payload.alarms) alarms.push(\"Battery voltage out of range\");\nif(1<<1 & payload.alarms) alarms.push(\"Grid frequency out of range\");\nif(1<<10 & payload.alarms) alarms.push(\"Inverter stopped\");\nif(1<<11 & payload.alarms) alarms.push(\"Hardware failure\");\nif(1<<12 & payload.alarms) alarms.push(\"DC/DC or AC/DC Converter Error\");\nif(1<<14 & payload.alarms) alarms.push(\"Battery Temperature out of range\");\nif(1<<15 & payload.alarms) alarms.push(\"Overload capacity exceeded in Battery\");\nif(1<<16 & payload.alarms) alarms.push(\"Overload capacity exceeded in Critical Loads\");\nif(1<<17 & payload.alarms) alarms.push(\"Short circuit in Critical Loads\");\nif(1<<18 & payload.alarms) alarms.push(\"PT100 sensor failure\");\nif(1<<19 & payload.alarms) alarms.push(\"Communication Error with BMS\");\nif(1<<2 & payload.alarms) alarms.push(\"Grid voltage out of range\");\nif(1<<20 & payload.alarms) alarms.push(\"Wrong inverter serial number\");\nif(1<<21 & payload.alarms) alarms.push(\"High grid voltage\");\nif(1<<22 & payload.alarms) alarms.push(\"Wrong type of battery configuration\");\nif(1<<23 & payload.alarms) alarms.push(\"Alarm in the BMS\");\nif(1<<24 & payload.alarms) alarms.push(\"Overcurrent in PV 1 array input\");\nif(1<<25 & payload.alarms) alarms.push(\"Overcurrent in PV 2 array input\");\nif(1<<26 & payload.alarms) alarms.push(\"Full Battery Discharge\");\nif(1<<3 & payload.alarms) alarms.push(\"DC/AC Inverter overcurrent or fault\");\nif(1<<4 & payload.alarms) alarms.push(\"DC/DC Battery overcurrent or fault\");\nif(1<<5 & payload.alarms) alarms.push(\"Insulation failure\");\nif(1<<6 & payload.alarms) alarms.push(\"Wrong wired in the installation\");\nif(1<<7 & payload.alarms) alarms.push(\"Inverter temperature out of range\");\nif(1<<8 & payload.alarms) alarms.push(\"DC Bus overvoltage\");\nif(1<<9 & payload.alarms) alarms.push(\"Configuration change\");\nmsg.payload.alarms_str = alarms.join(', ');\n\nlet code1 = [];\nif(1<<1 & payload.code1) code1.push(\"Grid Current Sensor out of full scale range\");\nif(1<<10 & payload.code1) code1.push(\"RMS Differential Current failure\");\nif(1<<11 & payload.code1) code1.push(\"Incremental differential current failure\");\nif(1<<12 & payload.code1) code1.push(\"Instantaneous differential current failure\");\nif(1<<13 & payload.code1) code1.push(\"Inverter stopped manually\");\nif(1<<2 & payload.code1) code1.push(\"Insulation Failure in PV or Battery terminals\");\nif(1<<3 & payload.code1) code1.push(\"Warning: Internal fan blocked\");\nif(1<<4 & payload.code1) code1.push(\"Warning: External fan blocked\");\nif(1<<5 & payload.code1) code1.push(\"Battery Current Sensor out of full scale range\");\nif(1<<6 & payload.code1) code1.push(\"Compensation of DC offset failed\");\nif(1<<7 & payload.code1) code1.push(\"Grid Voltage Sensor out of full scale range\");\nif(1<<8 & payload.code1) code1.push(\"Avg. Differential Current out of full scale range\");\nif(1<<9 & payload.code1) code1.push(\"Inst. Differential Current out of full scale range\");\nmsg.payload.code1_str = code1.join(', ');\n\nlet code2 = [];\nif(1<<0 & payload.code2) code2.push(\"Warning: High Temperature\");\nif(1<<1 & payload.code2) code2.push(\"AC Voltage in Critical Loads Output\");\nif(1<<10 & payload.code2) code2.push(\"Maximum Critical Loads Power in Off-Grid\");\nif(1<<11 & payload.code2) code2.push(\"Low Critical Loads Voltage in Off-Grid\");\nif(1<<12 & payload.code2) code2.push(\"Maximum Critical Loads Power in On-Grid\");\nif(1<<13 & payload.code2) code2.push(\"Alarm in the BMS\");\nif(1<<14 & payload.code2) code2.push(\"Internal Differential Current test failed\");\nif(1<<15 & payload.code2) code2.push(\"Inverter stopped by the Digital Input\");\nif(1<<2 & payload.code2) code2.push(\"Low PV power to start up the inverter\");\nif(1<<3 & payload.code2) code2.push(\"Grid Frequency out of the configured limits\");\nif(1<<4 & payload.code2) code2.push(\"Warning: Compensation of DC offset\");\nif(1<<5 & payload.code2) code2.push(\"Internal AC relay test failed\");\nif(1<<6 & payload.code2) code2.push(\"Grid Voltage out of the configured limits\");\nif(1<<7 & payload.code2) code2.push(\"Low Battery Voltage\");\nif(1<<8 & payload.code2) code2.push(\"High Battery Voltage\");\nif(1<<9 & payload.code2) code2.push(\"Communication Error with BMS\");\nmsg.payload.code2_str = code2.join(', ');\n\n\nlet code3 = [];\nif(1<<0 & payload.code3) code3.push(\"PT100 disconnected or shortcircuited\");\nif(1<<1 & payload.code3) code3.push(\"High Battery Temperature\");\nif(1<<2 & payload.code3) code3.push(\"Warning: DC/DC Battery cannot operate\");\nif(1<<3 & payload.code3) code3.push(\"Warning: Synchronization with the grid not successful\");\nif(1<<4 & payload.code3) code3.push(\"Warning: Transient failure detection in the Grid\");\nif(1<<5 & payload.code3) code3.push(\"Warning: DC/DC PV input 1 cannot operate\");\nif(1<<6 & payload.code3) code3.push(\"Battery SOC lower than configured SOC Descx\");\nif(1<<7 & payload.code3) code3.push(\"Warning: DC/DC PV input 2 cannot operate\");\nif(1<<8 & payload.code3) code3.push(\"Warning: Date not synchronized\");\nif(1<<9 & payload.code3) code3.push(\"Warning: RTC CR2032 battery exhausted\");\nmsg.payload.code3_str = code3.join(', ');\n\n\nlet status;\nswitch(payload.inverter_status){\n case 0:\n status = \"Stopped\";\n break;\n case 1:\n status = \"Starting\";\n break;\n case 2:\n status = \"Off-Grid\";\n break;\n case 3:\n status = \"On-Grid\";\n break;\n case 4:\n status = \"On-Grid\";\n break;\n case 5:\n status = \"Waiting to connect to Grid\";\n break;\n case 6:\n status = \"Bypass AC activated\";\n break;\n case 7:\n status = \"Emergency Charge from PV\";\n break;\n case 8:\n status = \"Emergency Charge from Grid\";\n break;\n case 9:\n status = \"Locked waiting for Reset\";\n break;\n case 10:\n status = \"Error\";\n break;\n case 11:\n status = \"Off-Grid in AC Grid\";\n break;\n default:\n status = \"Unknown status\";\n}\nmsg.payload.inverter_status_str = status;\n\nlet bat_status;\nswitch(payload.battery_status){\n \n case 00:\n bat_status = \"Standby\";\n break;\n case 01:\n bat_status = \"Discharging\";\n break;\n case 02:\n bat_status = \"Charging\";\n break;\n case 03:\n bat_status = \"Constant Voltage\";\n break;\n case 04:\n bat_status = \"Flotation\";\n break;\n case 05:\n bat_status = \"Equalization\";\n break;\n case 06:\n bat_status = \"Error with BMS\";\n break;\n case 07:\n bat_status = \"No Configured\";\n break;\n case 08:\n bat_status = \"Calibration - Charging\";\n break;\n case 09:\n bat_status = \"Calibration - Discharging\";\n break;\n default:\n bat_status = \"Unknown status\";\n}\nmsg.payload.battery_status_str = bat_status;\n\nlet bat_bms_alarms = [];\n\nif(1<<0 & payload.battery_bms_alarms) bat_bms_alarms.push(\"High Current during Charge\");\nif(1<<1 & payload.battery_bms_alarms) bat_bms_alarms.push(\"High Voltage\");\nif(1<<2 & payload.battery_bms_alarms) bat_bms_alarms.push(\"Low Voltage\");\nif(1<<3 & payload.battery_bms_alarms) bat_bms_alarms.push(\"High Temperature\");\nif(1<<4 & payload.battery_bms_alarms) bat_bms_alarms.push(\"Low Temperature\");\nif(1<<5 & payload.battery_bms_alarms) bat_bms_alarms.push(\"Internal BMS Alarm\");\nif(1<<6 & payload.battery_bms_alarms) bat_bms_alarms.push(\"Cell Imbalance\");\nif(1<<7 & payload.battery_bms_alarms) bat_bms_alarms.push(\"High Current during discharge\");\nif(1<<8 & payload.battery_bms_alarms) bat_bms_alarms.push(\"System Error\");\nmsg.payload.battery_bms_alarms_str = bat_bms_alarms.join(', ');\n\nlet bat_pwr_red_reason;\nswitch(payload.battery_power_reduction_reason){\n\n case 00:\n bat_pwr_red_reason = \"No Limitation\";\n break;\n case 01:\n bat_pwr_red_reason = \"Heat Sink Temperature\";\n break;\n case 02:\n bat_pwr_red_reason = \"PT100 Temperature\";\n break;\n case 03:\n bat_pwr_red_reason = \"Low Bus Voltage Protection\";\n break;\n case 04:\n bat_pwr_red_reason = \"Lead-acid Settings\";\n break;\n case 05:\n bat_pwr_red_reason = \"BMS Communication\";\n break;\n case 06:\n bat_pwr_red_reason = \"SOC Max Configured\";\n break;\n case 07:\n bat_pwr_red_reason = \"SOC Min Configured\";\n break;\n case 08:\n bat_pwr_red_reason = \"Maximum Battery Power\";\n break;\n case 09:\n bat_pwr_red_reason = \"High Battery Voltage Protection\";\n break;\n default:\n bat_pwr_red_reason = \"Unknown reason\";\n}\nmsg.payload.battery_power_reduction_reason_str = bat_pwr_red_reason;\n\nlet ac_pow_red_reason;\nswitch(payload.active_power_reduction_reason){\n\n case 00:\n ac_pow_red_reason = \"No Limitation\";\n break;\n case 01:\n ac_pow_red_reason = \"Communication\";\n break;\n case 010:\n ac_pow_red_reason = \"AC Grid Power Limited\";\n break;\n case 011:\n ac_pow_red_reason = \"Self Consumption Mode\";\n break;\n case 012:\n ac_pow_red_reason = \"High Bus Voltage Protection\";\n break;\n case 013:\n ac_pow_red_reason = \"LVRT or HVRT Process\";\n break;\n case 014:\n ac_pow_red_reason = \"Nominal AC Current\";\n break;\n case 015:\n ac_pow_red_reason = \"Grid Consumption Protection\";\n break;\n case 016:\n ac_pow_red_reason = \"PV Surplus Injected to the Grid\";\n break;\n case 02:\n ac_pow_red_reason = \"PCB Temperature\";\n break;\n case 03:\n ac_pow_red_reason = \"Heat Sink Temperature\";\n break;\n case 04:\n ac_pow_red_reason = \"Pac vs Fac Algorithm\";\n break;\n case 05:\n ac_pow_red_reason = \"Soft Start\";\n break;\n case 06:\n ac_pow_red_reason = \"Charge Power Configured\";\n break;\n case 07:\n ac_pow_red_reason = \"PV Surplus injected to the Loads\";\n break;\n case 08:\n ac_pow_red_reason = \"Pac vs Vac Algorithm\";\n break;\n case 09:\n ac_pow_red_reason = \"Battery Power Limited\";\n break;\n default:\n ac_pow_red_reason = \"Unknown reason\";\n}\nmsg.payload.active_power_reduction_reason_str = ac_pow_red_reason;\n\nlet reac_pow_setpoint_type;\nswitch(payload.reactive_power_setpoint_type){\n\n case 00:\n reac_pow_setpoint_type = \"Cosφ Configuration\";\n break;\n case 01:\n reac_pow_setpoint_type = \"Qac Communication\";\n break;\n case 02:\n reac_pow_setpoint_type = \"Cosφ Communication\";\n break;\n case 03:\n reac_pow_setpoint_type = \"Qac vs Vac Algorithm\";\n break;\n case 04:\n reac_pow_setpoint_type = \"Cosφ vs Pac Algorithm\";\n break;\n default:\n reac_pow_setpoint_type = \"Unknown\";\n}\nmsg.payload.reactive_power_setpoint_type_str = reac_pow_setpoint_type;\n\nlet digi_output1;\nswitch(payload.digital_output1_status){\n case 0:\n digi_output1 = \"OFF\";\n break;\n case 1:\n digi_output1 = \"ON\";\n break;\n default:\n digi_output1 = \"Unknown\";\n}\nmsg.payload.digital_output1_status_str = digi_output1;\n\nlet digi_output2;\nswitch(payload.digital_output2_status){\n case 0:\n digi_output2 = \"OFF\";\n break;\n case 1:\n digi_output2 = \"ON\";\n break;\n default:\n digi_output2 = \"Unknown\";\n}\nmsg.payload.digital_output2_status_str = digi_output2;\n\nlet digi_inputdrm;\nswitch(payload.digital_input_drm0_status){\n case 0:\n digi_inputdrm = \"OFF\";\n break;\n case 1:\n digi_inputdrm = \"ON\";\n break;\n default:\n digi_inputdrm = \"Unknown\";\n}\nmsg.payload.digital_input_drm0_status_str = digi_inputdrm;\n\nlet digi_input2;\nswitch(payload.digital_input2_status){\n case 0:\n digi_input2 = \"OFF\";\n break;\n case 1:\n digi_input2 = \"ON\";\n break;\n default:\n digi_input2 = \"Unknown\";\n}\nmsg.payload.digital_input2_status_str = digi_input2;\n\nlet digi_input3;\nswitch(payload.digital_input3_status){\n case 0:\n digi_input3 = \"OFF\";\n break;\n case 1:\n digi_input3 = \"ON\";\n break;\n default:\n digi_input3 = \"Unknown\";\n}\nmsg.payload.digital_input3_status_str = digi_input3;\n\nlet bat_bms_flags = [];\nif(1<<0 & payload.battery_bms_flags) bat_bms_flags.push(\"Stop Charge\");\nif(1<<1 & payload.battery_bms_flags) bat_bms_flags.push(\"Stop Discharge\");\nif(1<<2 & payload.battery_bms_flags) bat_bms_flags.push(\"Forced Charge\");\nif(1<<3 & payload.battery_bms_flags) bat_bms_flags.push(\"Calibration\");\nmsg.payload.battery_bms_flags_str = bat_bms_flags.join(', ');\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":610,"y":160,"wires":[["4c53df23.db3fb","26c1d00b.3d487","13280e60.4d1b12"]]},{"id":"26c1d00b.3d487","type":"influxdb out","z":"4aa3e13d.f801b","influxdb":"636cb567.cfe544","name":"Ingeteam in tests","measurement":"ingeteam","precision":"","retentionPolicy":"","database":"database","precisionV18FluxV20":"ms","retentionPolicyV18Flux":"","org":"organisation","bucket":"bucket","x":850,"y":80,"wires":[]},{"id":"e72cfd29.488d","type":"modbus-read","z":"4aa3e13d.f801b","d":true,"name":"Gavazzi IRs 1","topic":"","showStatusActivities":true,"logIOActivities":false,"showErrors":true,"unitid":"1","dataType":"InputRegister","adr":"0","quantity":"37","rate":"15","rateUnit":"s","delayOnStart":false,"startDelayTime":"1","server":"d8043f74.21d91","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":true,"x":170,"y":440,"wires":[["672b25db.857cfc"],[]]},{"id":"41310749.6b8068","type":"debug","z":"4aa3e13d.f801b","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":590,"y":440,"wires":[]},{"id":"672b25db.857cfc","type":"buffer-parser","z":"4aa3e13d.f801b","name":"parse gavazzi set 1","data":"responseBuffer.buffer","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int32le","name":"volts","offset":0,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"amps","offset":4,"length":1,"offsetbit":0,"scale":"/1000","mask":""},{"type":"int32le","name":"watts","offset":8,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"volt_ampers","offset":12,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"volt_ampers_reactive","offset":16,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"wdmd","offset":20,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"wdmd_peak","offset":24,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int16le","name":"power_factor","offset":28,"length":1,"offsetbit":0,"scale":"/1000","mask":""},{"type":"int16le","name":"hz","offset":30,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"kwh_tot_in","offset":32,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"kvar_tot_in","offset":36,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"kwh_part_in","offset":40,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"kvar_part_in","offset":44,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"kwh_tariff1","offset":48,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"kwh_tariff2","offset":52,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"kwh_tariff3","offset":56,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"kwh_tariff4","offset":60,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"kwh_tot_out","offset":64,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"kvar_tot_out","offset":68,"length":1,"offsetbit":0,"scale":"/10","mask":""}],"swap1":"swap16","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":390,"y":440,"wires":[["41310749.6b8068"]]},{"id":"8653bf39.2d6f1","type":"influxdb out","z":"4aa3e13d.f801b","influxdb":"636cb567.cfe544","name":"Power metter in tests","measurement":"power_metter","precision":"","retentionPolicy":"","database":"database","precisionV18FluxV20":"ms","retentionPolicyV18Flux":"","org":"organisation","bucket":"bucket","x":620,"y":220,"wires":[]},{"id":"630ab3b6.6939d4","type":"modbus-read","z":"4aa3e13d.f801b","name":"Gavazzi IRs 2","topic":"","showStatusActivities":true,"logIOActivities":false,"showErrors":true,"unitid":"1","dataType":"InputRegister","adr":"256","quantity":"30","rate":"15","rateUnit":"s","delayOnStart":false,"startDelayTime":"1","server":"d8043f74.21d91","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":true,"x":170,"y":300,"wires":[["467d1059.340288"],[]]},{"id":"467d1059.340288","type":"buffer-parser","z":"4aa3e13d.f801b","name":"parse gavazzi set 2","data":"responseBuffer.buffer","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"int32le","name":"amps","offset":0,"length":1,"offsetbit":0,"scale":"/1000","mask":""},{"type":"int32le","name":"volts","offset":4,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"watts","offset":12,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"voltampers","offset":16,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"voltampers_reactive","offset":20,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"power_factor","offset":24,"length":1,"offsetbit":0,"scale":"/1000","mask":""},{"type":"int32le","name":"frequency","offset":32,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"kwh_tot_in","offset":36,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"kvar_tot_in","offset":40,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"kwh_tot_out","offset":44,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"kvar_tot_out","offset":48,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"kw_dmd","offset":52,"length":1,"offsetbit":0,"scale":"/10","mask":""},{"type":"int32le","name":"kw_dmd_peak","offset":56,"length":1,"offsetbit":0,"scale":"/10","mask":""}],"swap1":"swap16","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":390,"y":300,"wires":[["afc71073.4c79d","8653bf39.2d6f1","b7a25998.d154d8","6b2750da.b31d5"]]},{"id":"afc71073.4c79d","type":"debug","z":"4aa3e13d.f801b","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":590,"y":300,"wires":[]},{"id":"3a54eeed.5b39a2","type":"influxdb out","z":"4aa3e13d.f801b","influxdb":"636cb567.cfe544","name":"Electricidad totales in tests","measurement":"electricidad_totales","precision":"","retentionPolicy":"","database":"database","precisionV18FluxV20":"ms","retentionPolicyV18Flux":"","org":"organisation","bucket":"bucket","x":860,"y":360,"wires":[]},{"id":"b7a25998.d154d8","type":"change","z":"4aa3e13d.f801b","name":"prepare totales","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.{\t \"exportacion\": - kwh_tot_out,\t \"importacion\": kwh_tot_in\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":360,"wires":[["3a54eeed.5b39a2","b9b8fa4f.a3c7d8"]]},{"id":"13280e60.4d1b12","type":"influxdb out","z":"4aa3e13d.f801b","influxdb":"353f3090.d331c","name":"Ingeteam in tests - influx 2","measurement":"ingeteam","precision":"","retentionPolicy":"","database":"database","precisionV18FluxV20":"ms","retentionPolicyV18Flux":"","org":"gonzalez-conesa","bucket":"tests","x":880,"y":120,"wires":[]},{"id":"b9b8fa4f.a3c7d8","type":"influxdb out","z":"4aa3e13d.f801b","influxdb":"353f3090.d331c","name":"Electricidad totales in tests - influx2","measurement":"electricidad_totales","precision":"","retentionPolicy":"","database":"database","precisionV18FluxV20":"ms","retentionPolicyV18Flux":"","org":"gonzalez-conesa","bucket":"tests","x":880,"y":400,"wires":[]},{"id":"6b2750da.b31d5","type":"influxdb out","z":"4aa3e13d.f801b","influxdb":"353f3090.d331c","name":"Power metter in tests influx 2","measurement":"power_metter","precision":"","retentionPolicy":"","database":"database","precisionV18FluxV20":"ms","retentionPolicyV18Flux":"","org":"gonzalez-conesa","bucket":"tests","x":640,"y":260,"wires":[]},{"id":"7c9e7be9.c6b294","type":"modbus-client","name":"Ingecon Sun 1Play Storage","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"10.13.2.70","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"1","commandDelay":"1","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true},{"id":"636cb567.cfe544","type":"influxdb","hostname":"tirith.casa","port":"8086","protocol":"http","database":"tests","name":"Tests Tirith","usetls":false,"tls":"","influxdbVersion":"1.x","url":"http://localhost:8086","rejectUnauthorized":true},{"id":"d8043f74.21d91","type":"modbus-client","name":"ingeteam external power metter","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"ingeteam.casa","tcpPort":"503","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"1","commandDelay":"1","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true},{"id":"353f3090.d331c","type":"influxdb","hostname":"127.0.0.1","port":"8086","protocol":"http","database":"database","name":"tests mistborn","usetls":false,"tls":"","influxdbVersion":"2.0","url":"http://10.13.2.15:8086","rejectUnauthorized":false}]