Add skill to switch between maps, pet, smart_home
This commit is contained in:
		
							
								
								
									
										4
									
								
								car-mode-switches-skill/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								car-mode-switches-skill/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| __pycache__/ | ||||
| *.qmlc | ||||
| settings.json | ||||
|  | ||||
							
								
								
									
										22
									
								
								car-mode-switches-skill/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								car-mode-switches-skill/README.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| # <img src="https://raw.githack.com/FortAwesome/Font-Awesome/master/svgs/solid/map-signs.svg" card_color="#FD9E66" width="50" height="50" style="vertical-align:bottom"/> Car Mode Switches | ||||
| Switches to various modes from audio | ||||
|  | ||||
| ## About | ||||
| Switches to various modes from audio | ||||
|  | ||||
| ## Examples | ||||
| * "Enable pet mode" | ||||
| * "Start pet mode" | ||||
| * "Turn on pet mode" | ||||
| * "Enable child mode" | ||||
| * "Start child mode" | ||||
| * "Turn on child mode" | ||||
|  | ||||
| ## Credits | ||||
| Firewalkers | ||||
|  | ||||
| ## Category | ||||
| **Productivity** | ||||
|  | ||||
| ## Tags | ||||
|  | ||||
							
								
								
									
										37
									
								
								car-mode-switches-skill/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								car-mode-switches-skill/__init__.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| 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 CarModeSwitches(MycroftSkill): | ||||
|     def __init__(self): | ||||
|         MycroftSkill.__init__(self) | ||||
|  | ||||
|     @intent_file_handler('switches.mode.pet.intent') | ||||
|     def handle_switches_mode_car(self, message): | ||||
|         url = self.settings.get("OSD_API", "http://localhost:5050/send") | ||||
|         emit(url, "switchPlugin", {"plugin": "petMode"}) | ||||
|         self.speak_dialog('switches.mode.pet') | ||||
|  | ||||
|     @intent_file_handler('switches.mode.smart_home.intent') | ||||
|     def handle_switches_mode_car(self, message): | ||||
|         url = self.settings.get("OSD_API", "http://localhost:5050/send") | ||||
|         emit(url, "switchPlugin", {"plugin": "smartHome"}) | ||||
|         self.speak_dialog('switches.mode.smart_home') | ||||
|  | ||||
|     @intent_file_handler('switches.mode.maps.intent') | ||||
|     def handle_switches_mode_car(self, message): | ||||
|         url = self.settings.get("OSD_API", "http://localhost:5050/send") | ||||
|         emit(url, "switchPlugin", {"plugin": "maps"}) | ||||
|         self.speak_dialog('switches.mode.maps') | ||||
|  | ||||
|  | ||||
| def create_skill(): | ||||
|     return CarModeSwitches() | ||||
| @@ -0,0 +1 @@ | ||||
| Showing maps | ||||
| @@ -0,0 +1,8 @@ | ||||
| Enable maps | ||||
| Start maps | ||||
| Turn on maps | ||||
| Display maps | ||||
| Enable map | ||||
| Start map | ||||
| Turn on map | ||||
| Display map | ||||
| @@ -0,0 +1 @@ | ||||
| Turning on pet mode | ||||
| @@ -0,0 +1,6 @@ | ||||
| Enable pet mode | ||||
| Start pet mode | ||||
| Turn on pet mode | ||||
| Enable child mode | ||||
| Start child mode | ||||
| Turn on child mode | ||||
| @@ -0,0 +1 @@ | ||||
| Showing garage view | ||||
| @@ -0,0 +1,6 @@ | ||||
| Enable smart home | ||||
| Start smart home | ||||
| Turn on smart home | ||||
| Show me my garage | ||||
| Show me garage | ||||
| Show me my house | ||||
							
								
								
									
										10
									
								
								car-mode-switches-skill/settingsmeta.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								car-mode-switches-skill/settingsmeta.yaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
|  | ||||
| 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" | ||||
		Reference in New Issue
	
	Block a user