Add car-weather-skill
This commit is contained in:
		
							
								
								
									
										4
									
								
								car-weather-skill/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								car-weather-skill/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| __pycache__/ | ||||
| *.qmlc | ||||
| settings.json | ||||
|  | ||||
							
								
								
									
										17
									
								
								car-weather-skill/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								car-weather-skill/README.md
									
									
									
									
									
										Normal 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
									
								
								car-weather-skill/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								car-weather-skill/__init__.py
									
									
									
									
									
										Normal 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() | ||||
							
								
								
									
										1
									
								
								car-weather-skill/locale/en-us/weather.car.dialog
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								car-weather-skill/locale/en-us/weather.car.dialog
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| The weather outside is {{temp}} degrees celsius | ||||
							
								
								
									
										9
									
								
								car-weather-skill/locale/en-us/weather.car.intent
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								car-weather-skill/locale/en-us/weather.car.intent
									
									
									
									
									
										Normal file
									
								
							| @@ -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
									
								
								car-weather-skill/settingsmeta.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								car-weather-skill/settingsmeta.yaml
									
									
									
									
									
										Normal 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" | ||||
		Reference in New Issue
	
	Block a user