Add car-weather-skill

This commit is contained in:
2020-12-21 22:29:23 +05:30
parent 22de5213b5
commit 1f87ced31b
6 changed files with 80 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
__pycache__/
*.qmlc
settings.json
+17
View File
@@ -0,0 +1,17 @@
# <img src="https://raw.githack.com/FortAwesome/Font-Awesome/master/svgs/solid/temperature-high.svg" card_color="#FEE255" width="50" height="50" style="vertical-align:bottom"/> Car Weather
Provides temperature outside the car
## About
Provides temperature outside the car
## Examples
* "What is the weather outside the car"
## Credits
Firewalkers
## Category
**Information**
## Tags
+35
View File
@@ -0,0 +1,35 @@
from mycroft import MycroftSkill, intent_file_handler
import requests
def emit(osd_url, event, data):
json = {
"event": event,
"data": data
}
print(json)
return requests.post(osd_url, json=json)
class CarWeather(MycroftSkill):
def __init__(self):
MycroftSkill.__init__(self)
@intent_file_handler('weather.car.intent')
def handle_weather_car(self, message):
osd_url = self.settings.get("OSD_API", "http://localhost:5050/send")
car_url = self.settings.get("CAR_API", "http://localhost:5000")
temp = requests.get(f"{car_url}/data/OutsideTemperature").json()["value"]
emission = {
"plugin": "temperature",
"data": {
"temperature": temp
},
"time": 5000
}
emit(osd_url, "switchPlugin", emission)
self.speak_dialog('weather.car', {"temp": temp})
def create_skill():
return CarWeather()
@@ -0,0 +1 @@
The weather outside is {{temp}} degrees celsius
@@ -0,0 +1,9 @@
What is the weather outside the car
What is the temperature outside the car
What is the temperature outside
What is the weather outside
How is the weather outside
How is the weather
How is the weather outside the car
How is the temperature outside the car
How is the temperature outside
+14
View File
@@ -0,0 +1,14 @@
skillMetadata:
sections:
- name: API Paths
fields:
- name: OSD_API
type: text
label: OSD API URL
value: "http://localhost:5050/send"
placeholder: "http://localhost:5050/send"
- name: CAR_API
type: text
label: Car API URL
value: "http://localhost:5000"
placeholder: "http://localhost:5000"