Intermediate mycroftos-enclosure-skill bump

This commit is contained in:
Peter Steenbergen 2020-01-13 08:04:35 +01:00
parent 6d2105a8d0
commit 34ab4ad2b3
3 changed files with 45 additions and 36 deletions

View File

@ -33,6 +33,8 @@ class MycroftOS(MycroftSkill):
super().__init__('MycroftOS')
self.skip_list = ('MycroftOS')
self.loading = True
self.airplay = self.settings.get("airplay")
self.sshd = self.settings.get("sshd")
def initialize(self):
""" Perform initalization.
@ -81,10 +83,21 @@ class MycroftOS(MycroftSkill):
LOG.exception('In MycroftOS Skill')
def on_websettings_changed(self):
if self.sshd != self.settings.get("sshd")
if self.settings.get("sshd") is True:
self.enable_ssh()
self.sshd = True
enable_ssh()
else:
self.sshd = False
disable_ssh()
if self.airplay != self.settings.get("airplay")
if self.settings.get("airplay") is True:
self.enable_airplay()
self.airplay = True
enable_airplay()
else:
self.airplay = False
disable_airplay()
# System volume
#def on_volume_set(self, message):
@ -187,24 +200,28 @@ class MycroftOS(MycroftSkill):
os.system("sudo systemctl enable sshd.service")
os.system("sudo systemctl start sshd.service")
self.speak_dialog("EnableSSH")
self.settings["sshd"] = True
@intent_file_handler("DisableSSH.intent")
def disable_ssh(self, message):
os.system("sudo systemctl disable sshd.service")
os.system("sudo systemctl stop sshd.service")
self.speak_dialog("DisableSSH")
self.settings["sshd"] = False
@intent_file_handler("EnableAirPlay.intent")
def enable_airplay(self, message):
os.system("sudo systemctl enable shairport-sync.service")
os.system("sudo systemctl start shairport-sync.service")
self.speak_dialog("EnableAirPlay")
self.settings["airplay"] = True
@intent_file_handler("DisableAirPlay.intent")
def disable_airplay(self, message):
os.system("sudo systemctl disable shairport-sync.service")
os.system("sudo systemctl stop shairport-sync.service")
self.speak_dialog("DisableAirPlay")
self.settings["airplay"] = False
def create_skill():

View File

@ -1,32 +0,0 @@
{
"name": "MycroftOS System",
"skillMetadata": {
"sections": [
{
"name": "Enabled services",
"fields": [
{
"type": "label",
"label": "Secure Shell (SSH)."
},
{
"name": "sshd",
"type": "checkbox",
"label": "Enabled",
"value": "true"
},
{
"type": "label",
"label": "AirPlay audio player (v1)."
},
{
"name": "airplay",
"type": "checkbox",
"label": "Enabled",
"value": "false"
}
]
}
]
}
}

View File

@ -0,0 +1,24 @@
skillMetadata:
sections:
- name: Smart speaker functionality
fields:
- type: label
label: Smart speaker services and functionality
- type: label
label: Airplay audio player (v1)
value: AirPlay is a proprietary protocol stack/suite developed by Apple Inc. that allows wireless streaming between devices of audio, video, device screens, and photos, together with related metadata.
- name: airplay
type: checkbox
label: Enabled
value: "false"
- name: MycroftOS system configuration
fields:
- type: label
label: System services
- type: label
label: Secure Shell (SSH)
value: Secure Shell (SSH) is a cryptographic network protocol for operating network services securely over an unsecured network.[1] Typical applications include remote command-line, login, and remote command execution.
- name: sshd
type: checkbox
label: Enabled
value: "true"