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
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
| # Intergas Xtend plugin, developed using Basic Python Plugin Example as provided by GizMoCuz
#
# author WillemD61
# version 1.0.1
# - removed double use of code 65c1 (device 9 and 15 in version 1.0.0.)
# - added description for Boiler status values (843a)
# - added error handling in case XTEND wifi connection not active
# - added code for generating default Dashticz config.js for dashboard
# version 1.0.2
# - added shorter polling intervals
# - replaced datapoint 8e38 by 7ee6, boiler temp
"""
<plugin key="IntergasXtend" name="Intergas Xtend heatpump" author="WillemD61" version="1.0.1" >
<description>
<h2>Intergas Xtend heatpump</h2><br/>
This plugin uses the API on the Intergas Xtend WIFI connection to get the values of a large numbers of parameters<br/>
and then load these values onto Domoticz devices. Devices will be created if they don't exists already.<br/><br/>
The Xtend WIFI connection needs to be active, indicated by a flashing purple LED light on the indoor unit.<br/>
(activation is done by pressing the button on the indoor unit).<br/>
Also the Domoticz server needs to be connected already to the active Xtend WIFI connection.<br/><br/>
A large number of devices is created, similar to the parameters shown in the Intergas web interface.<br/>
Also the Home Assistant integrations by DSchoutsen and thomasvt1 published on Github were used as input.<br/><br/>
Configuration options...
</description>
<params>
<param field="Mode1" label="Polling Interval" width="150px">
<options>
<option label="10 seconds" value="10" />
<option label="20 seconds" value="20" />
<option label="30 seconds" value="30" />
<option label="1 minute" value="60" default="true" />
<option label="2 minutes" value="120" />
<option label="3 minutes" value="180" />
<option label="4 minutes" value="240" />
<option label="5 minutes" value="300" />
</options>
</param>
</params>
</plugin>
"""
import DomoticzEx as Domoticz
import json,requests # make sure these are available in your system environment
from requests.exceptions import Timeout
# A dictionary to list all parameters to be retrieved from Xtend and to define the Domoticz devices to hold them.
# Temperature sensor are listed first but order of sensors is not important for the functioning of the program
# Make sure Unit numbers are incremental and make sure fieldcodes are correct!!!!
# currently only english name is provided, can be extended with other languages
# availability of some sensors values will depend on your boiler type and year
# Dictionary structure is as follows: fieldcode : [ Unit, Type, Subtype, Switchtype, OptionsList{}, Multiplier, Name ],
DEVSLIST={
# 80,5,0 : temperature devices
"79b3": [ 1, 80, 5, 0, {}, 0.01, "Room temp"],
"7921": [ 2, 80, 5, 0, {}, 0.01, "Target room temp"],
"6573": [ 3, 80, 5, 0, {}, 0.01, "Outside temp"],
"6280": [ 4, 80, 5, 0, {}, 0.01, "HP return temp"],
"62e7": [ 5, 80, 5, 0, {}, 0.01, "HP supply temp "],
"62ed": [ 6, 80, 5, 0, {}, 0.01, "HP setpoint temp"],
"65d9": [ 7, 80, 5, 0, {}, 0.01, "Exhaust gas temp"],
"6505": [ 8, 80, 5, 0, {}, 0.01, "Suction line gas temp"],
"47e0": [ 9, 243,19, 0, {}, 1, "Software version"], # added to replace unused device in version 1.0.0.
"6c26": [ 10, 80, 5, 0, {}, 0.01, "Condensor gas temp"],
"6ceb": [ 11, 80, 5, 0, {}, 0.01, "Condensor liquid temp"],
"6cfb": [ 12, 80, 5, 0, {}, 0.01, "Suction line overheat temp"],
"6c33": [ 13, 80, 5, 0, {}, 0.01, "Discharge overheat temp"],
"6c53": [ 14, 80, 5, 0, {}, 0.01, "Subcooling temp"],
"65c1": [ 15, 80, 5, 0, {}, 0.01, "Coil temp"],
# 243,9,0 : pressure devices
"844c": [ 22, 243, 9, 0, {}, 0.01, "CH water pressure"],
"6579": [ 23, 243, 9, 0, {}, 0.01, "HP suction pressure"],
"65b0": [ 24, 243, 9, 0, {}, 0.01, "HP discharge gas pressure"],
# 243,30,0 : flow devices
"629c": [ 26, 243, 30, 0, {}, 0.01, "HP CH flow"],
# 243,7,0 : fan device
"6c8a": [ 27, 243, 7, 0, {}, 1, "Fan speed"], # note multiplier 1
# 243,6,0 : percentage device
"62cb": [ 30, 243, 6, 0, {}, 0.01, "Pump level"],
# 243,31,0 : custom device
"65a7": [ 31, 243, 31, 0, {'Custom':'1;Hz'}, 0.01, "Compressor frequency"], # note options field sets the label for custom device
"71a7": [ 32, 243, 31, 0, {'Custom':'1;HR'}, 1, "HP poweron"],
# 113,0,3 : counter device
"6ac5": [ 33, 113, 0, 3, {'ValueQuantity':'Custom','ValueUnits':'HR'}, 1, "HP runtime"],
"6a8e": [ 36, 113, 0, 3, {}, 1, "HP Compressor starts"],
"7160": [ 37, 113, 0, 3, {}, 1, "HP power cycles"],
# 243,29,0 or 4: kwh device
"50f2": [ 43, 243, 29, 0, {'EnergyMeterMode': '1'}, 1, "HP energy usage"],
"5077": [ 44, 243, 29, 4, {'EnergyMeterMode': '1'}, 1, "HP energy generated"],
# 243,31,0 : custom device
"5041": [ 45, 243, 31, 0, {}, 0.1, "COP"],
# 243,19,0 : text device
"7e7a": [ 46, 243, 19, 0, {}, 1, "Burner status"],
"7e51": [ 47, 243, 19, 0, {}, 1, "Heatdemand status"],
"657e": [ 48, 243, 19, 0, {}, 1, "Operation mode"],
"6578": [ 49, 243, 19, 0, {}, 1, "Working mode"],
"777d": [ 50, 243, 19, 0, {}, 1, "Heatpump mode"],
"77dd": [ 51, 243, 19, 0, {}, 1, "System status"],
}
# define the url to get the Xtend field values
XtendIP="http://10.20.30.1" # the IP address of the Xtend indoor unit after activation by pressing the button
XtendAPI="/api/stats/values?fields=" # the API line to request field values
APIFieldsString="" # the list of field values to be requested in the url, based on the dictionary above
for Dev in DEVSLIST:
APIFieldsString+=Dev
APIFieldsString+=","
APIurl=XtendIP+XtendAPI+APIFieldsString
class XtendPlugin:
enabled = False
def __init__(self):
return
def onStart(self):
Domoticz.Log("onStart called")
Domoticz.Heartbeat(int(Parameters["Mode1"]))
self.Hwid=Parameters['HardwareID']
# cycle through device list and create any non-existing devices when the plugin/domoticz is started
for Dev in DEVSLIST:
Unit=DEVSLIST[Dev][0]
DeviceID="{:04x}{:04x}".format(self.Hwid,Unit)
Type=DEVSLIST[Dev][1]
Subtype=DEVSLIST[Dev][2]
Switchtype=DEVSLIST[Dev][3]
Options=DEVSLIST[Dev][4]
Name="XTEND: "+DEVSLIST[Dev][6]
Description="Xtend field code :"+Dev
if DeviceID not in Devices:
Domoticz.Status(f"Creating device for Field {Dev} ...")
if ((Type==243) and (Subtype==29)):
# below code puts an initial svalue on the kwh device and then changes the type to "computed". This is to work around a BUG in Domoticz for computed kwh devices. See issue 6194 on Github.
Domoticz.Unit(DeviceID=DeviceID,Unit=Unit, Name=Name, Type=Type, Subtype=Subtype, Switchtype=Switchtype, Options={}, Used=1, Description=Description).Create()
Devices[DeviceID].Units[Unit].sValue="0;0"
Devices[DeviceID].Units[Unit].Update()
Devices[DeviceID].Units[Unit].Options=Options
Devices[DeviceID].Units[Unit].Update(UpdateOptions=True)
else:
Domoticz.Unit(DeviceID=DeviceID,Unit=Unit, Name=Name, Type=Type, Subtype=Subtype, Switchtype=Switchtype, Options=Options, Used=1, Description=Description).Create()
for Dev in DEVSLIST:
Domoticz.Log("DEVSLIST "+str(DEVSLIST[Dev][0])+DEVSLIST[Dev][6])
self.createCONFIGJS()
def onStop(self):
Domoticz.Log("onStop called")
def onConnect(self, Connection, Status, Description):
Domoticz.Log("onConnect called")
def onMessage(self, Connection, Data):
Domoticz.Log("onMessage called")
def onCommand(self, DeviceID, Unit, Command, Level, Color):
Domoticz.Log("onCommand called for Device " + str(DeviceID) + " Unit " + str(Unit) + ": Parameter '" + str(Command) + "', Level: " + str(Level))
def onNotification(self, Name, Subject, Text, Status, Priority, Sound, ImageFile):
Domoticz.Log("Notification: " + Name + "," + Subject + "," + Text + "," + Status + "," + str(Priority) + "," + Sound + "," + ImageFile)
def onDisconnect(self, Connection):
Domoticz.Log("onDisconnect called")
def onHeartbeat(self):
Domoticz.Log("onHeartbeat called")
self.getXtendData()
def getXtendData(self):
Domoticz.Log("getXtendData called")
self.Hwid=Parameters['HardwareID']
try:
response=requests.get(APIurl, timeout=5)
if response.status_code==200:
responseJson=response.json()
Domoticz.Log(responseJson["stats"])
for Dev in DEVSLIST:
type=DEVSLIST[Dev][1]
subtype=DEVSLIST[Dev][2]
Unit=DEVSLIST[Dev][0]
DeviceID="{:04x}{:04x}".format(self.Hwid,Unit)
if Devices[DeviceID].Units[Unit].Used==1:
if ((type==80) or # temperature device
(type==113) or # counter device
((type==243) and (subtype==9)) or # pressure device
((type==243) and (subtype==30)) or # waterflow device
((type==243) and (subtype==7)) or # fan device
((type==243) and (subtype==6)) or # percentage device
((type==243) and (subtype==31)) # custom device
):
multiplier=DEVSLIST[Dev][5]
if multiplier==1:
fieldValue=round(float(multiplier*responseJson["stats"][Dev]),0)
else:
fieldValue=round(float(multiplier*responseJson["stats"][Dev]),1)
Devices[DeviceID].Units[Unit].nValue=fieldValue
Devices[DeviceID].Units[Unit].sValue=str(fieldValue)
Devices[DeviceID].Units[Unit].Update()
if ((type==243) and (subtype==29)): # kwh device
fieldValue=responseJson["stats"][Dev]
Devices[DeviceID].Units[Unit].nValue=0
Devices[DeviceID].Units[Unit].sValue=str(fieldValue)+";1" # watts are supplied, kwh are calculated by Domoticz.
Devices[DeviceID].Units[Unit].Update()
if ((type==243) and (subtype==19)): # text device
fieldValue=responseJson["stats"][Dev]
if Dev=="47e0":
Devices[DeviceID].Units[Unit].nValue=0
fieldText=fieldValue
else:
Devices[DeviceID].Units[Unit].nValue=fieldValue
fieldText=str(fieldValue)
if Dev=='777d':
if fieldValue==0: fieldText="DHW"
elif fieldValue==1: fieldText="HEATING"
elif fieldValue==2: fieldText="COOLING"
elif fieldValue==253: fieldText="PUMPDOWN"
elif fieldValue==254: fieldText="OFF"
elif fieldValue==255: fieldText="UNDEFINED"
else: fieldText="Unknown, value: "+str(fieldValue)
if Dev=='77dd':
if fieldValue==0: fieldText="MONITOR_LOCKOUT"
elif fieldValue==1: fieldText="PUMP_VENTING"
elif fieldValue==2: fieldText="SERVICE"
elif fieldValue==3: fieldText="DEFROST"
elif fieldValue==4: fieldText="DHW"
elif fieldValue==5: fieldText="ROOMHEATING_COMFORT"
elif fieldValue==6: fieldText="ROOMHEATING_ECO"
elif fieldValue==7: fieldText="ROOMCOOLING"
elif fieldValue==8: fieldText="DHW_HEATEXCHANGE"
elif fieldValue==9: fieldText="FLOORHEATINGPROTOCOL"
elif fieldValue==12: fieldText="ANTIFREEZE"
elif fieldValue==13: fieldText="PUMP_MAINTENANCE"
elif fieldValue==14: fieldText="IDLE"
elif fieldValue==255: fieldText="NO_TASK"
else: fieldText="Unknown, value: "+str(fieldValue)
if Dev=='6578':
if fieldValue==0: fieldText="COOLING"
elif fieldValue==1: fieldText="HEATING"
elif fieldValue==2: fieldText="DEFROSTING"
elif fieldValue==3: fieldText="PUMPDOWN"
elif fieldValue==255: fieldText="UNDEFINED"
else: fieldText="Unknown, value: "+str(fieldValue)
if Dev=='657e':
if fieldValue==0: fieldText="DHW"
elif fieldValue==1: fieldText="HEATING"
elif fieldValue==2: fieldText="COOLING"
elif fieldValue==253: fieldText="PUMPDOWN"
elif fieldValue==254: fieldText="OFF"
elif fieldValue==255: fieldText="UNDEFINED"
else: fieldText="Unknown, value: "+str(fieldValue)
if Dev=='7e51':
if fieldValue==0: fieldText="OPENTHERM"
elif fieldValue==15: fieldText="BOILER_EXT"
elif fieldValue==24: fieldText="FROST"
elif fieldValue==37: fieldText="CH_RF"
elif fieldValue==51: fieldText="DHW_INT"
elif fieldValue==85: fieldText="SENSORTEST"
elif fieldValue==86: fieldText="COMMISSIONING"
elif fieldValue==87: fieldText="CRANKHEATING"
elif fieldValue==102: fieldText="CH"
elif fieldValue==103: fieldText="CH_WAIT"
elif fieldValue==104: fieldText="DEFROSTING"
elif fieldValue==117: fieldText="STARTING_COOLING"
elif fieldValue==118: fieldText="COOLING"
elif fieldValue==119: fieldText="COOLING_WAIT"
elif fieldValue==126: fieldText="STANDBY"
elif fieldValue==127: fieldText="OFF"
elif fieldValue==153: fieldText="POSTRUN_BOILER"
elif fieldValue==170: fieldText="SERVICE"
elif fieldValue==189: fieldText="POSTRUN_COOLING"
elif fieldValue==204: fieldText="DHW"
elif fieldValue==205: fieldText="DHW_HRECO"
elif fieldValue==230: fieldText="STARTING_CH"
elif fieldValue==231: fieldText="POSTRUN_CH"
elif fieldValue==240: fieldText="BOILER_INT"
elif fieldValue==255: fieldText="HEATUP"
else: fieldText="Unknown, value: "+str(fieldValue)
if Dev=='7e7a':
if fieldValue==0: fieldText="STARTUP"
elif fieldValue==1: fieldText="INTERPURGE"
elif fieldValue==2: fieldText="POSTPURGE"
elif fieldValue==4: fieldText="PREPURGE"
elif fieldValue==8: fieldText="IGNITION"
elif fieldValue==16: fieldText="WAITING"
elif fieldValue==32: fieldText="RUNNING"
elif fieldValue==64: fieldText="REST"
elif fieldValue==128: fieldText="LOCKOUT"
else: fieldText="Unknown, value: "+str(fieldValue)
if Dev=='843a':
if fieldValue==0: fieldText="OFF"
elif fieldValue==12: fieldText="DHW"
else: fieldText="Unknown, value: "+str(fieldValue)
Devices[DeviceID].Units[Unit].sValue=fieldText
Devices[DeviceID].Units[Unit].Update()
else:
raise Exception
except Timeout:
Domoticz.Error("Timeout on getting Xtend data. Check connection.")
except:
Domoticz.Error("No proper Xtend data received. Check connection.")
def createCONFIGJS(self): # create a default CONFIG.js file for a Dashticz dashboard
try:
fileHandle=open("DASHTICZCONFIG.js","w")
# file heading
print("var config = {}",file=fileHandle)
print("config['language'] = 'en_US'; //or: nl_NL, en_US, de_DE, fr_FR, hu_HU, it_IT, pt_PT, sv_SV",file=fileHandle)
print("config['domoticz_ip'] = 'http://xxx.xxx.xxx.xxx:port';",file=fileHandle)
print("config['domoticz_refresh'] = '5';",file=fileHandle)
print("config['dashticz_refresh'] = '60';",file=fileHandle)
# blocks
print("//Definition of blocks",file=fileHandle)
print("blocks = {}",file=fileHandle)
for Dev in DEVSLIST:
Unit=DEVSLIST[Dev][0]
DeviceID="{:04x}{:04x}".format(self.Hwid,Unit)
if (Devices[DeviceID].Units[Unit].Type==113 or (Devices[DeviceID].Units[Unit].Type==243 and Devices[DeviceID].Units[Unit].SubType==29)):
print("blocks["+"\'"+str(Devices[DeviceID].Units[Unit].ID)+"_1\'] = {",file=fileHandle)
else:
print("blocks["+str(Devices[DeviceID].Units[Unit].ID)+"] = {",file=fileHandle)
print(" last_update:false,",file=fileHandle)
print(" width: 12",file=fileHandle)
print("}",file=fileHandle)
# columns
print("//Definition of columns",file=fileHandle)
print("columns = {}",file=fileHandle)
print("columns[\"xtendsummary\"] = {",file=fileHandle)
print(" blocks : [",end=" ",file=fileHandle)
for Unit in [1,2,3,47,49,48,51,50,9]:
DeviceID="{:04x}{:04x}".format(self.Hwid,Unit)
if (Devices[DeviceID].Units[Unit].Type==113 or (Devices[DeviceID].Units[Unit].Type==243 and Devices[DeviceID].Units[Unit].SubType==29)):
DomoticzID="\'"+str(Devices[DeviceID].Units[Unit].ID)+"_1\'"
else:
DomoticzID=str(Devices[DeviceID].Units[Unit].ID)
print(DomoticzID,end=",",file=fileHandle)
print("],",file=fileHandle)
print(" width: 2",file=fileHandle)
print("}",file=fileHandle)
print("columns[\"xtendtoday\"] = {",file=fileHandle)
print(" blocks : [",end=" ",file=fileHandle)
for Unit in [22,32,33,36,37,38,43,44,45]:
DeviceID="{:04x}{:04x}".format(self.Hwid,Unit)
if (Devices[DeviceID].Units[Unit].Type==113 or (Devices[DeviceID].Units[Unit].Type==243 and Devices[DeviceID].Units[Unit].SubType==29)):
DomoticzID="\'"+str(Devices[DeviceID].Units[Unit].ID)+"_1\'"
else:
DomoticzID=str(Devices[DeviceID].Units[Unit].ID)
print(DomoticzID,end=",",file=fileHandle)
print("],",file=fileHandle)
print(" width: 2",file=fileHandle)
print("}",file=fileHandle)
print("columns[\"xtendactual1\"] = {",file=fileHandle)
print(" blocks : [",end=" ",file=fileHandle)
for Unit in [6,5,4,7,8,10,11,12,13]:
DeviceID="{:04x}{:04x}".format(self.Hwid,Unit)
if (Devices[DeviceID].Units[Unit].Type==113 or (Devices[DeviceID].Units[Unit].Type==243 and Devices[DeviceID].Units[Unit].SubType==29)):
DomoticzID="\'"+str(Devices[DeviceID].Units[Unit].ID)+"_1\'"
else:
DomoticzID=str(Devices[DeviceID].Units[Unit].ID)
print(DomoticzID,end=",",file=fileHandle)
print("],",file=fileHandle)
print(" width: 2",file=fileHandle)
print("}",file=fileHandle)
print("columns[\"xtendactual2\"] = {",file=fileHandle)
print(" blocks : [",end=" ",file=fileHandle)
for Unit in [14,15,23,24,27,30,26,31]:
DeviceID="{:04x}{:04x}".format(self.Hwid,Unit)
if (Devices[DeviceID].Units[Unit].Type==113 or (Devices[DeviceID].Units[Unit].Type==243 and Devices[DeviceID].Units[Unit].SubType==29)):
DomoticzID="\'"+str(Devices[DeviceID].Units[Unit].ID)+"_1\'"
else:
DomoticzID=str(Devices[DeviceID].Units[Unit].ID)
print(DomoticzID,end=",",file=fileHandle)
print("],",file=fileHandle)
print(" width: 2",file=fileHandle)
print("}",file=fileHandle)
print("columns[\"boileractual1\"] = {",file=fileHandle)
print(" blocks : [",end=" ",file=fileHandle)
for Unit in [34,35,39,40,52,46,41,42]:
DeviceID="{:04x}{:04x}".format(self.Hwid,Unit)
if (Devices[DeviceID].Units[Unit].Type==113 or (Devices[DeviceID].Units[Unit].Type==243 and Devices[DeviceID].Units[Unit].SubType==29)):
DomoticzID="\'"+str(Devices[DeviceID].Units[Unit].ID)+"_1\'"
else:
DomoticzID=str(Devices[DeviceID].Units[Unit].ID)
print(DomoticzID,end=",",file=fileHandle)
print("],",file=fileHandle)
print(" width: 2",file=fileHandle)
print("}",file=fileHandle)
print("columns[\"boileractual2\"] = {",file=fileHandle)
print(" blocks : [",end=" ",file=fileHandle)
for Unit in [16,17,18,19,28,29,20,21,25]:
DeviceID="{:04x}{:04x}".format(self.Hwid,Unit)
if (Devices[DeviceID].Units[Unit].Type==113 or (Devices[DeviceID].Units[Unit].Type==243 and Devices[DeviceID].Units[Unit].SubType==29)):
DomoticzID="\'"+str(Devices[DeviceID].Units[Unit].ID)+"_1\'"
else:
DomoticzID=str(Devices[DeviceID].Units[Unit].ID)
print(DomoticzID,end=",",file=fileHandle)
print("],",file=fileHandle)
print(" width: 2",file=fileHandle)
print("}",file=fileHandle)
# screens
print("//Definition of screens",file=fileHandle)
print("screens = {}",file=fileHandle)
print("screens[1] = {",file=fileHandle) # change this screen number if you already have existing dashticz screens
print(" columns: [\"xtendsummary\",\"xtendtoday\",\"xtendactual1\",\"xtendactual2\",\"boileractual1\",\"boileractual2\"]",file=fileHandle)
print("}",file=fileHandle)
fileHandle.close()
except:
Domoticz.Error("ERROR: problem creating default Dashticz CONFIG.js")
fileHandle.close()
global _plugin
_plugin = XtendPlugin()
def onStart():
global _plugin
_plugin.onStart()
def onStop():
global _plugin
_plugin.onStop()
def onConnect(Connection, Status, Description):
global _plugin
_plugin.onConnect(Connection, Status, Description)
def onMessage(Connection, Data):
global _plugin
_plugin.onMessage(Connection, Data)
def onCommand(DeviceID, Unit, Command, Level, Color):
global _plugin
_plugin.onCommand(DeviceID, Unit, Command, Level, Color)
def onNotification(Name, Subject, Text, Status, Priority, Sound, ImageFile):
global _plugin
_plugin.onNotification(Name, Subject, Text, Status, Priority, Sound, ImageFile)
def onDisconnect(Connection):
global _plugin
_plugin.onDisconnect(Connection)
def onHeartbeat():
global _plugin
_plugin.onHeartbeat()
# Generic helper functions
def DumpConfigToLog():
for x in Parameters:
if Parameters[x] != "":
Domoticz.Debug( "'" + x + "':'" + str(Parameters[x]) + "'")
Domoticz.Debug("Device count: " + str(len(Devices)))
for DeviceName in Devices:
Device = Devices[DeviceName]
Domoticz.Debug("Device ID: '" + str(Device.DeviceID) + "'")
Domoticz.Debug("--->Unit Count: '" + str(len(Device.Units)) + "'")
for UnitNo in Device.Units:
Unit = Device.Units[UnitNo]
Domoticz.Debug("--->Unit: " + str(UnitNo))
Domoticz.Debug("--->Unit Name: '" + Unit.Name + "'")
Domoticz.Debug("--->Unit nValue: " + str(Unit.nValue))
Domoticz.Debug("--->Unit sValue: '" + Unit.sValue + "'")
Domoticz.Debug("--->Unit LastLevel: " + str(Unit.LastLevel))
return |