import signal import sys from concierge_python.concierge import Concierge from conciergeMatrix import ConciergeMatrix from remote import Remote if __name__ == "__main__": def sig_handler(sig, frame): c.disconnect() m.stop() if r: r.stop() sys.exit(0) site_id = 'default' site_id = 'remote' MQTT_IP_ADDR = "raspi-mika.local" signal.signal(signal.SIGINT, sig_handler) c = Concierge(MQTT_IP_ADDR, site_id, False) m = ConciergeMatrix(site_id, c) r = None try: r = Remote(site_id, c) r.start() except: print("error occured") pass c.loop_forever()
from hermes_python.hermes import Hermes MQTT_IP_ADDR = "localhost" MQTT_PORT = 1883 MQTT_ADDR = "{}:{}".format(MQTT_IP_ADDR, str(MQTT_PORT)) lang = "EN" def setAlarm(hermes, intent_message): every = Extract.value(intent_message.slots.recurrence, None) is not None day = Extract.value(intent_message.slots.weekday) time = Extract.timeSlot(intent_message.slots.time) siteId = intent_message.site_id room = Extract.value(intent_message.slots.timer_room, "bedRoom") hermes.alarm.add(every, time, day, siteId, room) def stopTimer(hermes, intent_message): current_session_id = intent_message.session_id tag = Extract.values(intent_message.slots.tag) hermes.alarm.remove(tag) if __name__ == "__main__": lang = Concierge.getLang() c = Concierge(MQTT_IP_ADDR) a = Alarm(c) with Hermes(MQTT_ADDR) as h: h.alarm = a h.subscribe_intent("snips-labs:SetAlarm_" + lang, setAlarm) \ .subscribe_intent("snips-labs:StopTimer_" + lang, stopTimer) \ .loop_forever()
if (not self.bPressed and self.rotarySet <= 0): self.haveBeenMoved = Remote.MOVE_COUNTER print("haveBeenMoved") def on_lup(self): print("lup") def on_ldown(self): print("ldown") def on_near(self): print("near") def on_far(self): print("far") if __name__ == "__main__": def sig_handler(sig, frame): c.disconnect() a.stop() sys.exit(0) MQTT_IP_ADDR = "raspi-mika.local" signal.signal(signal.SIGINT, sig_handler) c = Concierge(MQTT_IP_ADDR, "default", False) a = Remote("default", c) a.start() c.loop_forever()