""" https://devhub.io/repos/UniPiTechnology-evok """ from jsonrpclib import Server s = Server("http://192.168.1.233:8080/rpc") for state in range(0, 2): for i in range(1, 9): s.relay_set(i, state) print(s.relay_get(i))
CFG = os.path.dirname(os.path.abspath(__file__)) + CFG_PATH + CFG_FILE OB = OpenBCcfg(CFG) OB.readConfigFile() # Read config file. time.sleep(2) S = Server(OB.EVOK_URL) # Connection to evok api TIMESTAMP_CFG = time.ctime(os.path.getmtime(CFG)) TEMP_SCREW_BLOCK_TIMER = time.time() # Read current time, need this for screw controll TEMP_LOG_BLOCK_TIMER = time.time() TIME_LEFT_OF_BLOCK_TIMER = 0 # Make sure all relay is deactivated for x in xrange(1,9): S.relay_set(x, 0) # Init Log (/tmp/openBC.log) logging.basicConfig(filename=OB.LOG_BASE_DIR + OB.LOG_FILE_NAME, format='%(asctime)s %(levelname)s %(message)s', level=logging.DEBUG) logging.info('%s', 'Start!') # Create instances. TANK = TempSensor(S, OB.TANK_TEMP_SENSOR_ID) BOILER = TempSensor(S, OB.BOILER_TEMP_SENSOR_ID) # FALLBACK_TEMP = TempSensor(S, "286B075005000099") FIRE = FireSensor(S, OB.FIRE_TEMP_SENSOR_ANALOG_PIN) FAN = AnalogOut(S, OB.FAN_CONTACTOR_PIN, OB.FAN_ANALOG_PIN) SOND = SerialLambda(S, OB.LAMBDA_SENSOR_CONTACTOR_PIN, OB.LAMBDA_SENSOR_TYPE, OB.LAMBDA_SENSOR_PORT, OB.LAMBDA_SENSOR_BAUD, int(OB.LAMBDA_SENSOR_SYNC_HEADER_ATTEMPT)) SCREW = Screw(S, OB.SCREW_CONTACTOR_PIN) HMI = Hmi(S, OB.BUTTON_CONTACTOR_PIN)