Voice-Plugins/car-smart-home-lights-skill/__init__.py

25 lines
709 B
Python

from mycroft import MycroftSkill, intent_file_handler
import requests
class CarSmartHomeLights(MycroftSkill):
def __init__(self):
MycroftSkill.__init__(self)
@intent_file_handler('lights.on.intent')
def turn_on_lights(self, message):
lights = self.settings.get("LIGHTS_API", "http://192.168.1.51:5000/")
requests.get(f"{lights}/on")
self.speak_dialog('lights.on')
@intent_file_handler('lights.off.intent')
def turn_off_lights(self, message):
lights = self.settings.get("LIGHTS_API", "http://192.168.1.51:5000/")
requests.get(f"{lights}/off")
self.speak_dialog('lights.off')
def create_skill():
return CarSmartHomeLights()