-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__init__.py
51 lines (35 loc) · 1.5 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Rolling_Shutters
# Mycroft <-> Wemos mini
# ESP8266_IP_address : http://RS_IpAddress/
# command : /?up
# command : /?down
# command : /?shadow
# Mycroft libraries
from adapt.intent import IntentBuilder
from mycroft.skills.core import MycroftSkill
from mycroft.util.log import getLogger
from mycroft import intent_handler
import requests
__author__ = 'henridbr' # hd@uip
LOGGER = getLogger(__name__)
class RollingShuttersSkill(MycroftSkill):
def __init__(self):
super(RollingShuttersSkill, self).__init__(name="RollingShuttersSkill")
self.Ip_Address = self.settings.get('RS_IpAddress')
print("Ip address : ",self.Ip_Address)
@intent_handler(IntentBuilder("OpenShuttersIntent").require("OpenShuttersKeyword"))
def handle_open_shutters_intent(self, message):
self.speak_dialog("roll.shut.open")
r = requests.get("http://"+self.Ip_Address+"/?up")
@intent_handler(IntentBuilder("CloseShuttersIntent").require("CloseShuttersKeyword"))
def handle_close_shutters_intent(self, message):
self.speak_dialog("roll.shut.close")
r = requests.get("http://"+self.Ip_Address+"/?down")
@intent_handler(IntentBuilder("ShadowShuttersIntent").require("ShadowShuttersKeyword"))
def handle_shadow_shutters_intent(self, message):
self.speak_dialog("roll.shut.shadow")
r = requests.get("http://"+self.Ip_Address+"/?shadow")
def stop(self):
pass
def create_skill():
return RollingShuttersSkill()