Skip to content

Commit

Permalink
Merge pull request #1529 from okaegi/smart130
Browse files Browse the repository at this point in the history
smarthomehandler
  • Loading branch information
benderl committed Aug 20, 2021
2 parents 0ed5edb + a37cc9c commit 88f2f8f
Showing 1 changed file with 26 additions and 14 deletions.
40 changes: 26 additions & 14 deletions runs/smarthomehandler.py
Expand Up @@ -719,20 +719,32 @@ def getdevicevalues():
argumentList.append(device_actor)
argumentList.append(device_username)
argumentList.append(device_password)
proc=subprocess.Popen(argumentList)
proc.communicate()
f1 = open(basePath+'/ramdisk/smarthome_device_ret' +str(numberOfDevices) , 'r')
answerj=json.load(f1)
f1.close()
answer = json.loads(answerj)
wattstart = int(answer['power'])
wattkstart = int(answer['powerc'])
# bei laufender Anlauferkennung deivce nicht aktiv setzten
devstatus=getstat(numberOfDevices)
if (int(answer['on']) == 1) and (devstatus != 20):
relais=1
else:
relais=0
try:
proc=subprocess.Popen(argumentList)
proc.communicate()
except Exception as e:
DeviceValues.update( {str(numberOfDevices) : "error"})
logDebug(LOGLEVELERROR, "Device " + str(switchtyp) + str(numberOfDevices) + str(devicename) + " Fehlermeldung (zugriff watt.py): " + str(e))
try:
f1 = open(basePath+'/ramdisk/smarthome_device_ret' +str(numberOfDevices) , 'r')
answerj=json.load(f1)
f1.close()
except Exception as e:
DeviceValues.update( {str(numberOfDevices) : "error"})
logDebug(LOGLEVELERROR, "Device " + str(switchtyp) + str(numberOfDevices) + str(devicename) + " Fehlermeldung (zugriff return file (1)): " + str(e))
try:
answer = json.loads(answerj)
wattstart = int(answer['power'])
wattkstart = int(answer['powerc'])
# bei laufender Anlauferkennung deivce nicht aktiv setzten
devstatus=getstat(numberOfDevices)
if (int(answer['on']) == 1) and (devstatus != 20):
relais=1
else:
relais=0
except Exception as e:
DeviceValues.update( {str(numberOfDevices) : "error"})
logDebug(LOGLEVELERROR, "Device " + str(switchtyp) + str(numberOfDevices) + str(devicename) + " Fehlermeldung (zugriff return file (2)): " + str(e) + str(answerj))
#Shelly temp sensor
if (switchtyp == "shelly") and (canswitch == 1):
try:
Expand Down

0 comments on commit 88f2f8f

Please sign in to comment.