Vad är felet? Python
Posted: Tue 22 Sep 2015, 11:58
Hallå gott folk!
Har suttit och knåpat lite med ett Pythonscript. Får inte detta att fungera. När samtliga värden är enligt mitt script så fär jag ändå inte mitt resultat att bli aktivt. Kan inte förstå varför...?
Har suttit och knåpat lite med ett Pythonscript. Får inte detta att fungera. När samtliga värden är enligt mitt script så fär jag ändå inte mitt resultat att bli aktivt. Kan inte förstå varför...?
Code: Select all
try:
dummy
#print systemState
except NameError:
dummy = 0
systemState = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] #initierar status för datakällorna
#sätter status för datakällorna
if eg.event.string.find('house:13619034;unit:10;group:0;method:turnon')>0:
systemState[0] = 1 #RV Trappa
if eg.event.string.find('house:13619034;unit:10;group:0;method:turnoff')>0:
systemState[0] = 0 #RV Trappa
if eg.event.string.find('house:13619034;unit:10;group:0;method:turnon')>0:
systemState[1] = 1 #RV Trappa
if eg.event.string.find('OffDelay.RV_Stairs_Off')>0:
systemState[1] = 0 #RV Trappa
if eg.event.string.find('house:15137702;unit:10;group:0;method:turnon')>0:
systemState[2] = 1 #RV Kök
if eg.event.string.find('house:15137702;unit:10;group:0;method:turnoff')>0:
systemState[2] = 0 #RV Kök
if eg.event.string.find('house:15137702;unit:10;group:0;method:turnon')>0:
systemState[3] = 1 #RV Kök
if eg.event.string.find('OffDelay.RV_Kitchen_Off')>0:
systemState[3] = 0 #RV Kök
if eg.event.string.find('house:15663946;unit:10;group:0;method:turnon')>0:
systemState[4] = 1 #RV Vardagsrum
if eg.event.string.find('house:15663946;unit:10;group:0;method:turnoff')>0:
systemState[4] = 0 #RV Vardagsrum
if eg.event.string.find('house:15663946;unit:10;group:0;method:turnon')>0:
systemState[5] = 1 #RV Vardagsrum
if eg.event.string.find('OffDelay.RV_Livingroom_Off')>0:
systemState[5] = 0 #RV Vardagsrum
if eg.event.string.find('house:15281850;unit:10;group:0;method:turnon')>0:
systemState[6] = 1 #RV Toalett
if eg.event.string.find('house:15281850;unit:10;group:0;method:turnoff')>0:
systemState[6] = 0 #RV Toalett
if eg.event.string.find('house:15281850;unit:10;group:0;method:turnon')>0:
systemState[7] = 1 #RV Toalett
if eg.event.string.find('OffDelay.RV_Toilet_Off')>0:
systemState[7] = 0 #RV Toalett
if eg.event.string.find('house:13545650;unit:2;group:0;method:turnon')>0:
systemState[8] = 1 #LARM
if eg.event.string.find('house:13545650;unit:2;group:0;method:turnoff')>0:
systemState[8] = 0 #LARM
if eg.event.string.find('OnDelay.Larm_On')>0:
systemState[9] = 1 #LARM EG
if eg.event.string.find('OffDelay.Larm_Off')>0:
systemState[9] = 0 #LARM EG
if eg.event.string.find('house:15630902;unit:10;group:0;method:turnon')>0:
systemState[10] = 1 #SOVRUMSDÖRR
if eg.event.string.find('house:15630902;unit:10;group:0;method:turnoff')>0:
systemState[10] = 0 #SOVRUMSDÖRR
if eg.event.string.find('OnDelay.Door_Open')>0:
systemState[11] = 1 #SOVRUMSDÖRR
if eg.event.string.find('OffDelay.Door_Closed')>0:
systemState[11] = 0 #SOVRUMSDÖRR
if eg.event.string.find('house:14394510;unit:1;group:0;method:turnon')>0:
systemState[12] = 1 #LABB1
if eg.event.string.find('house:14394510;unit:1;group:0;method:turnoff')>0:
systemState[12] = 0 #LABB1
#utvärderar systemstatus och sätter datakälla i SK
#print systemState
#systemState[0] == 0 and systemState[1] == 0 and systemState[2] == 0 and systemState[3] == 0 and
if ((systemState[0] == 0 and systemState[1] == 0) and (systemState[2] == 0 and systemState[3] == 0) and (systemState[4] == 0 and systemState[5] == 0) and (systemState[6] == 0 and systemState[7] == 0) and (systemState[8] == 1 and systemState[9] == 0) and (systemState[10] == 1 and systemState[11] == 1)):
eg.plugins.SwitchkingTellStick.DSSet(u'Scenario BORTA: TurnOn', u'Scenario BORTA', u'TurnOn', 0)
if (systemState[8] == 0):
eg.plugins.SwitchkingTellStick.DSSet(u'Scenario BORTA: TurnOff', u'Scenario BORTA', u'TurnOff', 0)