class Pimotica(): bus = None config = None def __init__(self): self.bus = Bus() def start(self): self.config = self.loadConfig() self.bus.addDevice( TemperaturesensorDevice('inside temperature sensor')) def loadConfig(self): """Load the configuration and return it""" # TODO load from file #return {'devices': {'inside/temperature': {'type'}}} pass
class ServiceBus(object): def __init__(self, url=""): self._bus = Bus(url) def send(self, event, message): self._bus.send(event, message) def listen(self, event, callback): self._bus.listen(event, callback) def publish(self, event, message): self._bus.publish(event, message) def subscribe(self, event, callback): self._bus.subscribe(event, callback)
def __init__(self): self.bus = Bus()
def __init__(self, url=""): self._bus = Bus(url)