示例#1
0
 def sendRequest(self):
     self.setBody()
     url = config.getHostname() + ":" + config.getPort() + self.path
     r = requests.request(method=self.method,
                          url=url,
                          headers=self.header,
                          json=self.body)
     self.statusCode = r.status_code
     self.responseHeaders = r.headers
     self.responseBody = r.json()
示例#2
0
import time
import sys
import socket
import logging

# for midi generation
from pyo import *
import random

# the config and mqtt modules are in a bad place atm :/
import sys
sys.path.append('./mqtt/')
import config
import mqtt

myHostname = config.getHostname()
deploymenttype = config.getDeploymentType()
DEVICENAME = config.getDevicename()

mqttHost = config.getValue("mqtthostname", "localhost")
hostmqtt = mqtt.MQTT(mqttHost, myHostname, DEVICENAME)
hostmqtt.loop_start()  # use the background thread

sounddir = config.getValue("sounddir", "../../sounds/")
testsound = config.getValue("testsound", "test.wav")

isMuted = False


def main():
    s = Server(duplex=0)
示例#3
0
import yaml
import time
import argparse
import logging
import os

# the config and mqtt modules are in a bad place atm :/
import sys
sys.path.append('./mqtt/')
import config
import mqtt
import subprocess

DEVICENAME = "deployment"
myHostname = config.getHostname(False)

mqttHost = config.getValue("mqtthostname", "localhost")
for i in range(0, 25):
    time.sleep(1)
    response = os.system("ping -c 1 " + mqttHost)
    if response == 0:
        break
    logging.info("Waiting for %s: attempt %s" % (mqttHost, i))

mqttMasterHost = config.getValue("mqttmaster", "")
if mqttMasterHost != "":
    for i in range(0, 25):
        time.sleep(1)
        response = os.system("ping -c 1 " + mqttMasterHost)
        if response == 0: