import sys import socket import traceback allMuted = False repeats = {} # the config and mqtt modules are in a bad place atm :/ import sys sys.path.append('./mqtt/') import mqtt import config mqttHost = config.getValue("mqtthostname", "mqtt") myHostname = config.getValue("hostname", socket.gethostname()) hostmqtt = mqtt.MQTT(mqttHost, myHostname, "controller") currentState = "NEWNEWNEW" #config.getValue("start_state", "PodiumX") # end load config ############ def muteAll(): hostmqtt.publishL("all", "audio", "mute", {}) ############ def unMuteAll(): hostmqtt.publishL("all", "audio", "unmute", {})
import traceback from time import sleep allMuted = False repeats = {} # the config and mqtt modules are in a bad place atm :/ import sys sys.path.append('./mqtt/') import mqtt import config myHostname = config.getValue("hostname", socket.gethostname()) master_mqtt_host = config.getValue("mqttmaster", "mqtt.thegame.folly.site") mastermqtt = mqtt.MQTT(master_mqtt_host, myHostname, "relay_to", "everyone", "S4C7Tzjc2gD92y9", 1883) #mastermqtt.loop_start() # use the background thread # end load config mastermqtt.status({"status": "listening"}) mastermqtt.publish("hello", {"once": "we"}) try: #while True: # sleep(1) mastermqtt.loop_forever() except Exception as ex: traceback.print_exc() except KeyboardInterrupt: print("exit")
try: mydmx = pysimpledmx.DMXConnection("/dev/ttyUSB2") except: logging.info("DMX failed on USB2") try: mydmx = pysimpledmx.DMXConnection("/dev/ttyUSB3") except: logging.info("DMX failed on USB3") try: mydmx = pysimpledmx.DMXConnection("/dev/ttyUSB4") except: logging.info("DMX failed on USB4") mqttHost = config.getValue("mqtthostname", "localmqttforsure") myHostname = config.getValue("hostname", socket.gethostname()) hostmqtt = mqtt.MQTT(mqttHost, myHostname, "relay_from") #hostmqtt.loop_start() # use the background thread #master_mqtt_host = config.getValue("mqttmaster", "mqtt.thegame.folly.site") #mastermqtt = mqtt.MQTT(master_mqtt_host, myHostname, "relay_to", "everyone", "S4C7Tzjc2gD92y9", 1883) def stopthathorribleflashing(): logging.info("stoppit") for i in range(2, 500): mydmx.setChannel(i, 0) mydmx.render() def stopthatdmxthing(dmxChannel): logging.info("stop %s" % (dmxChannel))
# the config and mqtt modules are in a bad place atm :/ import sys sys.path.append('./mqtt/') import mqtt import config sleep(5) myHostname = config.getHostname() deploymenttype = config.getDeploymentType() DEVICENAME = config.getDevicename() mqttHost = config.getValue("mqtthostname", "localhost") if mqttHost == "mqtt.thegame.folly.site": hostmqtt = mqtt.MQTT(mqttHost, myHostname, DEVICENAME, "everyone", "S4C7Tzjc2gD92y9", 8883) else: hostmqtt = mqtt.MQTT(mqttHost, myHostname, DEVICENAME) hostmqtt.loop_start() # use the background thread master_mqtt_host = config.getValue("mqttmaster", "mqtt.thegame.folly.site") mastermqtt = mqtt.MQTT(master_mqtt_host, myHostname, "relay_to", "everyone", "S4C7Tzjc2gD92y9", 8883) #mastermqtt.loop_start() # use the background thread # end load config ############ def muteAll():
allMuted = False repeats = {} # the config and mqtt modules are in a bad place atm :/ import sys sys.path.append('./mqtt/') import mqtt import config import datetime mqttHost = config.getValue("mqtthostname", "mqtt") myHostname = config.getValue("hostname", socket.gethostname()) hostmqtt = mqtt.MQTT(mqttHost, myHostname, "ThingMagic") # see https://github.com/gotthardp/python-mercuryapi import mercury # end load config ######################################## def rfidTagDataCallback(rfid): try: event = { 'atr': rfid.epc_mem_data, 'tag': rfid.epc.hex(), 'rssi': rfid.rssi, 'event': 'inserted'
allMuted = False repeats = {} # the config and mqtt modules are in a bad place atm :/ import sys sys.path.append('./mqtt/') import mqtt import config import datetime myHostname = config.getHostname() deploymenttype = config.getDeploymentType() DEVICENAME = config.getDevicename() mqttHost = config.getValue("mqtthostname", "localhost") hostmqtt = mqtt.MQTT(mqttHost, myHostname, DEVICENAME) hostmqtt.loop_start() # see https://github.com/gotthardp/python-mercuryapi import mercury # end load config ######################################## lastRead = {} def rfidTagDataCallback(rfid): try: #if rfid.epc.hex() in lastRead: if rfid.epc in lastRead: