[{"id":"b2e48303.56e8a","type":"tab","label":"HeishaMon","disabled":false,"info":""},{"id":"6e02aa86.084cf4","type":"mqtt in","z":"b2e48303.56e8a","name":"MQTT HeishaSensor","topic":"panasonic_heat_pump/sdc/#","qos":"2","datatype":"auto","broker":"f6628dbd.b9935","x":140,"y":260,"wires":[["7f464261.6a34ac"]]},{"id":"7f464261.6a34ac","type":"function","z":"b2e48303.56e8a","name":"Map sensor to ID","func":"// if there's an entry in the global defined variable then \n// the value needs to be saved (send) to next function \nvar sensorsplit = msg.topic.split(\"/\");\nvar sensor = sensorsplit[sensorsplit.length-1];\n \nvar sensorvalue = msg.payload;\nfor (i = 0; i < context.global.heishamon.SensorMapping.length; i++) {\n // when sensor is in the global settings \n msg.sensor = sensor;\n if(sensor == context.global.heishamon.SensorMapping[i][0]){\n// node.warn(context.global.heishamon.SensorMapping[i]);\n // add the home automation ID/name \n msg.HAid = context.global.heishamon.SensorMapping[i][1];\n\n // add type (if it exists):\n if(context.global.heishamon.SensorMapping[i][2]){\n msg.type = context.global.heishamon.SensorMapping[i][2];\n } \n return msg;\n }\n}\nreturn;","outputs":1,"noerr":0,"x":390,"y":260,"wires":[["34e58f38.f27b3"]]},{"id":"4878e4b3.2f90ec","type":"function","z":"b2e48303.56e8a","name":"global setup","func":"if (!context.global.heishamon) {\n context.global.heishamon = {};\n}\n\n// write down the Home Automation applications used\n// Possible values: Domoticz, InfluxDB, openHAB, HomeAssistant\n// comma seperated and case sensitive\ncontext.global.heishamon.HAapplication = \"Domoticz, InfluxDB\";\n\n\n//This is the overview of sensors which has to be sent to the Home Automation system\ncontext.global.heishamon.SensorMapping = [\n // [ \"name of topic\", \"IDx in Domoticz \"]\n // Dummy IDX ----- ------ Set--- Topic---- Custom Device name ---- Device type -- Units \n //[\"Heatpump_State\",xxxx,\"Switch\"], \t //SET1 // TOP0 x WP: Aan - Uit [ NR ] -- Light/Switch \n [\"Pump_Flow\",12524], \t \t\t // TOP1 x WP: Flow [ NR ] -- Custom Sensor\t-- unit= :L/m \n //[\"Force_DHW_State\",xxx,\"Switch\"],\t\t //SET10 // TOP2 \n [\"Quiet_Mode_Schedule\",12501], \t // TOP3 / WP: Pana Stil ST -- Light/Switch\n //[\"Operating_Mode_State\",12896,\"Selector Switch\"], //SET9 // TOP4 x NR: WP-Mode State -- Selector Switch -- make 7 levels - (0=Heat only, 10=Cool only, 20=Auto, 30=DHW only, 40=Heat+DHW, 50=Cool+DHW, 60=Auto+DHW)\n [\"Main_Inlet_Temp\",12494], // TOP5 x WP: Instroom [ NR ] [ Retour ] -- Temp\n [\"Main_Outlet_Temp\",12493], // TOP6 x WP: Uitstroom [ NR ] [ Aanvoer] -- Temp\n [\"Main_Target_Temp\",12898], // TOP7 x WP: Stooklijn Water [ NR ] -- Temp\n [\"Compressor_Freq\",12526], // TOP8 x WP: Frequentie [ NR ] -- Custom Sensor -- unit= :Hz\n //[\"DHW_Target_Temp\", null], // TOP9 \n //[\"DHW_Temp\", null], // TOP10 \n [\"Operations_Hours\",12499], // TOP11 x WP: Bedrijfstijd [ NR ] -- RFXMeter counter -- unit= :Hours \n [\"Operations_Counter\",12498], // TOP12 x WP: Start - Stops [ NR ] -- RFXMeter counter -- unit= x :On / Off\n [\"Main_Schedule_State\",12899,\"Switch\"], \t // TOP13 x WP: Weektimer ST [ NR ] -- Light/Switch\n [\"Outside_Temp\",12495], // TOP14 x WP: Buiten [ NR ] -- Temp\n [\"Heat_Energy_Production\",12900], // TOP15 x WP: Vermogen W [ NR ] -- Usage\n [\"Heat_Energy_Consumption\",12901], // TOP16 x WP: Verbruik W [ NR ]\n [\"Powerful_Mode_Time\",12955,\"Selector Switch\"], //SET4 // TOP17 x idx voor time: 12902 WP: Extra Power ST [ NR ] -- Selector Switch -- make 4 levels -- 0= off - 10= 30 Minute - 20= 60 Minute - 30= 90 Minute\n [\"Quiet_Mode_Level\",12501,\"Selector Switch\"], // TOP18 x WP: Pana Stil ST [ NR ]-- Selector Switch - make 4 levels -- 0= off - 10= Sillent 1 - 20= Sillent 2 - 30= Sillent 3 IDX Ook bij andere flow invullen\n [\"Holiday_Mode_State\",12903,\"Switch\"], //SET2 // TOP19 x WP: Vakantiemodus ST [ NR ] -- Light/Switch\n [\"ThreeWay_Valve_State\",12904,\"Selector Switch\"], // TOP20 x WP: 3 Weg ST [ NR ] -- Selector Switch -- make 2 levels -- 0=Room, 10=DHW\n [\"Outside_Pipe_Temp\",12905], // TOP21 x WP: Outside_Pipe_Temp [ NR ] -- Temp\n //[\"DHW_Heat_Delta\", null], // TOP22 \n [\"Heat_Delta\",12906], \t // TOP23 x WP: Cv DT SP [ NR] -- Temp\n [\"Cool_Delta\",12907], // TOP24 x WP: Koel DT SP [ NR ] -- Temp\n //[\"DHW_Holiday_Shift_Temp\", null], // TOP25 \n [\"Defrosting_State\",12908,\"Switch\"], // TOP26 x WP: Defrost ST [ NR ] -- Light/Switch\n [\"Z1_Heat_Request_Temp\",12961], \t // TOP27 x WP: Shift W ST [ NR ] -- Temp\n [\"Z1_Cool_Request_Temp\",12962], // TOP28 x WP: Shift K ST [ NR ] -- Temp\n [\"Z1_Heat_Curve_Target_High_Temp\",12911], // TOP29 x WP: Curve W Hoog SP [ NR ] -- Temp\n [\"Z1_Heat_Curve_Target_Low_Temp\",12912], // TOP30 x WP: Curve W Laag SP [ NR ] -- Temp\n [\"Z1_Heat_Curve_Outside_High_Temp\",12913], // TOP31 x WP: Curve B Hoog SP [ NR ] -- Temp\n [\"Z1_Heat_Curve_Outside_Low_Temp\",12914], // TOP32 x WP: Curve B Laag SP [ NR ] -- Temp\n [\"Room_Thermostat_Temp\",12933], // TOP33 x WP: Kamerthermostaat ST [ NR ]-- Temp\n //[\"Z2_Heat_Request_Temp\",null], // TOP34 \n //[\"Z2_Cool_Request_Temp\",null], // TOP35 \n //[\"Z1_Water_Temp\",xxxx], // TOP36 \t\n //[\"Z2_Water_Temp\",xxxx], // TOP37 \n\t\t\t[\"Cool_Energy_Production\",12919], // TOP38 x WP: Power Vermogen K [ NR ] -- Usage\n [\"Cool_Energy_Consumption\",12920], // TOP39 x WP: Energie Verbruik K [ NR ] -- Usage\n\t\t\t//[\"DHW_Energy_Production\", null], // TOP40 \n //[\"DHW_Energy_Consumption\",null], // TOP41 \n [\"Z1_Water_Target_Temp\",12918], // TOP42 x\tWP: Z1 Water Doel ST [ NR ] -- Temp\n //[\"Z2_Water_Target_Temp\",xxxx], // TOP43 \n [\"Error\",12954], \t // TOP44 x\tWP: Error [ NR ] -- Alert\n [\"Room_Holiday_Shift_Temp\",12926], // TOP45 x\tWP: Vakantie ST [ NR ] -- Temp\n //[\"Buffer_Temp\", null], // TOP46 \n //[\"Solar_Temp\", null], // TOP47 \n //[\"Pool_Temp\", null], // TOP48 \n [\"Main_Hex_Outlet_Temp\",12927], // TOP49 x\tWP: Hex ST [ NR ] -- Temp\n [\"Discharge_Temp\", 12929], // TOP50 x WP: Discharge ST [ NR ] -- Temp\n [\"Inside_Pipe_Temp\", 12930], // TOP51 x\tWP: Inside Pipe ST [ NR ] -- Temp\n //[\"Defrost_Temp\",], // TOP52\t Cut in Pana Mono\n [\"Eva_Outlet_Temp\",12932], // TOP53 x\tWP: EvaOutlet ST [ NR ] -- Temp\n //[\"Bypass Outlet_Temp\",xxxxx], // TOP54\t \n [\"Ipm_Temp\",12934], // TOP55 x\tWP: IPM ST [ NR ] -- Temp\n [\"Z1_Temp\",12935], // TOP56 x WP: Z1 Actueel ST [ NR ] -- Temp \n //[\"Z2_Temp\",xxxxx], // TOP57 \n //[\"DHW_Heater_State\",xxxxx,\"Switch\"], // TOP58 \n [\"Room_Heater_State\",12938], // TOP59 /\tWP: BHeater Toestaan ST [ NR ] -- Light/Switch\n [\"Internal_Heater_State\",12587], // TOP60 / WP: InternalHeater ST [ NR ] -- Light/Switch\n [\"External_Heater_State\", 12957], // TOP61 / WP: ExternalHeater ST [ NR ] -- Light/Switch\n [\"Fan1_Motor_Speed\",12940], // TOP62 x\tWP: Fan Speed [ NR ] -- Custom Sensor\t-- Unit = r/Minute\n //[\"Fan2 Motor_Speed\", null], // TOP63 \n [\"High_Pressure\",12941], // TOP64 x\tWP: High-Druk [ NR ] -- Custom Sensor -- Unit = Kgf/cm2\n [\"Pump_Speed\",12942], // TOP65 x WP: Pomp Speed [ NR ] -- Custom Sensor -- Unit = r/min\t\n [\"Low_Pressure\",12943], // TOP66 x WP: Low_Druk [ NR ]\t -- Custom Sensor -- Unit = Kgf/cm2\n [\"Compressor_Current\",12944], // TOP67 x WP: Current [ NR ] -- Custom Sensor -- Unit = Ampere\n [\"Force_Heater_State\",12945], // TOP68 x WP: ForceHeater ST [ NR ] -- Light/Switch\n //[\"Sterilization_State\", null], // TOP69\t\n //[\"Sterilization_Temp\", null], // TOP70 \n //[\"Sterilization_Max_Time\", null], // TOP71 \n [\"Z1_Cool_Curve_Target_High_Temp\",12931], // TOP72 x WP: Cool curve Target High [ NR ] --- Temp\t\t\n\t\t\t[\"Z1_Cool_Curve_Target_Low_Temp\",12988], // TOP73 x WP: Cool curve Target Low [ NR ] --- Temp\t\n\t\t\t[\"Z1_Cool_Curve_Outside_High_Temp\",13213], // TOP74 x WP: Cool curve Out High [ NR ] --- Temp\t\n\t\t\t[\"Z1_Cool_Curve_Outside_Low_Temp\",13263], // TOP75 x\tWP: Cool curve Out Low [ NR ] -- Temp\t\n\t\t\t[\"Heating_Mode\",12960,\"Selector Switch\"], // TOP76 x WP: Heating_Mode Curve direct [ NR ] -- Selector Switch -- make 4 levels - (0=comp heat/direct cool, 10=comp heat+cool, 20=direct heat+cool, 30=direct heat/comp cool)\n\t\t\t[\"Heating_Off_Outdoor_Temp\",13389], \t\t\t\t // TOP77 x WP: WP Verwarmen uit SP [ NR ] --- Temp\n\t\t\t[\"Heater_On_Outdoor_Temp\",13390], \t // TOP78 x WP: Backupheater Aan SP [ NR ] --- Temp\n\t\t\t[\"Heat_To_Cool_Temp\",13391], \t // TOP79 x WP: Verwarm naar Koelen SP [ NR ] --- Temp\n [\"Cool_To_Heat_Temp\",13392], // TOP80 x WP: Koel naar Verwarm SP [ NR ] --- Temp\n [\"Cooling_Mode\",13393], // TOP81 x WP: Koelmode Curve/Direct ST [ NR ] --- Switch\n //[\"Z2_Heat_Curve_Target_High_Temp\"], // TOP82\n //[\"Z2_Heat_Curve_Target_Low_Temp\"], // TOP83\n //[\"Z2_Heat_Curve_Outside_High_Temp\"], // TOP84\n //[\"Z2_Heat_Curve_Outside_Low_Temp\"], // TOP85\n //[\"Z2_Cool_Curve_Target_High_Temp\"], // TOP86\n //[\"Z2_Cool_Curve_Target_Low_Temp\"], // TOP87\n //[\"Z2_Cool_Curve_Outside_High_Temp\"], // TOP88\n //[\"Z2_Cool_Curve_Outside_Low_Temp\"], // TOP89\n [\"Room_Heater_Operations_Hours\",12503], // TOP90 x WP: Backupheater [ NR ] -- Custom Sensor -- Unit = hour\n //[\"DHW_Heater_Operations_Hours\"], // TOP91\n ];\n \ncontext.global.heishamon.ActionMapping = [\n // actioncommand, type, \"IDx in Domoticz/Name in Home Assistant/ ?? openHAB ??\" \n [\"SetHeatpump\",\"Switch\",13401], //SET1 // TOP0 x WP: Aan - Uit [ NR ] -- Light/Switch \n [\"SetHolidayMode\",\"Switch\",12903],\t\t\t\t\t //SET2 // TOP19 WP: Vakantiemodus [ NR ]\t -- Light/Switch\n\t[\"SetQuietMode\",\"Selector Switch\",12959],\t\t\t //SET3 WP: WP Stil [ NR ] -- Selector Switch - make 4 levels -- 0= off - 10= Sillent 1 - 20= Sillent 2 - 30= Sillent 3 \n [\"SetPowerfulMode\",\"Selector Switch\",12955], //SET4 // New WP: Extra Power [ NR ] -- Selector Switch -- make 4 levels -- 0= off - 10= 30 Minute - 20= 60 Minute - 30= 90 Minute\n [\"SetZ1HeatRequestTemperature\",\"Thermostat\",12956], //SET5\t // TOP27 WP: Shift W [ NR ] -- Thermostat SetPoint\n [\"SetZ1CoolRequestTemperature\",\"Thermostat\",12948], //SET6 // TOP28 WP: Z1 Shift K [ NR ] -- Thermostat\tSetPoint\n //[\"SetZ2HeatRequestTemperature\", \"Thermostat\",xxxx], //SET7 // TOP34 \n //[\"SetZ2CoolRequestTemperature\", \"Thermostat\",xxxx], //SET8 // TOP35 \n [\"SetOperationMode\",\"Selector Switch\",12896],\t\t\t //SET9 \t // TOP4 WP: Mode [ NR ] -- Selector Switch -- make 7 levels - (0=Heat only, 10=Cool only, 20=Auto, 30=DHW only, 40=Heat+DHW, 50=Cool+DHW, 60=Auto+DHW)\n //[\"SetForceDHW\",\"Switch\",xxxx],\t\t\t\t //SET10\t // \n //[\"SetDHWTemp\",\"Thermostat\",xxxx], //SET11 // \n [\"SetForceDefrost\",\"Switch\",12958], //SET12 // New WP: Forceer DF [ NR ] -- Light/Switch\n //[\"SetForceSterilization\",\"Switch\",xxxxx] //SET14 // \n \n \n];\nreturn msg;","outputs":1,"noerr":0,"x":450,"y":80,"wires":[[]]},{"id":"e08e8faf.7fd75","type":"inject","z":"b2e48303.56e8a","name":"","topic":"Startup","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":210,"y":120,"wires":[["4878e4b3.2f90ec"]]},{"id":"34e58f38.f27b3","type":"switch","z":"b2e48303.56e8a","name":"Which HA app ","property":"heishamon.HAapplication","propertyType":"global","rules":[{"t":"cont","v":"Domoticz","vt":"str"},{"t":"cont","v":"HomeAssistant","vt":"str"},{"t":"cont","v":"openHAB","vt":"str"},{"t":"cont","v":"InfluxDB","vt":"str"}],"checkall":"true","repair":true,"outputs":4,"x":600,"y":300,"wires":[["c233f22c.eefd1"],["e3204d9b.10c3e"],["857a1699.062408"],["ab23be16.6d1a7"]]},{"id":"c233f22c.eefd1","type":"function","z":"b2e48303.56e8a","name":"Prepare Domoticz output","func":"if(msg.HAid !== null){\n msg1 = {};\n msg1.payload = {};\n msg1.payload.idx = msg.HAid; \n msg1.topic = \"domoticz/in\";\n\n if(msg.type == \"Selector Switch\"){\n msg1.payload.command = \"switchlight\";\n msg1.payload.switchcmd = \"Set Level\";\n msg1.payload.level = msg.payload * 10;\n }else if(msg.type == \"Switch\"){\n msg1.payload.command = \"switchlight\"\n if(msg.payload == 1){ cmd = \"On\"; }else{ cmd=\"Off\"}\n msg1.payload.switchcmd = cmd;\n }else{\n msg1.payload.svalue = msg.payload;\n }\n return msg1;\n}\n\nreturn;","outputs":1,"noerr":0,"x":810,"y":180,"wires":[["621c032a.31eebc","eff897d7.62a918"]]},{"id":"621c032a.31eebc","type":"mqtt out","z":"b2e48303.56e8a","name":"MQTT publish","topic":"","qos":"1","retain":"","broker":"5f9a258f.e3a78c","x":1020,"y":380,"wires":[]},{"id":"ab23be16.6d1a7","type":"function","z":"b2e48303.56e8a","d":true,"name":"Prepare InfluxDB output","func":"if(isNaN(parseFloat(msg.payload))){\n return;\n}else{\n \n msg.payload = [{\n numValue: parseFloat(msg.payload),\n strValue: msg.sensor\n },\n {\n tag1:msg.sensor\n }];\n return msg;\n}","outputs":1,"noerr":0,"x":690,"y":400,"wires":[["3294702d.3f7fc"]]},{"id":"857a1699.062408","type":"function","z":"b2e48303.56e8a","d":true,"name":"Prepare openHAB output","func":"if(msg.payload.HAid != null){\n //do something\n}\n\nreturn;","outputs":1,"noerr":0,"x":850,"y":320,"wires":[["621c032a.31eebc"]]},{"id":"e3204d9b.10c3e","type":"function","z":"b2e48303.56e8a","d":true,"name":"Prepare HomeAssistant output","func":"msg1 = {};\nmsg1.payload = msg.payload;\nmsg1.topic = \"home/\" + msg.HAid; // Example: home/Compressor_Freq (or how it is mentioned in global setup)\nreturn msg1;\n","outputs":1,"noerr":0,"x":850,"y":260,"wires":[["621c032a.31eebc","eff897d7.62a918"]]},{"id":"c15a594e.3f0858","type":"mqtt in","z":"b2e48303.56e8a","name":"Domoticz Publish","topic":"domoticz/out/#","qos":"2","datatype":"auto","broker":"153fcf5b.f22d21","x":180,"y":660,"wires":[["dae9e7aa.939bd8"]]},{"id":"ce84fbda.2f7708","type":"debug","z":"b2e48303.56e8a","name":"","active":true,"console":"false","complete":"false","x":1030,"y":620,"wires":[]},{"id":"dae9e7aa.939bd8","type":"json","z":"b2e48303.56e8a","name":"","property":"payload","action":"","pretty":false,"x":390,"y":660,"wires":[["53c08a90.077964"]]},{"id":"53c08a90.077964","type":"function","z":"b2e48303.56e8a","name":"Translate HomeAutomation to Heishamon","func":"//node.warn(msg.payload.idx)\nvar type;\n\nfor (i = 0; i < context.global.heishamon.ActionMapping.length; i++) {\n if(msg.payload.idx == context.global.heishamon.ActionMapping[i][2]){\n if(context.global.heishamon.ActionMapping[i][1]){\n msg.topic = \"panasonic_heat_pump/\" + context.global.heishamon.ActionMapping[i][0];\n type = context.global.heishamon.ActionMapping[i][1];\n node.warn(msg.payload);\n switch(type){\n case \"Selector Switch\":\n msg.payload = (msg.payload.svalue1 / 10);\n return msg;\n case \"Thermostat\":\n msg.payload = parseInt(msg.payload.svalue1);\n return msg;\n case \"Switch\":\n msg.payload = msg.payload.nvalue;\n return msg;\n }\n\n }\n }\n}\n\n/*\nif (msg.payload.idx===1704) { // Silent Mode\n //node.warn(msg.payload);\n msg.topic = \"panasonic_heat_pump/SetQuietMode\";\n msg.payload = msg.payload.svalue1 % 10;\n return msg;\n\n} else if (msg.payload.idx===1702) { // TargetTemp\n \n node.warn(msg.payload);\n var TempInDec = parseInt(msg.payload.svalue1);\n msg.topic = \"panasonic_heat_pump/SetShiftTemperature\";\n msg.payload = TempInDec;\n return msg;\n \n} else if (msg.payload.idx===1703) { // OnOff\n \n node.warn(msg.payload);\n msg.topic = \"panasonic_heat_pump/SetShiftTemperature\";\n msg.payload = msg.payload.nvalue;\n return msg;\n} else {\n // node.warn(\"other device\")\n}\n*/\nreturn;","outputs":1,"noerr":0,"x":660,"y":660,"wires":[["ce84fbda.2f7708","57914fbe.193ae"]]},{"id":"57914fbe.193ae","type":"mqtt out","z":"b2e48303.56e8a","name":"MQTT Publish Set-command","topic":"","qos":"","retain":"","broker":"153fcf5b.f22d21","x":1000,"y":760,"wires":[]},{"id":"eff897d7.62a918","type":"debug","z":"b2e48303.56e8a","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1050,"y":120,"wires":[]},{"id":"34737919.018776","type":"comment","z":"b2e48303.56e8a","d":true,"name":"Version 02","info":"Only the 'global setup' node needs to be changed (and if you're not running on localhost you need to change those mqtt connection nodes also). ","x":160,"y":60,"wires":[]},{"id":"225f81f5.03c9ae","type":"rbe","z":"b2e48303.56e8a","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":310,"y":420,"wires":[[]]},{"id":"6f2e992.1e2b768","type":"comment","z":"b2e48303.56e8a","d":true,"name":"Zorgt voor geen overtollige niet in gebruik ","info":"","x":400,"y":200,"wires":[]},{"id":"3294702d.3f7fc","type":"influxdb out","z":"b2e48303.56e8a","d":true,"influxdb":"","name":"","measurement":"heishamon","precision":"","retentionPolicy":"","x":840,"y":460,"wires":[]},{"id":"3ec0f45.d93ed0c","type":"mqtt in","z":"b2e48303.56e8a","name":"Domoticz test","topic":"domoticz/out/#","qos":"2","datatype":"auto","broker":"f6628dbd.b9935","x":170,"y":740,"wires":[[]]},{"id":"f6628dbd.b9935","type":"mqtt-broker","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":15,"cleansession":true,"birthQos":"0","willQos":"0"},{"id":"5f9a258f.e3a78c","type":"mqtt-broker","z":"","name":"","broker":"192.168.5.70","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"15","cleansession":true,"birthTopic":"Domoticz","birthQos":"2","birthRetain":"true","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"153fcf5b.f22d21","type":"mqtt-broker","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":15,"cleansession":true,"birthQos":"0","willQos":"0"}]