예제 #1
0
from hardware.mock_hardware import MockHardware
from networks.mock_network import MockNetwork
from scheduler.scheduler import Scheduler
from dispatcher.dispatcher import Dispatcher
from configuration.load import load_config
from runner.run import run

config = load_config()

run(debug=True,
    config=config,
    Hardware=MockHardware,
    Network=MockNetwork,
    Dispatcher=Dispatcher,
    Scheduler=Scheduler,
    frequency=1)
예제 #2
0
from hardware.hardware import Hardware
from networks.mock_network import MockNetwork
from scheduler.scheduler import Scheduler
from dispatcher.dispatcher import Dispatcher
from configuration.load import load_config
from runner.run import run

config = load_config('./config.cfg')

run(config=config,
    Hardware=Hardware,
    Network=MockNetwork,
    Dispatcher=Dispatcher,
    Scheduler=Scheduler)
예제 #3
0
#!/usr/bin/env python
import pika
from configuration.load import load_config

config = load_config('./config.local.cfg')

credentials = pika.PlainCredentials(config['username'], config['password'])
connection = pika.BlockingConnection(
    pika.ConnectionParameters(host=config['endpoint'],
                              credentials=credentials))
channel = connection.channel()

channel.queue_declare(queue='commands')

channel.basic_publish(exchange='',
                      routing_key='commands',
                      body='''
    {
        "commands": [
            {
                "duration": 1000,
                "start_offset": 0,
                "end_offset": 0,
                "color": {
                    "r": 100,
                    "g": 120,
                    "b": 250
                },
                "buzzer_pattern": "none"
            }
        ]