-
Notifications
You must be signed in to change notification settings - Fork 16
InfoType 15 DIO/EDISON by chacon #88
Description
Hello.
I just added the infotype15 to your plugin, for the support of remote EDISIO / DIO.
I have tested it and is functional, can you have other modifications to make, I even add the state of the remote control battery to view or manage a battery replacement alarm.
The id of the device is completed by the button nuemro of the remote control
Add in line 164:
if infoType == "15":
Options = {"infoType":infoType, "id": str(id), "protocol": str(protocol), "frequency":"868950"}
stype=0
ad line 312:
###########
#infotype15 ==> ok
#ReqRcv=' ZIA33{ "frame" :{"header": {"frameType": "0", "cluster": "0", "dataFlag": "1", "rfLevel": "-80", "floorNoise": "-79", "rfQuality": "2", "protocol": "16", "protocolMeaning": "EDISIO", "infoType": "15", "frequency": "868350"},"infos": {"subType": "3", "subTypeMeaning": "TOGGLE", "id": "3765014356", "qualifier": "1", "info": "6913", "infoMeaning": "EMITRBTN, 2.7V", "add0": "0", "add1": "0"}}}'
###########
ad line 477:
##############################################################################################################
#####################################Frame infoType 15 EDISIO/DIO REMOTE ####################
##############################################################################################################
if infoType == "15":
DecodeInfoType15(DecData, infoType)
add to the end :
def DecodeInfoType15(DecData, infoType):
try :
IsCreated=False
x=0
# New device will start at 1 or at last + 1
nbrdevices=0
protocol = DecData['frame']['header']['protocol']
SubType = DecData['frame']['infos']['subType']
Batt = float((DecData['frame']['infos']['infoMeaning'])[10:13])
Battery=int(float((Batt-2)*100))
######### "qualifier" is the pressed button number ####################
qualifier = DecData['frame']['infos']['qualifier']
id = DecData['frame']['infos']['id'] + "_" + str(qualifier)
Domoticz.Debug("id : " + str(id) + " Button : " + str(qualifier) + " - " + str(Batt))
Options = {"infoType": infoType, "id": str(id), "protocol": str(protocol)}
Domoticz.Debug("Options to find or set : " + str(Options))
filters = ('id', 'protocol', 'infoType', 'function')
#########check if devices exist ####################
for x in Devices:
#JJE - start
DOptions = Devices[x].Options
# if Devices[x].Options == Options :
if {k: DOptions.get(k, None) for k in filters} == {k: Options.get(k, None) for k in filters}:
#JJE - end
IsCreated = True
nbrdevices=x
Domoticz.Log("Device already exists. Unit=" + str(x))
Domoticz.Debug("Options found in DB: " + str(Devices[x].Options) + " for devices unit " + str(x))
########### create device if not find ###############
if IsCreated == False and Parameters["Mode4"] == "True" :
nbrdevices=FreeUnit()
Domoticz.Device(Name=protocol + " - " + id, Unit=nbrdevices, Type=244, Subtype=73, Switchtype=0).Create()
Devices[nbrdevices].Update(nValue = 0, sValue = str(1),BatteryLevel = Battery, Options = Options)
elif IsCreated == True :
############ update device if found###################
Devices[nbrdevices].Update(nValue = 0, sValue = str(1), BatteryLevel = Battery)
except Exception as e:
Domoticz.Log("Error while decoding Infotype15 frame " + repr(e))
return