ensure wire stays not under strain

This commit is contained in:
Thomas Klaehn 2016-12-23 13:18:28 +01:00 committed by Thomas Klaehn
parent 5fe02f2ae3
commit 4413446485
3 changed files with 11 additions and 1 deletions

View File

@ -4,6 +4,7 @@ Created on Dec 23, 2016
@author: klaehn @author: klaehn
''' '''
import sys import sys
from time import sleep
from data_buffer import DataBuffer from data_buffer import DataBuffer
from gate.gate_handler import GateHandler from gate.gate_handler import GateHandler
@ -28,6 +29,8 @@ def main(argv):
print "average power: " + str(average) + " mW" print "average power: " + str(average) + " mW"
if average != None: if average != None:
if average > MAX_ENGINE_POWER["down"]: if average > MAX_ENGINE_POWER["down"]:
gate_handler.open()
sleep(2)
gate_handler.stop() gate_handler.stop()
print "Gate successfully closed" print "Gate successfully closed"
return 0 return 0

View File

@ -3,7 +3,7 @@ Created on Dec 19, 2016
@author: klaehn @author: klaehn
''' '''
from time import time from time import time, sleep
from communiate.protocol import mqtt from communiate.protocol import mqtt
from data_buffer import DataBuffer from data_buffer import DataBuffer
from light_sensor.light_sensor import light_sensor from light_sensor.light_sensor import light_sensor
@ -91,6 +91,8 @@ class GateState(object):
def __opened_handler(self, light_avg): def __opened_handler(self, light_avg):
next_state = self.__next_state next_state = self.__next_state
if self.__is_transition(): if self.__is_transition():
self.__gate_handler.close()
sleep(2)
self.__gate_handler.stop() self.__gate_handler.stop()
self.__comserver.transmit(MQTT_TOPIC, str(time()) + " Opened " + \ self.__comserver.transmit(MQTT_TOPIC, str(time()) + " Opened " + \
str(self.__power_data.average()) + " mW") str(self.__power_data.average()) + " mW")
@ -105,6 +107,8 @@ class GateState(object):
def __closed_handler(self, light_avg): def __closed_handler(self, light_avg):
next_state = self.__next_state next_state = self.__next_state
if self.__is_transition(): if self.__is_transition():
self.__gate_handler.open()
sleep(2)
self.__gate_handler.stop() self.__gate_handler.stop()
self.__comserver.transmit(MQTT_TOPIC, str(time()) + " Closed " + \ self.__comserver.transmit(MQTT_TOPIC, str(time()) + " Closed " + \
str(self.__power_data.average()) + " mW") str(self.__power_data.average()) + " mW")

View File

@ -4,6 +4,7 @@ Created on Dec 23, 2016
@author: klaehn @author: klaehn
''' '''
import sys import sys
from time import sleep
from data_buffer import DataBuffer from data_buffer import DataBuffer
from gate.gate_handler import GateHandler from gate.gate_handler import GateHandler
@ -28,6 +29,8 @@ def main(argv):
print "average power: " + str(average) + " mW" print "average power: " + str(average) + " mW"
if average != None: if average != None:
if average > MAX_ENGINE_POWER["up"]: if average > MAX_ENGINE_POWER["up"]:
gate_handler.close()
sleep(2)
gate_handler.stop() gate_handler.stop()
print "Gate successfully opened" print "Gate successfully opened"
return 0 return 0