MycroftOS: Bump mycroftos-enclosure-skill again

This commit is contained in:
Peter Steenbergen 2020-01-15 22:52:27 +01:00
parent 257df74090
commit 8bce3b0fe7
87 changed files with 278 additions and 187 deletions

View File

@ -33,13 +33,20 @@ 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')
self.spotify = self.settings.get('spotifyd')
self.btspeaker = self.settings.get('btspeaker')
self.snapclient = self.settings.get('snapclient')
self.snapserver = self.settings.get('snapserver')
self.mpd = self.settings.get('mpd')
self.airplay_enabled = self.settings.get('airplay')
self.sshd_enabled = self.settings.get('sshd')
self.spotify_enabled = self.settings.get('spotifyd')
self.btspeaker_enabled = self.settings.get('btspeaker')
self.snapclient_enabled = self.settings.get('snapclient')
self.snapserver_enabled = self.settings.get('snapserver')
self.mpd_enabled = self.settings.get('mpd')
self.airplay_started = False
self.sshd_started = False
self.spotify_started = False
self.btspeaker_started = False
self.snapclient_started = False
self.snapserver_started = False
self.mpd_started = False
def initialize(self):
""" Perform initalization.
@ -88,43 +95,43 @@ class MycroftOS(MycroftSkill):
LOG.exception('In MycroftOS Skill')
def on_websettings_changed(self):
if self.sshd != self.settings.get('sshd'):
if self.sshd_enabled != self.settings.get('sshd'):
if self.settings.get('sshd') is True:
self.enable_ssh()
else:
self.disable_ssh()
if self.airplay != self.settings.get('airplay'):
if self.airplay_enabled != self.settings.get('airplay'):
if self.settings.get('airplay') is True:
self.enable_airplay()
else:
self.disable_airplay()
if self.spotify != self.settings.get('spotifyd'):
if self.spotify_enabled != self.settings.get('spotifyd'):
if self.settings.get('spotifyd') is True:
self.enable_spotify()
else:
self.disable_spotify()
if self.btspeaker != self.settings.get('btspeaker'):
if self.btspeaker_enabled != self.settings.get('btspeaker'):
if self.settings.get('btspeaker') is True:
self.enable_btspeaker()
else:
self.disable_btspeaker()
if self.snapclient != self.settings.get('snapclient'):
if self.snapclient_enabled != self.settings.get('snapclient'):
if self.settings.get('snapclient') is True:
self.enable_snapclient()
else:
self.disable_snapclient()
if self.snapserver != self.settings.get('snapserver'):
if self.snapserver_enabled != self.settings.get('snapserver'):
if self.settings.get('snapserver') is True:
self.enable_snapserver()
else:
self.disable_snapserver()
if self.mpd != self.settings.get('mpd'):
if self.mpd_enabled != self.settings.get('mpd'):
if self.settings.get('mpd') is True:
self.enable_mpd()
else:
@ -214,213 +221,284 @@ class MycroftOS(MycroftSkill):
# System actions
def on_shutdown(self, message):
def on_shutdown(self):
self.speak('Till next time')
sleep(5)
os.system('sudo halt')
def on_reboot(self, message):
def on_reboot(self):
self.speak('I will be right back')
sleep(5)
os.system('sudo reboot')
# System services
def enable_ssh(self):
os.system('sudo systemctl enable sshd.service')
os.system('sudo systemctl start sshd.service')
self.settings['sshd'] = True
self.sshd = True
self.sshd_enabled = True
self.sshd_started = True
self.speak_dialog('EnabledSSH')
def disable_ssh(self):
os.system('sudo systemctl disable sshd.service')
os.system('sudo systemctl stop sshd.service')
self.settings['sshd'] = False
self.sshd = False
self.sshd_enabled = False
self.sshd_started = True
self.speak_dialog('DisabledSSH')
def enable_airplay(self):
os.system('sudo systemctl enable shairport-sync.service')
os.system('sudo systemctl start shairport-sync.service')
self.settings['airplay'] = True
self.airplay = True
self.airplay_enabled = True
self.airplay_started = True
self.speak_dialog('EnabledAirPlay')
def disable_airplay(self):
os.system('sudo systemctl disable shairport-sync.service')
os.system('sudo systemctl stop shairport-sync.service')
self.settings['airplay'] = False
self.airplay = False
self.airplay_enabled = False
self.airplay_started = False
self.speak_dialog('DisabledAirPlay')
def enable_spotify(self):
os.system('sudo systemctl enable spotifyd.service')
os.system('sudo systemctl start spotifyd.service')
self.settings['spotifyd'] = True
self.spotify = True
self.spotify_enabled = True
self.spotify_started = True
self.speak_dialog('EnabledSpotify')
def disable_spotify(self):
os.system('sudo systemctl disable spotifyd.service')
os.system('sudo systemctl stop spotifyd.service')
self.settings['spotifyd'] = False
self.spotify = False
self.spotify_enabled = False
self.spotify_started = False
self.speak_dialog('DisabledSpotify')
def enable_btspeaker(self):
os.system('sudo systemctl enable btspeaker.service')
os.system('sudo systemctl start btspeaker.service')
self.settings['btspeaker'] = True
self.btspeaker = True
self.btspeaker_enabled = True
self.btspeaker_started = True
self.speak_dialog('EnabledBTspeaker')
def disable_btspeaker(self):
os.system('sudo systemctl disable btspeaker.service')
os.system('sudo systemctl stop btspeaker.service')
self.settings['btspeaker'] = False
self.btspeaker = False
self.btspeaker_enabled = False
self.btspeaker_started = False
self.speak_dialog('DisabledBTspeaker')
def enable_snapclient(self):
os.system('sudo systemctl enable snapclient.service')
os.system('sudo systemctl start snapclient.service')
self.settings['snapclient'] = True
self.snapclient = True
self.snapclient_enabled = True
self.snapclient_started = True
self.speak_dialog('EnabledSnapclient')
def disable_snapclient(self):
os.system('sudo systemctl disable snapclient.service')
os.system('sudo systemctl stop snapclient.service')
self.settings['snapclient'] = False
self.snapclient = False
self.snapclient_enabled = False
self.snapclient_started = False
self.speak_dialog('DisabledSnapclient')
def enable_snapserver(self):
os.system('sudo systemctl enable snapserver.service')
os.system('sudo systemctl start snapserver.service')
self.settings['snapserver'] = True
self.snapserver = True
self.snapserver_enabled = True
self.snapserver_started = True
self.speak_dialog('EnabledSnapserver')
def disable_snapserver(self):
os.system('sudo systemctl disable snapserver.service')
os.system('sudo systemctl stop snapserver.service')
self.settings['snapserver'] = False
self.snapserver = False
self.snapserver_enabled = False
self.snapserver_started = False
self.speak_dialog('DisabledSnapserver')
def enable_mpd(self):
os.system('sudo systemctl enable mpd.service')
os.system('sudo systemctl start mpd.service')
self.settings['mpd'] = True
self.mpd = True
self.mpd_enabled = True
self.mpd_started = True
self.speak_dialog('EnabledMPD')
def disable_mpd(self):
os.system('sudo systemctl disable mpd.service')
os.system('sudo systemctl stop mpd.service')
self.settings['mpd'] = False
self.mpd = False
self.mpd_enabled = False
self.mpd_started = False
self.speak_dialog('DisabledMPD')
def start_ssh(self):
os.system('sudo systemctl start sshd.service')
self.speak_dialog('StartedSSH')
def stop_ssh(self):
os.system('sudo systemctl stop sshd.service')
self.speak_dialog('StoppedSSH')
def start_airplay(self):
os.system('sudo systemctl start shairport-sync.service')
self.speak_dialog('StartedAirplay')
def stop_airplay(self):
os.system('sudo systemctl stop shairport-sync.service')
self.speak_dialog('StoppedAirplay')
def start_spotify(self):
os.system('sudo systemctl start spotifyd.service')
self.speak_dialog('StartedSpotify')
def stop_spotify(self):
os.system('sudo systemctl stop spotifyd.service')
self.speak_dialog('StoppedSpotify')
def start_btspeaker(self):
os.system('sudo systemctl start btspeaker.service')
self.speak_dialog('StartedBTspeaker')
def stop_btspeaker(self):
os.system('sudo systemctl stop btspeaker.service')
self.speak_dialog('StoppedBTspeaker')
def start_snapclient(self):
os.system('sudo systemctl start snapclient.service')
self.speak_dialog('StartedSnapclient')
def stop_snapclient(self):
os.system('sudo systemctl stop snapclient.service')
self.speak_dialog('StoppedSnapclient')
def start_snapserver(self):
os.system('sudo systemctl start snapserver.service')
self.speak_dialog('StartedSnapserver')
def stop_snapserver(self):
os.system('sudo systemctl stop snapserver.service')
self.speak_dialog('StoppedSnapserver')
def start_mpd(self):
os.system('sudo systemctl start mpd.service')
self.speak_dialog('StartedMPD')
def stop_mpd(self):
os.system('sudo systemctl stop mpd.service')
self.speak_dialog('StoppedMPD')
# Intent handlers
@intent_file_handler('EnableSSH.intent')
def on_enable_ssh(self, message):
if self.sshd is False:
self.enable_ssh()
@intent_file_handler('StartSSH.intent')
def on_start_ssh(self, message):
if self.sshd_started is False:
self.start_ssh()
else:
self.speak_dialog('AlreadyEnabledSSH')
self.speak_dialog('AlreadyStartedSSH')
@intent_file_handler('DisableSSH.intent')
def on_disable_ssh(self, message):
if self.sshd is True:
self.disable_ssh()
@intent_file_handler('StopSSH.intent')
def on_stop_ssh(self, message):
if self.sshd_started is True:
self.stop_ssh()
else:
self.speak_dialog('AlreadyDisabledSSH')
self.speak_dialog('AlreadyStoppedSSH')
@intent_file_handler('EnableAirPlay.intent')
def on_enable_airplay(self, message):
if self.airplay is False:
self.enable_airplay()
@intent_file_handler('StartAirPlay.intent')
def on_start_airplay(self, message):
if self.airplay_started is False:
self.start_airplay()
else:
self.speak_dialog('AlreadyEnabledAirPlay')
self.speak_dialog('AlreadyStartedAirPlay')
@intent_file_handler('DisableAirPlay.intent')
def on_disable_airplay(self, message):
if self.airplay is True:
self.disable_airplay()
@intent_file_handler('StopAirPlay.intent')
def on_stop_airplay(self, message):
if self.airplay_started is True:
self.stop_airplay()
else:
self.speak_dialog('AlreadyDisabledAirPlay')
self.speak_dialog('AlreadyStoppedAirPlay')
@intent_file_handler('EnableSpotify.intent')
def on_enable_spotify(self, message):
if self.spotify is False:
self.enable_spotify()
@intent_file_handler('StartSpotify.intent')
def on_start_spotify(self, message):
if self.spotify_started is False:
self.start_spotify()
else:
self.speak_dialog('AlreadyEnabledSpotify')
self.speak_dialog('AlreadyStartedSpotify')
@intent_file_handler('DisableSpotify.intent')
def on_disable_spotify(self, message):
if self.spotify is True:
self.disable_spotify()
@intent_file_handler('StopSpotify.intent')
def on_stop_spotify(self, message):
if self.spotify_started is True:
self.stop_spotify()
else:
self.speak_dialog('AlreadyDisabledSpotify')
self.speak_dialog('AlreadyStoppedSpotify')
@intent_file_handler('EnableBTspeaker.intent')
def on_enable_btspeaker(self, message):
if self.btspeaker is False:
self.enable_btspeaker()
@intent_file_handler('StartBTspeaker.intent')
def on_start_btspeaker(self, message):
if self.btspeaker_started is False:
self.start_btspeaker()
else:
self.speak_dialog('AlreadyEnabledBTspeaker')
self.speak_dialog('AlreadyStartedBTspeaker')
@intent_file_handler('DisableBTspeaker.intent')
def on_disable_btspeaker(self, message):
if self.btspeaker is True:
self.disable_btspeaker()
@intent_file_handler('StopBTspeaker.intent')
def on_stop_btspeaker(self, message):
if self.btspeaker_started is True:
self.stop_btspeaker()
else:
self.speak_dialog('AlreadyDisabledBTspeaker')
self.speak_dialog('AlreadyStoppedBTspeaker')
@intent_file_handler('EnableSnapclient.intent')
def on_enable_snapclient(self, message):
if self.snapclient is False:
self.enable_snapclient()
@intent_file_handler('StartSnapclient.intent')
def on_start_snapclient(self, message):
if self.snapclient_started is False:
self.start_snapclient()
else:
self.speak_dialog('AlreadyEnabledSnapclient')
self.speak_dialog('AlreadyStartedSnapclient')
@intent_file_handler('DisableSnapclient.intent')
def on_disable_snapclient(self, message):
if self.snapclient is True:
self.disable_snapclient()
@intent_file_handler('StopSnapclient.intent')
def on_stop_snapclient(self, message):
if self.snapclient_started is True:
self.stop_snapclient()
else:
self.speak_dialog('AlreadyDisabledSnapclient')
self.speak_dialog('AlreadyStoppedSnapclient')
@intent_file_handler('EnableSnapserver.intent')
def on_enable_snapserver(self, message):
if self.snapserver is False:
self.enable_snapserver()
@intent_file_handler('StartSnapserver.intent')
def on_start_snapserver(self, message):
if self.snapserver_started is False:
self.start_snapserver()
else:
self.speak_dialog('AlreadyEnabledSnapserver')
self.speak_dialog('AlreadyStartedSnapserver')
@intent_file_handler('DisableSnapserver.intent')
def on_disable_snapserver(self, message):
if self.snapserver is True:
self.disable_snapserver()
@intent_file_handler('StopSnapserver.intent')
def on_stop_snapserver(self, message):
if self.snapserver_started is True:
self.stop_snapserver()
else:
self.speak_dialog('AlreadyDisabledSnapserver')
self.speak_dialog('AlreadyStoppedSnapserver')
@intent_file_handler('EnableMPD.intent')
def on_enable_mpd(self, message):
if self.mpd is False:
self.enable_mpd()
@intent_file_handler('StartMPD.intent')
def on_start_mpd(self, message):
if self.mpd_started is False:
self.start_mpd()
else:
self.speak_dialog('AlreadyEnabledMPD')
self.speak_dialog('AlreadyStartedMPD')
@intent_file_handler('DisableMPD.intent')
def on_disable_mpd(self, message):
if self.mpd is True:
self.disable_mpd()
@intent_file_handler('StopMPD.intent')
def on_stop_mpd(self, message):
if self.mpd_started is True:
self.stop_mpd()
else:
self.speak_dialog('AlreadyDisabledMPD')
self.speak_dialog('AlreadyStoppedMPD')
def create_skill():

View File

@ -1 +0,0 @@
Media player daemon is already stopped and disabled

View File

@ -1 +0,0 @@
Media player daemon is already enabled and started

View File

@ -0,0 +1 @@
Media player daemon is already started

View File

@ -0,0 +1 @@
Media player daemon is already stopped

View File

@ -1 +1 @@
Airplay is stopped and disabled
Airplay is stopped and disabled

View File

@ -1 +1 @@
Bluetooth speaker is stopped and disabled
Bluetooth speaker is stopped and disabled

View File

@ -1 +1 @@
Media player daemon is stopped and disabled
Media player daemon is stopped and disabled

View File

@ -1 +1 @@
Secure shell is stopped and disabled
Secure shell is stopped and disabled

View File

@ -1 +1 @@
Snapcast client is stopped and disabled
Snapcast client is stopped and disabled

View File

@ -1 +1 @@
Snapcast server is stopped and disabled
Snapcast server is stopped and disabled

View File

@ -1 +1 @@
Spotify connect is stopped and disabled
Spotify connect is stopped and disabled

View File

@ -1 +1 @@
Airplay is enabled and started
Airplay is enabled and started

View File

@ -1 +1 @@
Bluetooth speaker is enabled and started
Bluetooth speaker is enabled and started

View File

@ -1 +1 @@
Media Player Daemon is enabled and started
Media Player Daemon is enabled and started

View File

@ -1 +1 @@
Secure shell is enabled and started
Secure shell is enabled and started

View File

@ -1 +1 @@
Snapcast client is enabled and started
Snapcast client is enabled and started

View File

@ -1 +1 @@
Snapcast server is enabled and started
Snapcast server is enabled and started

View File

@ -1 +1 @@
Spotify connect is enabled and started
Spotify connect is enabled and started

View File

@ -1,4 +1,4 @@
I have now finished booting up.
I am now ready.
Hi, this is mycroft and I am ready to work.
You can get started with mycroft.
You can get started with mycroft.

View File

@ -3,7 +3,7 @@ skillMetadata:
- name: Smart speaker functionality
fields:
- type: label
label: <p>You can enable or disable smart speaker services and functionality currently present on the MycroftOS system. As every user has different requirements and is using different hardware, devices and network protocols, all these services are disabled by default. You can easily enable or disable any of the below services here, by selecting the enabled checkbox (slightly delayed as you need to wait for settings synchronisation) or by using voice commands to your MycroftOS device (For example Hey Mycroft, enable spotify).</p>
label: <p>You can enable or disable smart speaker services and functionality currently present on the MycroftOS system. As every user has different requirements and is using different hardware, devices and network protocols, all these services are disabled by default. You can easily enable or disable any of the below services here, by selecting the enabled checkbox (slightly delayed as you need to wait for settings synchronisation). If you only want to start the service now without enabling them, you can also use your voice command to your MycroftOS device (For example Hey Mycroft, start spotify).</p>
- type: label
label: <hr><br><strong>Airplay audio player (v1)</strong><p>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.</p>
- name: airplay
@ -49,4 +49,4 @@ skillMetadata:
- name: sshd
type: checkbox
label: Enabled
value: "true"
value: "true"

View File

@ -1,6 +0,0 @@
Disable airplay
Disable air play
Disable shareport sync
Disable share port sync
Disable shareport
Disable share port

View File

@ -1,4 +0,0 @@
Disable M P D
Disable M.P.D.
Disable MPD
Disable Media Player Daemon

View File

@ -1,4 +0,0 @@
Disable S S H
Disable S.S.H.
Disable SSH
Disable secure shell

View File

@ -1,7 +0,0 @@
Enable airplay
Enable air play
Enable shareport sync
Enable share port sync
Enable shareport
Enable share port

View File

@ -1,4 +0,0 @@
Enable M P D
Enable M.P.D.
Enable MPD
Enable Media Player Daemon

View File

@ -1,4 +0,0 @@
Enable S S H
Enable S.S.H.
Enable SSH
Enable secure shell

View File

@ -0,0 +1,6 @@
Start airplay
Start air play
Start shareport sync
Start share port sync
Start shareport
Start share port

View File

@ -0,0 +1,2 @@
Start bluetooth
Start blue tooth

View File

@ -0,0 +1,4 @@
Start M P D
Start M.P.D.
Start MPD
Start Media Player Daemon

View File

@ -0,0 +1,4 @@
Start S S H
Start S.S.H.
Start SSH
Start secure shell

View File

@ -0,0 +1,2 @@
Start snapclient
Start snap client

View File

@ -0,0 +1,2 @@
Start snapserver
Start snap server

View File

@ -0,0 +1,6 @@
Stop airplay
Stop air play
Stop shareport sync
Stop share port sync
Stop shareport
Stop share port

View File

@ -0,0 +1,4 @@
Stop M P D
Stop M.P.D.
Stop MPD
Stop Media Player Daemon

View File

@ -0,0 +1,4 @@
Stop S S H
Stop S.S.H.
Stop SSH
Stop secure shell

View File

@ -0,0 +1,2 @@
Stop snapclient
Stop snap client

View File

@ -0,0 +1,2 @@
Stop snapserver
Stop snap server