Add car-weather-skill
This commit is contained in:
parent
22de5213b5
commit
1f87ced31b
|
@ -0,0 +1,4 @@
|
||||||
|
__pycache__/
|
||||||
|
*.qmlc
|
||||||
|
settings.json
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
|
@ -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"
|
Loading…
Reference in New Issue