Compare commits

...

2 Commits

Author SHA1 Message Date
Ceda EI 3258ba8496 Fix function names 2021-01-06 12:32:17 +05:30
Ceda EI cde98cc95a Create car-smart-home-lights-skill 2021-01-06 12:31:52 +05:30
9 changed files with 77 additions and 3 deletions

View File

@ -15,19 +15,19 @@ class CarModeSwitches(MycroftSkill):
MycroftSkill.__init__(self) MycroftSkill.__init__(self)
@intent_file_handler('switches.mode.pet.intent') @intent_file_handler('switches.mode.pet.intent')
def handle_switches_mode_car(self, message): def pet_mode(self, message):
url = self.settings.get("OSD_API", "http://localhost:5050/send") url = self.settings.get("OSD_API", "http://localhost:5050/send")
emit(url, "switchPlugin", {"plugin": "petMode"}) emit(url, "switchPlugin", {"plugin": "petMode"})
self.speak_dialog('switches.mode.pet') self.speak_dialog('switches.mode.pet')
@intent_file_handler('switches.mode.smart_home.intent') @intent_file_handler('switches.mode.smart_home.intent')
def handle_switches_mode_car(self, message): def smart_home(self, message):
url = self.settings.get("OSD_API", "http://localhost:5050/send") url = self.settings.get("OSD_API", "http://localhost:5050/send")
emit(url, "switchPlugin", {"plugin": "smartHome"}) emit(url, "switchPlugin", {"plugin": "smartHome"})
self.speak_dialog('switches.mode.smart_home') self.speak_dialog('switches.mode.smart_home')
@intent_file_handler('switches.mode.maps.intent') @intent_file_handler('switches.mode.maps.intent')
def handle_switches_mode_car(self, message): def maps(self, message):
url = self.settings.get("OSD_API", "http://localhost:5050/send") url = self.settings.get("OSD_API", "http://localhost:5050/send")
emit(url, "switchPlugin", {"plugin": "maps"}) emit(url, "switchPlugin", {"plugin": "maps"})
self.speak_dialog('switches.mode.maps') self.speak_dialog('switches.mode.maps')

View File

@ -0,0 +1,4 @@
__pycache__/
*.qmlc
settings.json

View File

@ -0,0 +1,22 @@
# <img src="https://raw.githack.com/FortAwesome/Font-Awesome/master/svgs/solid/lightbulb.svg" card_color="#FEE255" width="50" height="50" style="vertical-align:bottom"/> Car Smart Home Lights
Turns on/off the lights
## About
## Examples
* "Turn on lights"
* "Open the lights"
* "Turn the lights on"
* "Open garage lights"
* "Turn the garage lights on"
* "Turn on the garage lights"
## Credits
Firewalkers
## Category
**IoT**
## Tags

View File

@ -0,0 +1,24 @@
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()

View File

@ -0,0 +1 @@
Turning off the lights

View File

@ -0,0 +1,6 @@
Turn off lights
Open the lights
Turn the lights off
Open garage lights
Turn the garage lights off
Turn off the garage lights

View File

@ -0,0 +1 @@
Turning on the lights

View File

@ -0,0 +1,6 @@
Turn on lights
Open the lights
Turn the lights on
Open garage lights
Turn the garage lights on
Turn on the garage lights

View File

@ -0,0 +1,10 @@
skillMetadata:
sections:
- name: API Paths
fields:
- name: LIGHTS_API
type: text
label: Lights API Base Path
value: "http://192.168.1.51:5000/"
placeholder: "http://192.168.1.51:5000/"