-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathingeteam_flow_v2.json
1 lines (1 loc) · 36.6 KB
/
ingeteam_flow_v2.json
1
[{"id":"4aa3e13d.f801b","type":"tab","label":"Solar","disabled":false,"info":"","env":[]},{"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":"67","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","senderr":false,"headers":[],"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":970,"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","senderr":false,"headers":[],"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","senderr":false,"headers":[],"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}}}/1","tls":"","persist":false,"proxy":"","authType":"basic","senderr":false,"headers":[],"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 | $.$each(function($v, $k) {{$k: $lookup($$.payload.langs.ENGLISH, $v)}}) ~> $merge() |\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":660,"wires":[["74cee61b.a09b9","69a7caf0.d95c7c"]]},{"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":""},{"type":"uint16be","name":"external_wattmeter_grid_voltage","offset":126,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint16be","name":"external_wattmeter_grid_frequency","offset":128,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"external_wattmeter_grid_active_power","offset":130,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16be","name":"external_wattmeter_grid_reactive_power","offset":132,"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":1050,"y":160,"wires":[]},{"id":"307db9a5.2db70e","type":"function","z":"4aa3e13d.f801b","name":"scale and interpret","func":"let payload=msg.payload;\n\n// Copy this value from the \"get inverter map\" debug output\nlet conversions = {\"web_interface_bits\":{\"convert\":\"bitwise\",\"positions\":[{\"val\":0,\"desc\":\"Green Led Blinking\"},{\"val\":1,\"desc\":\"Green Led On\"},{\"val\":5,\"desc\":\"Red Led On\"},{\"val\":8,\"desc\":\"Fan Test Running\"},{\"val\":9,\"desc\":\"Fan Test Ended\"},{\"val\":10,\"desc\":\"Grid/Genset Icon Active\"},{\"val\":11,\"desc\":\"Battery Icon Active\"},{\"val\":12,\"desc\":\"Inverter Icon Active\"},{\"val\":13,\"desc\":\"Autotest menu Enabled\"},{\"val\":14,\"desc\":\"Critical Loads configured\"}]},\"stop_event\":{\"values\":[{\"val\":0,\"desc\":\"0\"},{\"val\":1,\"desc\":\"1 - Low Battery SOC or Voltage\"},{\"val\":2,\"desc\":\"2 - High Battery Voltage\"},{\"val\":3,\"desc\":\"3 - Communication Error with BMS\"},{\"val\":4,\"desc\":\"4 - Inverter stopped from Digital Input\"},{\"val\":5,\"desc\":\"5 - Grid Voltage or Frequency out of range\"},{\"val\":6,\"desc\":\"6 - DC Bus or PV input Overvoltage\"},{\"val\":7,\"desc\":\"7 - DC/AC Fault\"},{\"val\":8,\"desc\":\"8 - DC/DC Fault\"},{\"val\":9,\"desc\":\"9 - HW Battery Overcurrent\"},{\"val\":10,\"desc\":\"10 - Inverter stopped manually\"},{\"val\":11,\"desc\":\"11 - Overdischarge in Battery\"},{\"val\":12,\"desc\":\"12 - Overload in Critical Loads\"},{\"val\":13,\"desc\":\"13 - Short circuit in Critical Loads\"},{\"val\":14,\"desc\":\"14 - Low PV Power\"},{\"val\":15,\"desc\":\"15 - AC Relays Test\"},{\"val\":16,\"desc\":\"16 - Low Inverter Temperature\"},{\"val\":17,\"desc\":\"17 - High Inverter Temperature\"},{\"val\":18,\"desc\":\"18 - Incremental differential current\"},{\"val\":19,\"desc\":\"19 - RMS Differential current\"},{\"val\":20,\"desc\":\"20 - Instantaneous differential current\"},{\"val\":21,\"desc\":\"21 - Insulation Failure\"},{\"val\":22,\"desc\":\"22 - High PV current\"},{\"val\":23,\"desc\":\"23 - DC/DC or AC/DC Error\"},{\"val\":24,\"desc\":\"24 - ADC Error\"},{\"val\":25,\"desc\":\"25 - Configuration change\"},{\"val\":26,\"desc\":\"26 - Reserved\"},{\"val\":27,\"desc\":\"27 - Wrong type of battery\"},{\"val\":28,\"desc\":\"28 - ADC Error\"},{\"val\":29,\"desc\":\"29 - Reset Watchdog\"},{\"val\":30,\"desc\":\"30 - Alarm in BMS\"}]},\"alarms\":{\"convert\":\"bitwise\",\"positions\":[{\"val\":0,\"desc\":\"Battery voltage out of range\"},{\"val\":1,\"desc\":\"Grid frequency out of range\"},{\"val\":2,\"desc\":\"Grid voltage out of range\"},{\"val\":3,\"desc\":\"DC/AC Inverter overcurrent or fault\"},{\"val\":4,\"desc\":\"DC/DC Battery overcurrent or fault\"},{\"val\":5,\"desc\":\"Insulation failure\"},{\"val\":6,\"desc\":\"Wrong wired in the installation\"},{\"val\":7,\"desc\":\"Inverter temperature out of range\"},{\"val\":8,\"desc\":\"DC Bus overvoltage\"},{\"val\":9,\"desc\":\"Configuration change\"},{\"val\":10,\"desc\":\"Inverter stopped\"},{\"val\":11,\"desc\":\"Hardware failure\"},{\"val\":12,\"desc\":\"DC/DC or AC/DC Converter Error\"},{\"val\":13,\"desc\":\"Transient Grid Frequency (AC Breaker tripped)\"},{\"val\":14,\"desc\":\"Battery Temperature out of range\"},{\"val\":15,\"desc\":\"Overload capacity exceeded in Battery\"},{\"val\":16,\"desc\":\"Overload capacity exceeded in Critical Loads\"},{\"val\":17,\"desc\":\"Short circuit in Critical Loads\"},{\"val\":18,\"desc\":\"PT100 sensor failure\"},{\"val\":19,\"desc\":\"Communication Error with BMS\"},{\"val\":20,\"desc\":\"Wrong inverter serial number\"},{\"val\":21,\"desc\":\"Transient Grid Voltage (AC Breaker tripped)\"},{\"val\":22,\"desc\":\"Wrong type of battery configuration\"},{\"val\":23,\"desc\":\"Alarm in the BMS\"},{\"val\":24,\"desc\":\"Overcurrent in PV 1 array input\"},{\"val\":25,\"desc\":\"Overcurrent in PV 2 array input\"},{\"val\":26,\"desc\":\"Full Battery Discharge\"}]},\"code1\":{\"convert\":\"bitwise\",\"positions\":[{\"val\":1,\"desc\":\"Grid Current Sensor out of full scale range\"},{\"val\":2,\"desc\":\"Insulation Failure in PV or Battery terminals\"},{\"val\":3,\"desc\":\"Warning: Internal fan blocked\"},{\"val\":4,\"desc\":\"Warning: External fan blocked\"},{\"val\":5,\"desc\":\"Battery Current Sensor out of full scale range\"},{\"val\":6,\"desc\":\"Compensation of DC offset failed\"},{\"val\":7,\"desc\":\"Grid Voltage Sensor out of full scale range\"},{\"val\":8,\"desc\":\"Avg. Differential Current out of full scale range\"},{\"val\":9,\"desc\":\"Inst. Differential Current out of full scale range\"},{\"val\":10,\"desc\":\"RMS Differential Current failure\"},{\"val\":11,\"desc\":\"Incremental differential current failure\"},{\"val\":12,\"desc\":\"Instantaneous differential current failure\"},{\"val\":13,\"desc\":\"Inverter stopped manually\"}]},\"code2\":{\"convert\":\"bitwise\",\"positions\":[{\"val\":0,\"desc\":\"Warning: High Temperature\"},{\"val\":1,\"desc\":\"AC Voltage in Critical Loads Output\"},{\"val\":2,\"desc\":\"Low PV power to start up the inverter\"},{\"val\":3,\"desc\":\"Grid Frequency out of the configured limits\"},{\"val\":4,\"desc\":\"Warning: Compensation of DC offset\"},{\"val\":5,\"desc\":\"Internal AC relay test failed\"},{\"val\":6,\"desc\":\"Grid Voltage out of the configured limits\"},{\"val\":7,\"desc\":\"Low Battery Voltage\"},{\"val\":8,\"desc\":\"High Battery Voltage\"},{\"val\":9,\"desc\":\"Communication Error with BMS\"},{\"val\":10,\"desc\":\"Maximum Critical Loads Power in Off-Grid\"},{\"val\":11,\"desc\":\"Low Critical Loads Voltage in Off-Grid\"},{\"val\":12,\"desc\":\"Maximum Critical Loads Power in On-Grid\"},{\"val\":13,\"desc\":\"Alarm in the BMS\"},{\"val\":14,\"desc\":\"Internal Differential Current test failed\"},{\"val\":15,\"desc\":\"Inverter stopped by the Digital Input\"}]},\"code3\":{\"convert\":\"bitwise\",\"positions\":[{\"val\":0,\"desc\":\"PT100 disconnected or shortcircuited\"},{\"val\":1,\"desc\":\"High Battery Temperature\"},{\"val\":2,\"desc\":\"Warning: DC/DC Battery cannot operate\"},{\"val\":3,\"desc\":\"Warning: Synchronization with the grid not successful\"},{\"val\":4,\"desc\":\"Warning: Transient failure detection in the Grid (12ms)\"},{\"val\":5,\"desc\":\"Warning: DC/DC PV input 1 cannot operate\"},{\"val\":6,\"desc\":\"Battery SOC lower than configured SOC Descx\"},{\"val\":7,\"desc\":\"Warning: DC/DC PV input 2 cannot operate\"},{\"val\":8,\"desc\":\"Warning: Date not synchronized\"},{\"val\":9,\"desc\":\"Warning: RTC CR2032 battery exhausted\"},{\"val\":10,\"desc\":\"Warning: Injection of power to the generator\"},{\"val\":11,\"desc\":\"Warning: Generator Voltage out of range\"},{\"val\":12,\"desc\":\"Warning: Generator Frequency out of range\"},{\"val\":13,\"desc\":\"Warning: Transient Grid Voltage (AC Breaker tripped)\"},{\"val\":14,\"desc\":\"Warning: Transient Grid Frequency (AC Breaker tripped)\"}]},\"inverter_status\":{\"values\":[{\"val\":0,\"desc\":\"Stopped\"},{\"val\":1,\"desc\":\"Starting\"},{\"val\":2,\"desc\":\"Off-Grid\"},{\"val\":3,\"desc\":\"On-Grid\"},{\"val\":4,\"desc\":\"On-Grid\"},{\"val\":5,\"desc\":\"Waiting to connect to Grid\"},{\"val\":6,\"desc\":\"Bypass AC activated\"},{\"val\":7,\"desc\":\"Emergency Charge from PV\"},{\"val\":8,\"desc\":\"Emergency Charge from Grid\"},{\"val\":9,\"desc\":\"Locked waiting for Reset\"},{\"val\":10,\"desc\":\"Error\"},{\"val\":11,\"desc\":\"Off-Grid in AC Grid\"}]},\"battery_status\":{\"values\":[{\"val\":0,\"desc\":\"Standby\"},{\"val\":1,\"desc\":\"Discharging\"},{\"val\":2,\"desc\":\"Charging\"},{\"val\":3,\"desc\":\"Constant Voltage\"},{\"val\":4,\"desc\":\"Flotation\"},{\"val\":5,\"desc\":\"Equalization\"},{\"val\":6,\"desc\":\"Error with BMS\"},{\"val\":7,\"desc\":\"No Configured\"},{\"val\":8,\"desc\":\"Calibration - Charging\"},{\"val\":9,\"desc\":\"Calibration - Discharging\"}]},\"battery_bms_alarms\":{\"convert\":\"bitwise\",\"positions\":[{\"val\":0,\"desc\":\"High Current during Charge\"},{\"val\":1,\"desc\":\"High Voltage\"},{\"val\":2,\"desc\":\"Low Voltage\"},{\"val\":3,\"desc\":\"High Temperature\"},{\"val\":4,\"desc\":\"Low Temperature\"},{\"val\":5,\"desc\":\"Internal BMS Alarm\"},{\"val\":6,\"desc\":\"Cell Imbalance\"},{\"val\":7,\"desc\":\"High Current during discharge\"},{\"val\":8,\"desc\":\"System Error\"}]},\"battery_power_reduction_reason\":{\"values\":[{\"val\":0,\"desc\":\"No Limitation\"},{\"val\":1,\"desc\":\"Heat Sink Temperature\"},{\"val\":2,\"desc\":\"PT100 Temperature\"},{\"val\":3,\"desc\":\"Low Bus Voltage Protection\"},{\"val\":4,\"desc\":\"Lead-acid Settings\"},{\"val\":5,\"desc\":\"BMS Communication\"},{\"val\":6,\"desc\":\"SOC Max Configured\"},{\"val\":7,\"desc\":\"SOC Min Configured\"},{\"val\":8,\"desc\":\"Maximum Battery Power\"},{\"val\":9,\"desc\":\"High Battery Voltage Protection\"}]},\"active_power_reduction_reason\":{\"values\":[{\"val\":0,\"desc\":\"No Limitation\"},{\"val\":1,\"desc\":\"Communication\"},{\"val\":2,\"desc\":\"PCB Temperature\"},{\"val\":3,\"desc\":\"Heat Sink Temperature\"},{\"val\":4,\"desc\":\"Pac vs Fac Algorithm\"},{\"val\":5,\"desc\":\"Soft Start\"},{\"val\":6,\"desc\":\"Charge Power Configured\"},{\"val\":7,\"desc\":\"PV Surplus injected to the Loads\"},{\"val\":8,\"desc\":\"Pac vs Vac Algorithm\"},{\"val\":9,\"desc\":\"Battery Power Limited\"},{\"val\":10,\"desc\":\"AC Grid Power Limited\"},{\"val\":11,\"desc\":\"Self Consumption Mode\"},{\"val\":12,\"desc\":\"High Bus Voltage Protection\"},{\"val\":13,\"desc\":\"LVRT or HVRT Process\"},{\"val\":14,\"desc\":\"Nominal AC Current\"},{\"val\":15,\"desc\":\"Grid Consumption Protection\"},{\"val\":16,\"desc\":\"PV Surplus Injected to the Grid\"}]},\"reactive_power_setpoint_type\":{\"values\":[{\"val\":0,\"desc\":\"Cosφ Configuration\"},{\"val\":1,\"desc\":\"Qac Communication\"},{\"val\":2,\"desc\":\"Cosφ Communication\"},{\"val\":3,\"desc\":\"Qac vs Vac Algorithm\"},{\"val\":4,\"desc\":\"Cosφ vs Pac Algorithm\"}]},\"digital_output1_status\":{\"values\":[{\"val\":0,\"desc\":\"OFF\"},{\"val\":1,\"desc\":\"ON\"}]},\"digital_output2_status\":{\"values\":[{\"val\":0,\"desc\":\"OFF\"},{\"val\":1,\"desc\":\"ON\"}]},\"digital_input_drm0_status\":{\"values\":[{\"val\":0,\"desc\":\"OFF\"},{\"val\":1,\"desc\":\"ON\"}]},\"digital_input2_status\":{\"values\":[{\"val\":0,\"desc\":\"OFF\"},{\"val\":1,\"desc\":\"ON\"}]},\"digital_input3_status\":{\"values\":[{\"val\":0,\"desc\":\"OFF\"},{\"val\":1,\"desc\":\"ON\"}]},\"hardware_version\":{\"values\":[{\"val\":0,\"desc\":\"ABH0039\"},{\"val\":1,\"desc\":\"ABH0045\"},{\"val\":2,\"desc\":\"ABH0039 - ABH PT100\"},{\"val\":3,\"desc\":\"ABH0045 - ABH PT100\"}]},\"battery_bms_flags\":{\"convert\":\"bitwise\",\"positions\":[{\"val\":0,\"desc\":\"Stop Charge\"},{\"val\":1,\"desc\":\"Stop Discharge\"},{\"val\":2,\"desc\":\"Forced Charge\"},{\"val\":3,\"desc\":\"Calibration\"}]}};\n\nfunction bitwise(value, positions) {\n let res = [];\n for(const position of positions) if(value & 1 << position.val) res.push(position.desc);\n return res.join(\", \");\n}\n\nfunction valuewise(value, values) {\n for(const candidate of values) if(value == candidate.val) return candidate.desc;\n}\n\nfor(const conv in conversions) {\n if(conversions[conv].convert == \"bitwise\") payload[conv+\"_str\"] = bitwise(payload[conv], conversions[conv].positions);\n else payload[conv+\"_str\"] = valuewise(payload[conv], conversions[conv].values);\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":610,"y":160,"wires":[["8ea81314.d0eca"]]},{"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":1070,"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":1080,"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":[["8653bf39.2d6f1","afc71073.4c79d","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":340,"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":1100,"y":320,"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":820,"y":320,"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":1100,"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":1120,"y":360,"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":1100,"y":260,"wires":[]},{"id":"69a7caf0.d95c7c","type":"change","z":"4aa3e13d.f801b","name":"extract descriptions","rules":[{"t":"set","p":"payload","pt":"msg","to":"(\t $strfields := [\t {\"addr\": 8, \"name\": \"web_interface_bits\"},\t {\"addr\": 9, \"name\": \"stop_event\"},\t {\"addr\": 10, \"name\": \"alarms\"},\t {\"addr\": 12, \"name\": \"code1\"},\t {\"addr\": 13, \"name\": \"code2\"},\t {\"addr\": 14, \"name\": \"code3\"},\t {\"addr\": 15, \"name\": \"inverter_status\"},\t {\"addr\": 26, \"name\": \"battery_status\"},\t {\"addr\": 28, \"name\": \"battery_bms_alarms\"},\t {\"addr\": 29, \"name\": \"battery_power_reduction_reason\"},\t {\"addr\": 41, \"name\": \"active_power_reduction_reason\"},\t {\"addr\": 42, \"name\": \"reactive_power_setpoint_type\"},\t {\"addr\": 62, \"name\": \"digital_output1_status\"},\t {\"addr\": 63, \"name\": \"digital_output2_status\"},\t {\"addr\": 64, \"name\": \"digital_input_drm0_status\"},\t {\"addr\": 65, \"name\": \"digital_input2_status\"},\t {\"addr\": 66, \"name\": \"digital_input3_status\"},\t {\"addr\": 67, \"name\": \"hardware_version\"},\t {\"addr\": 68, \"name\": \"battery_bms_flags\"}\t];\t $pre := payload.online[dir in $strfields.addr] ~> |$|{\"my_name\": ($dir := dir; $strfields[addr = $dir].name)}|;\t $pre{my_name: {\"convert\": convert, (convert = \"bitwise\" ? \"positions\" : \"values\"): tdesc.values.$each(function($v, $k) {{\"val\": $number($k), \"desc\": $v}}) }}\t)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":600,"wires":[["74cee61b.a09b9"]]},{"id":"8ea81314.d0eca","type":"change","z":"4aa3e13d.f801b","name":"compute consumption","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload ~> | $ | {\t \"production\": $max([inverter_active_power, 0]),\t \"export\": $max([-external_wattmeter_grid_active_power, 0]),\t \"import\": $max([external_wattmeter_grid_active_power, 0])\t} |\t~> | $ |{\t \"consumption\": production + external_wattmeter_grid_active_power,\t \"self_consumption\": production - export\t}|","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":840,"y":160,"wires":[["4c53df23.db3fb","26c1d00b.3d487","13280e60.4d1b12"]]},{"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":"0","parallelUnitIdsAllowed":true},{"id":"636cb567.cfe544","type":"influxdb","hostname":"10.13.2.10","port":"8087","protocol":"http","database":"tests","name":"Tests Tirith","usetls":false,"tls":"","influxdbVersion":"1.x","url":"http://localhost:8086","rejectUnauthorized":true,"credentials":{}},{"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":"0","parallelUnitIdsAllowed":true},{"id":"353f3090.d331c","type":"influxdb","hostname":"127.0.0.1","port":"8086","protocol":"http","database":"database","name":"tests influxdb2 tirith","usetls":false,"tls":"","influxdbVersion":"2.0","url":"http://10.13.2.10:8086","rejectUnauthorized":false}]