Commit Graph

5040 Commits (mark-ii/gui-namespace)

Author SHA1 Message Date
Åke Forslund 1397659c77 Add skill api help to CLI 2021-02-06 17:57:38 +01:00
Åke Forslund 7f3b4e1795 Add skill_api_method decorator
The api methods are now much easier to use, almost transparent. The
current caveat is that only "standarad" python types are acceptable
(int, float, str, list, bool, None) due to the json serialization.

- api methods are now created with the skill_api_method decorator
- both arguments and keyword arguments are sent to the api method
instead of the message object
- api methods now uses a normal return statement instead of having to
handle creating response messages on the bus.

For example if the datetime skill wants to make the datetime string
fetchable simply add the skill_api_method decorator to the
get_display_date method.

    @skill_api_method
    def get_display_date(self, day=None, location=None):
        """Returns the date and time as a string."""
        [...]

The methods return value will be sent back to the caller and can be used
from a skill through

        datetime = SkillApi.get('mycroft-date-time.mycroftai')
        self.log.info(datetime.get_display_date())
2021-02-06 17:57:19 +01:00
Åke Forslund df02bf22b4 Add skill api.
The skill api allows skills to define a public api which can easily be
accessed by other skills over the message bus just as easy as working
with a normal object.

The skill api object is generated from the skill's public_api property. It's a dict where each key is turned into a method on the api object. The method is defined as
  "api_method": {
    "type": message type string
    "func": handler method
    "help": help string for cli
  }

Example skill:

class Test2(MycroftSkill):
    def __init__(self):
        MycroftSkill.__init__(self)
        self.public_api = {
            'speak': {
                'type': 't2.speak',
                'func': self.handle_speak,
                'help': 'speak the test sentence\nand another line\n\nlast'
            },
            'speak2': {
                'type': 't2.speak2',
                'func': self.handle_speak2,
                'help': 'speak the other sentence'
            }
        }

    def handle_speak(self, message):
        self.speak('This is a test')
        self.bus.emit(message.response(data=None))

    def handle_speak2(self, message):
        self.speak('This is another test')
        self.bus.emit(message.response(data=None))
2021-02-06 17:55:34 +01:00
Ken Smith 289f229630 synchronize volume between skill and switches, fix mute led bring up issue and fix color palette 2021-02-05 13:47:27 -05:00
Kris Gesling bfd6be347f
Merge pull request #2690 from pixelherodev/dev
Add support for `doas`
2021-02-05 14:46:29 +09:30
Kris Gesling b1be522972
Merge pull request #2820 from MycroftAI/feature/gui-get
Feature/gui get
2021-02-05 14:41:03 +09:30
Kris Gesling f8f351e4da
Merge pull request #2823 from MycroftAI/bugfix/2822
Reorder operations to ensure removed Skills are first unloaded.
2021-02-05 07:43:16 +09:30
Kris Gesling cae1cb751f Extend GUI interface unittests 2021-02-04 16:12:22 +09:30
Kris Gesling bfe2b59f90 Add get method for accessing GUI values 2021-02-04 16:12:22 +09:30
Kris Gesling 688d1fe438 Reorder operations to ensure removed Skills are first unloaded.
Prevents SkillManager from attempting to reload a Skill that has
just been removed from the system which results in a
FileNotFoundError

Fixes #2822
2021-02-04 11:56:29 +09:30
Chris Veilleux 5fe7949bfd Added code to pass the packaging_type config to the pairing code endpoint. This was done to know if a device uses a Pantacor image. Selene will use this information to retrieve device information from Pantacor using their API. 2021-02-02 19:27:01 -06:00
Chris Veilleux 1efa60e695 Merge branch 'feature/mark-2' of https://github.com/MycroftAI/mycroft-core into feature/mark-2 2021-02-02 19:22:27 -06:00
Chris Veilleux dcf54c0cc3 Refactored to abstract out duplicate code. 2021-02-02 19:22:20 -06:00
Kris Gesling 4c4250a079
Merge pull request #2821 from forslund/refactor/stop-speaking
Refactor/stop speaking
2021-02-02 16:40:56 +09:30
Kris Gesling 3b4a3e709b fix missing MAX_VOL 2021-02-02 16:33:50 +09:30
Åke Forslund 166e36fa84 Improve logic when waiting for play calls
Add logic to ensure the play_* functions are called at least once before
checking the call status.
2021-02-01 23:02:34 +01:00
Åke Forslund 3ede156c98 Only stop speaking if speaking is active
This also updates the relevant testcase
2021-02-01 20:26:44 +01:00
Åke Forslund 96bbd384ad Add proper docstring 2021-02-01 20:26:44 +01:00
Åke Forslund e3e52d63a0 Remove filesystem signal for stopping speech
The filesystem signal has not been used for quite some time and should
not be used.
2021-02-01 20:26:44 +01:00
Kris Gesling 8e51083882
Merge pull request #2815 from AIIX/Fix/SystemTextFrame
Bug Fix - Use the correct delegate, fix layouts, autofit text for System TextFrame
2021-02-01 11:57:00 +09:30
Kris Gesling e2fbda6701 auto pep8 2021-01-30 08:54:44 +09:30
Kris Gesling e645409837 reduce max volume 2021-01-30 08:53:45 +09:30
Kris Gesling 4ad1a49b3d
Merge pull request #2819 from MycroftAI/feature/github-actions-ci
Implement GitHub Actions for linting and unit tests
2021-01-29 20:30:40 +09:30
Kris Gesling f30adb85de
Merge pull request #2804 from forslund/bugfix/audioservice-issues
Bugfix/audioservice issues
2021-01-29 14:55:27 +09:30
Kris Gesling cd4dbb3a32
Merge pull request #2648 from forslund/feature/ready-check
Improve readiness check for all services
2021-01-29 08:15:59 +09:30
Åke Forslund 5df15245c4 Add Todo / comment regarding startup order 2021-01-28 17:24:21 +01:00
Åke Forslund b595f6cdad Always use the plural "Skills" for the service
Change all strings referring to the service to use "Skills service"
2021-01-28 17:24:21 +01:00
Åke Forslund 94d5e34fd0 Add started and alive hooks to skills process 2021-01-28 17:24:21 +01:00
Åke Forslund 93747a13ed Remove is_alive and all_loaded registration test 2021-01-28 17:24:21 +01:00
Kris Gesling 8a1ee0e106 Move ready check to enclosure; use ProcessStatus
Previously Mycroft reported mycroft.ready when Padatious had
finished it's first training run. This check has been shifted
to the enclosure service, and starts checking once the Padatious
training is complete.

Currently checks on readiness of audio, speech and skills services.
2021-01-28 17:24:21 +01:00
Kris Gesling 1273425799 add ProcessStatus to key services 2021-01-28 17:24:21 +01:00
Åke Forslund eeb44ede9a Add test cases for ProcessStatus 2021-01-28 17:21:33 +01:00
Kris Gesling cc3bf5b45a Change names for consistency 2021-01-28 17:21:33 +01:00
Åke Forslund bea1f008c6 Add ProcessStatus class
ProcessStatus tracks the process status and allows callbacks on changes
and status queries over the messagebus.

StatusCallbackMap is used to setup the callbacks

ProcessState is an enum tracking the different states.
2021-01-28 17:21:33 +01:00
Chris Veilleux c7e390f332 Remove config files for Travis CI and coveralls as they are no longer part of the CI process. 2021-01-28 09:58:59 -06:00
Chris Veilleux 2d83bd2ed1 Replace "build" and "coverage" badges with new versions based on GitHub Actions for the former and codecov for the latter. Also minor refactoring of headings and some language errors. 2021-01-27 14:31:36 -06:00
Chris Veilleux 221dfc6576 Build fails on Python 3.5 due to an "f string" in PIP 2021-01-27 14:28:14 -06:00
Chris Veilleux 6513e76680 Refactor and add comments 2021-01-27 13:39:31 -06:00
Chris Veilleux a6ef894ded Replace coveralls with codecov 2021-01-27 13:27:43 -06:00
Chris Veilleux 52eaf445ce Remove apt installs that are redundant of those in dev_setup.sh 2021-01-27 13:25:45 -06:00
Chris Veilleux c7b5783d89 The "tput" commands were failing in GitHub Actions, added CI check as there is no reason to execute those commands in a CI environment. 2021-01-27 12:49:48 -06:00
Chris Veilleux b5387a8888 Renamed file to unit_test.yml. Previous name, ci.yml, implied a full CI suite. Ony unit tests are run with this file. 2021-01-27 12:44:37 -06:00
Marvin Wichmann d21ea406e5 Migrate to Github Actions 2021-01-27 11:31:37 -06:00
neonandrii fb84658e5d Issue-2812 - Allow overridden converse methods to accept messages - FIX: PEP8-line-too-long issue in MycroftSkill.converse 2021-01-26 19:27:33 +02:00
neonandrii 171b266ec1 Issue-2812 - Allow overridden converse methods to accept messages - modified the signature check in SkillManager.handle_converse_request and MycroftSkill.converse, and resolving PEP8 issues 2021-01-25 21:00:06 +02:00
neonandrii aca69203e6 Issue-2812 - Allow overridden converse methods to accept messages - modified the signature check in SkillManager.handle_converse_request and MycroftSkill.converse, and resolving PEP8 issues 2021-01-25 20:59:30 +02:00
Kris Gesling 73f0299cfa
Merge pull request #2722 from forslund/bugfix/latest-porcupine
Update for newer Porcupine engines
2021-01-25 16:29:48 +09:30
Åke Forslund aace28dfa3 Use lock around play and stop
Moves the stopping logic to separate method to be able to call from
locked contexts
2021-01-23 11:09:54 +01:00
neonandrii ba7b2795ec Issue-2812 - Allow overridden converse methods to accept messages - adding default message=None to MycroftSkill.converse and changing the signature check in the skill manager. 2021-01-22 17:20:48 +02:00
neonandrii 416eebfee7 Issue-2812 - Allow overridden converse methods to accept messages - adding default message=None to MycroftSkill.converse and changing the signature check in the skill manager. 2021-01-22 17:16:22 +02:00