1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
| [
{
"id": "74d2d0281733f8d0",
"type": "mqtt in",
"z": "cadc1eebfdd4656d",
"name": "MQTT HeishaSensor",
"topic": "panasonic_heat_pump/main/#",
"qos": "2",
"datatype": "auto",
"broker": "e6d88d966d10b464",
"nl": false,
"rap": false,
"x": 240,
"y": 280,
"wires": [
[
"0084856f0bc60435"
]
]
},
{
"id": "0084856f0bc60435",
"type": "function",
"z": "cadc1eebfdd4656d",
"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,
"initialize": "",
"finalize": "",
"libs": [],
"x": 510,
"y": 280,
"wires": [
[
"97c3bb42a3fe8b69"
]
]
},
{
"id": "f421e949fdcd9e34",
"type": "function",
"z": "cadc1eebfdd4656d",
"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 = \"HomeAssistant, openHAB, 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/Name in Home Assistant/ ?? openHAB ??\"]\n [\"Heatpump_State\", 1703, \"Switch\"],\n [\"Pump_Flow\", 1609],\n [\"Force_DHW_State\", null, \"Selector Switch\"], //DHW status (20=off, 10=on 0=unknown)\n [\"Quiet_Mode_Schedule\", null, \"Switch\"],\n [\"Operating_Mode_State\", null, \"Selector Switch\"], //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\", 1605],\n [\"Main_Outlet_Temp\", 1606], \n [\"Main_Target_Temp\", null],\n [\"Compressor_Freq\", 1608],\n [\"DHW_Target_Temp\", null],\n [\"DHW_Temp\", null],\n [\"Operations_Hours\", 1611],\n [\"Operations_Counter\", 1612],\n [\"Main_Schedule_State\", null, \"Switch\"],\n [\"Outside_Temp\", 1610],\n [\"Heat_Energy_Production\", null],\n [\"Heat_Energy_Consumption\", null],\n [\"Powerful_Mode_Time\", null, \"Selector Switch\"], // 4 levels -- 0= off - 10= 30 Minute - 20= 60 Minute - 30= 90 Minute //0= off, 30 = level 3\n [\"Quiet_Mode_Level\", 1704, \"Selector Switch\"], // 4 levels -- 0= off - 10= Silent 1 - 20= Silent 2 - 30= Silent 3\n [\"Holiday_Mode_State\", null, \"Switch\"],\n [\"ThreeWay_Valve_State\", null, \"Selector Switch\"], // 2 levels -- 0=Room, 10=DHW\n [\"Outside_Pipe_Temp\", null],\n [\"DHW_Heat_Delta\", null],\n [\"Heat_Delta\", null],\n [\"Cool_Delta\", null],\n [\"DHW_Holiday_Shift_Temp\", null],\n [\"Defrosting_State\", null, \"Switch\"],\n [\"Z1_Heat_Request_Temp\", 1702, \"Thermostat\"],\n [\"Z1_Cool_Request_Temp\", null],\n [\"Z1_Heat_Curve_Target_High_Temp\", null],\n [\"Z1_Heat_Curve_Target_Low_Temp\", null],\n [\"Z1_Heat_Curve_Outside_High_Temp\", null],\n [\"Z1_Heat_Curve_Outside_Low_Temp\", null],\n [\"Room_Thermostat_Temp\", null],\n //[\"Z2_Heat_Request_Temp\", null],\n //[\"Z2_Cool_Request_Temp\", null],\n //[\"Z1_Water_Temp\", null],\n //[\"Z2_Water_Temp\", null],\n [\"Cool_Energy_Production\", null],\n [\"Cool_Energy_Consumption\", null],\n [\"DHW_Energy_Production\", null],\n [\"DHW_Energy_Consumption\", null],\n [\"Z1_Water_Target_Temp\", null],\n //[\"Z2_Water_Target_Temp\", null],\n [\"Error\", null],\n [\"Room_Holiday_Shift_Temp\", null],\n //[\"Buffer_Temp\", null],\n //[\"Solar_Temp\", null],\n //[\"Pool_Temp\", null],\n [\"Main_Hex_Outlet_Temp\", null],\n [\"Discharge_Temp\", null],\n [\"Inside_Pipe_Temp\", null],\n [\"Defrost_Temp\", null],\n [\"Eva_Outlet_Temp\", null],\n [\"Bypass_Outlet_Temp\", null],\n [\"Ipm_Temp\", null],\n [\"Z1_Temp\", 1702],\n //[\"Z2_Temp\", null],\n [\"DHW_Heater_State\", null],\n [\"Room_Heater_State\", null],\n [\"Internal_Heater_State\", 3095],\n [\"External_Heater_State\", null],\n [\"Fan1_Motor_Speed\", null],\n //[\"Fan2_Motor_Speed\", null],\n [\"High_Pressure\", null],\n [\"Pump_Speed\", null],\n [\"Low_Pressure\", null],\n [\"Compressor_Current\", null],\n [\"Force_Heater_State\", null, \"Switch\"],\n [\"Sterilization_State\", null, \"Switch\"],\n [\"Sterilization_Temp\", null],\n [\"Sterilization_Max_Time\", null],\n [\"Z1_Cool_Curve_Target_High_Temp\", null],\n [\"Z1_Cool_Curve_Target_Low_Temp\", null],\n [\"Z1_Cool_Curve_Outside_High_Temp\", null],\n [\"Z1_Cool_Curve_Outside_Low_Temp\", null],\n [\"Heating_Mode\", null],\n [\"Heating_Off_Outdoor_Temp\", null],\n [\"Heater_On_Outdoor_Temp\", null],\n [\"Heat_To_Cool_Temp\", null],\n [\"Cool_To_Heat_Temp\", null],\n [\"Cooling_Mode\", null],\n [\"Heat_To_Cool_Temp\", null],\n //[\"Z2_Heat_Curve_Target_High_Temp\", null],\n //[\"Z2_Heat_Curve_Target_Low_Temp\", null],\n //[\"Z2_Heat_Curve_Outside_High_Temp\", null],\n //[\"Z2_Heat_Curve_Outside_Low_Temp\", null],\n //[\"Z2_Cool_Curve_Target_High_Temp\", null],\n //[\"Z2_Cool_Curve_Target_Low_Temp\", null],\n //[\"Z2_Cool_Curve_Outside_High_Temp\", null],\n //[\"Z2_Cool_Curve_Outside_Low_Temp\", null],\n [\"Room_Heater_Operations_Hours\", null],\n [\"DHW_Heater_Operations_Hours\", null]\n ];\n \ncontext.global.heishamon.ActionMapping = [\n // actioncommand, type, \"IDx in Domoticz/Name in Home Assistant/ ?? openHAB ??\" \n [\"SetHeatpump\", \"Switch\", 1703],\n [\"SetHoliday\", \"Switch\", null],\n [\"SetQuietMode\", \"Selector Switch\", 1704],\n [\"SetPowerfull\", \"Selector Switch\", null],\n [\"SetZ1HeatRequestTemperature\", \"Thermostat\", 1702],\n [\"SetZ1CoolRequestTemperature\", \"Thermostat\", null],\n //[\"SetZ2HeatRequestTemperature\", \"Thermostat\", null],\n //[\"SetZ2CoolRequestTemperature\", \"Thermostat\", null],\n [\"SetOperationMode\", \"Selector Switch\", null],\n [\"SetForceDHW\", \"Switch\", null],\n [\"SetDHWTemp\", \"Thermostat\", null],\n [\"SetCoolTemp\", \"Thermostat\", null],\n [\"SetForceDefrost\", \"Switch\", null],\n [\"SetForceSterilization\", \"Switch\", null]\n];\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 490,
"y": 220,
"wires": [
[]
]
},
{
"id": "6cee5028ad2e0951",
"type": "inject",
"z": "cadc1eebfdd4656d",
"name": "",
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "Startup",
"payload": "",
"payloadType": "date",
"x": 240,
"y": 220,
"wires": [
[
"f421e949fdcd9e34"
]
]
},
{
"id": "97c3bb42a3fe8b69",
"type": "switch",
"z": "cadc1eebfdd4656d",
"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": 810,
"y": 280,
"wires": [
[
"2d096b4050ea3afe"
],
[
"23e5f12ae3656764"
],
[
"37da604146346f8a"
],
[
"6ad623671881c2d3"
]
]
},
{
"id": "2d096b4050ea3afe",
"type": "function",
"z": "cadc1eebfdd4656d",
"d": true,
"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,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1090,
"y": 240,
"wires": [
[
"e9e2151c014a6c02",
"727106b4582b5b76"
]
]
},
{
"id": "e9e2151c014a6c02",
"type": "mqtt out",
"z": "cadc1eebfdd4656d",
"name": "MQTT publish",
"topic": "",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "e6d88d966d10b464",
"x": 1400,
"y": 300,
"wires": []
},
{
"id": "ed9b0222422319f8",
"type": "influxdb out",
"z": "cadc1eebfdd4656d",
"influxdb": "6ca8bde.9eb2f44",
"name": "",
"measurement": "heishamon",
"precision": "",
"retentionPolicy": "",
"database": "Panasonic",
"retentionPolicyV18Flux": "",
"org": "",
"bucket": "",
"x": 1400,
"y": 520,
"wires": []
},
{
"id": "6ad623671881c2d3",
"type": "function",
"z": "cadc1eebfdd4656d",
"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": 1080,
"y": 520,
"wires": [
[
"ed9b0222422319f8"
]
]
},
{
"id": "37da604146346f8a",
"type": "function",
"z": "cadc1eebfdd4656d",
"d": true,
"name": "Prepare openHAB output",
"func": "if(msg.payload.HAid != null){\n //do something\n}\n\nreturn;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1090,
"y": 400,
"wires": [
[
"e9e2151c014a6c02",
"1da441b60282135d"
]
]
},
{
"id": "23e5f12ae3656764",
"type": "function",
"z": "cadc1eebfdd4656d",
"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,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1110,
"y": 320,
"wires": [
[
"e9e2151c014a6c02",
"727106b4582b5b76"
]
]
},
{
"id": "727106b4582b5b76",
"type": "debug",
"z": "cadc1eebfdd4656d",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1360,
"y": 400,
"wires": []
},
{
"id": "650f7b302372481d",
"type": "comment",
"z": "cadc1eebfdd4656d",
"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": 200,
"y": 160,
"wires": []
},
{
"id": "1da441b60282135d",
"type": "debug",
"z": "cadc1eebfdd4656d",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1350,
"y": 460,
"wires": []
},
{
"id": "2a988f17b8862789",
"type": "comment",
"z": "cadc1eebfdd4656d",
"name": "Send Heishamon to INFLUXdb",
"info": "",
"x": 420,
"y": 160,
"wires": []
},
{
"id": "e6d88d966d10b464",
"type": "mqtt-broker",
"name": "mosquitto rpi",
"broker": "192.168.0.90",
"port": "1883",
"clientid": "",
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"sessionExpiry": ""
},
{
"id": "6ca8bde.9eb2f44",
"type": "influxdb",
"hostname": "localhost",
"port": "8086",
"protocol": "https",
"database": "test",
"name": "DS220+ NAS",
"usetls": true,
"tls": "f7f39f4e.896ae",
"influxdbVersion": "1.8-flux",
"url": "http://192.168.0.201:8086",
"rejectUnauthorized": false,
"credentials": {}
},
{
"id": "f7f39f4e.896ae",
"type": "tls-config",
"name": "local-tls",
"cert": "",
"key": "",
"ca": "",
"certname": "",
"keyname": "",
"caname": "",
"verifyservercert": false
}
] |