Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
from import Hermes
from display import SenseDisplay
from celestial import Celestial
from strings import CelestialStrings
MQTT_IP_ADDR = "localhost"
MQTT_PORT = 1883
MQTT_ADDR = "{}:{}".format(MQTT_IP_ADDR, str(MQTT_PORT))
class CelestialApp:
def __init__(self):
self.display = SenseDisplay()
self.celestial = Celestial()
def moon_phase_callback(self, hermes, intent_message):
phase_info = self.celestial.get_moon_phase()
msg = CelestialStrings.get_moon_phase_message(phase_info)
hermes.publish_end_session(intent_message.session_id, msg)
def start_listening(self):
with Hermes(MQTT_ADDR) as h:
"harthur:MoonPhase", self.moon_phase_callback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment