Commit Graph

888 Commits (3fea4b1e6fa2d3bfd6f620fcd3e188feb4903780)

Author SHA1 Message Date
Åke 5555fa398d
Merge pull request #2197 from forslund/feature/skills-startup-speedup
Skills process startup speedup
2019-07-10 16:30:48 +02:00
Åke 80b50598fb
Merge pull request #2196 from forslund/feature/skill-timing-report-skill_id
Add skill_id to skill handler timing report
2019-07-09 22:42:58 +02:00
Åke Forslund 94ab53f47e Handle sending skill manifest
Skill manifest is now sent on each startup if paired otherwise after successful pairing.
2019-07-09 16:52:27 +02:00
Åke Forslund d87ff3a535 Launch settings fetching in thread. 2019-07-09 16:52:27 +02:00
Åke Forslund cd16404455 Download skills if they're stale or in unknown state
Checks if the skills haven't been updated for more than 2 weeks or if
the last_download is undefined. last_download may be undefined if
the .msm file is missing or if the list of installed requirements is
missing so skill requirements may be missing.

This also makes sure the skills are normally loaded before the an update
attemt is tried.
2019-07-09 16:52:27 +02:00
Åke Forslund 58cab5cddb Add support for slowloading skills
Upgrade msm to 0.7.8

Using the new max_threads parameters to MycroftSkillsManager.apply() the
skill loading is reduced to 2 threads if it's during runtime while a
fast update (20 threads) are used if not all default skills are
installed to speed up getting core into a 100% operational state.
2019-07-09 16:52:10 +02:00
Åke Forslund fe31564114 Remove unused imports 2019-07-08 14:41:09 +02:00
Åke Forslund 6466be63d8 Add skill_id to skill handler timing report 2019-07-08 09:12:20 +02:00
Åke Forslund fbcf731556 Remove broken auto-naming of resting_screen_handler
The automatic naming of the resting_screen_handler wasn't working (error
occured if no name was supplied)

Added test case for the function
2019-07-03 08:40:34 +02:00
Åke 12f13ef47c
Merge pull request #2177 from forslund/bugfix/settings-allow-retry-after-delay
Remove incorrect settings meta upload disable flag
2019-07-01 09:35:46 +02:00
Åke Forslund 83b4a91b8b Remove incorrect settings meta upload disable flag
This allows core to retry sending settings meta after a failed attempt
2019-06-29 21:00:15 +02:00
Åke Forslund 2f1f6a6005 Improve MycroftSkill docstring 2019-06-28 15:30:13 +02:00
Åke Forslund 2a65623c6d Read vocab the .voc files as lowercase
A common error is to add capitalization in the .voc files when
translating them using the translate tool.
2019-06-25 11:05:44 +02:00
Chris Rogers a40218da18 Add lock/unlock actions 2019-06-20 12:02:34 +02:00
Chris Rogers 395c31cf29 Fix pep8 issues 2019-06-20 12:02:34 +02:00
Chris Rogers e1a2de7046 Add locate 2019-06-20 12:02:34 +02:00
Chris Rogers c966dbe5bd Add basic state support 2019-06-20 12:02:33 +02:00
Chris Rogers 44d51d15f3 Add speak support 2019-06-20 12:02:33 +02:00
Chris Rogers 3602ff8e87 Begin support for state queries 2019-06-20 12:02:28 +02:00
Steve Penrod 8ca4bb8343
Remove abstractmethod for MycroftSkill.stop()
The MycroftSkill.stop() method does not need to be implemented by the majority of skills, no reason to 'require' its implementation with an abstractmethod.
2019-06-10 13:15:59 -05:00
Chris Rogers d71f67f7ea Allow scheduling events a fractional number of seconds in the future 2019-06-09 22:13:44 -04:00
Åke 626c69bc1d Skill settings cleanup (#2140)
* Handle DelayRequests when uploading blank settingsmeta

* Move Api methods to DeviceApi

This includes delete, put and get skill settings/meta

* Cache skill settings for 30 seconds

The skill settings are cached to reduce number of requests to the backend and increase skill loading speed.

* Remove _request_other_settings method

The endpoint is not used anymore

* Fix issue when the settingsmeta fails to load

Remove an old reference to "BLANK_META" left behind in the exception handler for failing to load settingsmeta.
2019-06-05 18:45:15 -05:00
Aditya Mehra b08f090131 Add System QML support for HTML displays (#2138)
Add SYSTEM_HtmlFrame support for html-url and html-raw and override option for all system qml displays
2019-05-31 12:59:46 +02:00
Åke 6357513970 GUI updates (#2114)
* Catch the new system.gui.user.interaction

This will in turn trigger the gui.page_interaction similar to the page flip but page_number will be None

* Fix issue when adding pages

Seems like appending would fail at times

* Add lock around namespace modifications

* Improve argument description for override_idle
2019-05-31 03:44:09 -05:00
ChristopherRogers1991 b5279e480b
Merge pull request #2133 from forslund/feature/yaml-loader
Use SafeLoader to load settingsmeta yaml
2019-05-27 06:57:46 -04:00
Åke Forslund 21efb0fd69 Use yaml.safe_load() to load settingsmeta yaml
safe_load limits the amount of custom methods that can be supplied with
the yaml and supports the basic yaml features.
2019-05-27 12:25:42 +02:00
Åke b1348de6f7 Feature/msm 0.7.6 (#2136)
* Log error when creating Padatious

* Update msm to v0.7.6

This handles connection errors during the startup procedure and improves
the skill_gid when no network is available
2019-05-23 10:16:37 -07:00
Åke 86df2cefd4 Don't create skill settings for Padatious Service (#2132)
Padatious is registered as a FallbackSkill and was pushing settings to
the backend.

This change allows Padatious to flag to the MycroftSkill class
that no settings should be created. This is done via the new optional
MycroftSkill parameter use_settings.
2019-05-23 10:14:08 -07:00
Åke Forslund c3ac9d8ca7 Remove the delete metadata calls when updating settings
The calls are not implemented and functionality will likely change.
2019-05-21 17:21:45 +02:00
Åke Forslund 2208ee178c Switch to getting skill_gid from msm skill entry 2019-05-21 09:23:02 +02:00
Åke Forslund 4518a11528 Add safety around skillMetadata
skillMetadata could be accessed in settings without it when checking if remote update was needed.
2019-05-18 08:29:26 +02:00
Åke Forslund 6eb2aefbaa Delete remote settings before pushing
- restore storing / loading uuid
- use uuid to delete before pushing settingsmeta
2019-05-18 08:29:26 +02:00
Åke Forslund 4a75526de7 Check both endpoints for settings 2019-05-18 08:29:26 +02:00
Åke Forslund 93a0b31b4e Switch endpoint for fetching settings
use the userSkill endpoint instead of skill endpoint to always be able
to get settings no matter who the owner is.
2019-05-18 08:29:26 +02:00
Åke Forslund f6347ae47c Replace hashed meta with skill_gid as identifier
This also removes the notion of an owner skill and all skills may update settings on the server.
2019-05-18 08:29:26 +02:00
Åke Forslund 693bf2c699 Remove BLANK boilerplate content 2019-05-18 08:29:26 +02:00
Åke Forslund 56ed5a657f Re-add support for skill_gid in settingsmeta upload 2019-05-18 08:29:26 +02:00
Aditya Mehra eb32570efa Feature/System_QML (#2121)
Add support for SYSTEM QML functions for show_text() and show_image()

The ui elements used are stored in the mycroft/res/ui folder
2019-05-16 09:09:01 +02:00
Aditya Mehra ccb23f14bf feature/enable sending qml ui over network (#2106)
Enable sending qml ui over network
2019-05-13 10:43:29 +02:00
ChristopherRogers1991 6dd16915a9 Allow settingsmeta to be a yaml file (#2113)
Allow settingsmeta to be a yaml file in addition to the current .json file
2019-05-13 09:34:39 +02:00
Matthew D. Scholefield 09e7a18b77
Merge pull request #2116 from forslund/feature/delay-on-422
Add delay on failure to upload skillsettingsmeta
2019-05-07 19:28:12 -05:00
Åke Forslund 0b11cdac0a Add delay on failure to upload skillsettingsmeta
Mycroft-core won't retry for 5 minutes on a 422, 500 or 501 error.

This adds a DelayRequests Exception which will cause the settings
fetching Timer thread to sleep for 5 minutes
2019-05-07 14:50:17 +02:00
Chris Rogers aaa1a7f55a Add docs and fix IoTRequest repr 2019-05-06 15:57:49 -04:00
Chris Rogers b3d6cc35c0 Add support for values 2019-05-06 15:57:49 -04:00
Kris Gesling 947fadbe1f fix table formatting for docs display 2019-04-20 13:15:39 +09:30
Kris Gesling 88a822727c
Merge pull request #2095 from forslund/docs/tidying
Tidy up the readthedocs documentation
2019-04-20 03:02:56 +09:30
Matthew D. Scholefield 8c09f88e53
Merge pull request #2088 from forslund/feature/audioservice-list
Feature/audioservice list
2019-04-19 00:30:38 -05:00
Åke 7a8ea0b5cc
Merge pull request #2099 from MycroftAI/commonIoT/trigger
Add trigger action
2019-04-16 11:15:34 +02:00
Åke 3841d5c13c
Merge pull request #2096 from MycroftAI/commonIoT/acknowledge
CommonIOT/acknowledge
2019-04-16 11:14:27 +02:00
Chris Rogers 8a75b77204 Add trigger action 2019-04-15 14:01:35 -04:00
Chris Rogers b975f2f9cf file -> audio_file 2019-04-14 18:36:07 -04:00
Chris Rogers 6afadbed4c Remove wait 2019-04-14 18:32:01 -04:00
Chris Rogers 2a6f113151 Add function to acknowledge success non-verbally 2019-04-14 10:11:52 -04:00
Chris Rogers 61e4aeb55f Make temp, heat, ac things instead of attributes 2019-04-14 10:06:00 -04:00
Åke Forslund 6fbb49c1e9 Add some docstrings for CommonPlay/Query skills 2019-04-14 09:51:26 +02:00
Åke 0a887bf6bb Restore settings polling to 1 minute interval (#2091) 2019-04-10 13:38:58 -05:00
Chris Rogers 7641cc00b0 Add thermostat related attributes 2019-04-08 18:19:52 -04:00
Åke Forslund 9248be1691 Add list of available backends to audioservice
The message returned is a dict of all available audio backends as keys
containing 'supported_uris' listing supported uri types (file:// http://
etc.), 'remote' (bool) True if remote), 'default' (bool) true if the
default audio backend.
2019-04-08 15:28:56 +02:00
Åke Forslund bee167c875 Poll settings only every 5 minutes 2019-04-07 00:26:16 +02:00
Åke Forslund 54781a9249 Reverts back to 19.2.2
Revert "Fix a couple of minor issues intruduced by skill_gid (#2079)"

This reverts commit e046377ce1.

Revert "Merge pull request #2075 from forslund/bugfix/msm_wrapper-license"

This reverts commit 18cfbce0ca, reversing
changes made to 82fa314ce9.

Revert "Feature/skillsmeta gid (#2074)"

This reverts commit 82fa314ce9.
2019-04-07 00:01:36 +02:00
Åke e046377ce1 Fix a couple of minor issues intruduced by skill_gid (#2079)
- name collision for display_name function and variable
- name -> self.name
2019-04-05 16:43:47 -05:00
Åke 637166e624 Revert "Remove reliance on hashed meta (#2076)"
This reverts commit 38123a1fc3.
2019-04-05 17:57:06 +02:00
Åke 38123a1fc3 Remove reliance on hashed meta (#2076)
* Fix skill_gid for modified skills

Used the old '_' after device uuid

* Identify skill using gid

When receiving data from server the "identifier" entry is now removed and in it's stead the skill_gid should be used.

This also removes the "fetch other settings" functionallity since that is no longer relevant.
2019-04-04 02:03:08 -05:00
Åke Forslund f60d2372bb Add missing license header 2019-04-02 18:26:44 +02:00
Åke 82fa314ce9 Feature/skillsmeta gid (#2074)
* Add global id basics to settings meta

- All skills will upload a blank settingsmeta
- a skill_gid will be appended to all settingsmeta upload-data
- Added basic function for generating skill_gid

* Use new skill_gid field.

Populate skill_gid directly from metadata

* Separate travis tmp-dirs

- Update travis script to use tempdir for each python version
- Update test script to handle nonstandard tempdirs
- Generate msm folder using tempdir when running create_msm test

* Add title field with pretty name

* Collect and expand "title" as needed

For title use market-place title or name in settings meta or skillname

* Switch skill_manager create_msm test to 19.02

* Remove leading / trailing Skill in display name

Also rename title displayname to match new mycroft-skills-data

* Lock msm_create and mock the name info test_settings
2019-04-02 11:14:49 -05:00
Åke Forslund 466f187eb7 Remove extra LOG statement 2019-03-28 23:29:07 +01:00
Åke d2e6d310ad Run normalized also when raw matches None (#2073)
If no match was found for the non-normalized utterance it would jump to
the exception handler for StopIteration skipping the normalized step
altogether

This changes the next/StopIteration system for list comprehensions
2019-03-28 15:43:28 -05:00
Åke Forslund 381999d5a8 Minor issues
- padatious sentence defaults
- A bit more explanation about the adapt message utterance
2019-03-28 14:50:50 +01:00
Steve Penrod 342c730a97 Normalize utterances before intent handling
Previously Padatious intent matches were performed on non-normalized text, meaning that things like "what's the weather" wouldn't match a Padatious intent but
"what is the weather" would.

The "utterance" in Adapt intent data will still be non-normalized even if the intent match occurred on a normalized utterance. Retaining the existing behavior.

The "intent_failure" data.  In there, "utterance" is always the raw version, "norm_utt" is the normalized one.

Also added better debugging info for intent matching to the log.

Also addresses a rare issue with the old code where the Adapt context could
have been updated even if the Adapt intent wasn't actually invoked due to
a higher Padatious intent match.
2019-03-28 14:48:26 +01:00
Åke feb82a2bb1 Add the SkillGUI method send_event() (#2057)
* Add the SkillGUI method send_event()

Sends raw mycroft.events.triggered messages to the gui for the skills namespace.

Example usage:
  self.gui.send_event('event_name' {'param1': 12, 'param2': 'abc'})
2019-03-27 01:22:05 -05:00
Chris Rogers d04ad5f8b0 Remove enum.auto
Replace enum.auto with a similar, custom function. This is for python3.4
compatibility.
2019-03-24 14:07:49 -04:00
Åke dfa714c56d
Merge pull request #2059 from MycroftAI/feature/padatious-priority
Adjust and document Padatious loose fallback priority
2019-03-21 23:38:25 +01:00
Steve Penrod 41773a039a Adjust and document Padatious loose fallback priority
The loose (conf > 0.5) Padatious match was previously occurring as Fallback
priority 99. The AIML fallback at priority 90 would consume lots of
utterances, interferring with many skills.  Now Padatious runs at priority
89.

Additionally, added documentation of the intent and fallback system, including
guidelines for priorities.
2019-03-21 17:16:07 -05:00
Åke Forslund c3f2b73794 set_active_lang on startup of skills 2019-03-14 11:00:51 +01:00
Steve Penrod 44f60ec6f3 Change default lang to None, not English
Much of the code used "en-us" as the default value when not specified.
This limited the internationalization potential.  Changing the default
to None and adds the ability to define the default lang code from other
locations in code.  E.g.

```python

from mycroft.util.lang import set_default_lang

set_default_lang("en-us")
print("English date: "+nice_date(dt))

set_default_lang("de-de")
print("German date: "+nice_date(dt))
```

This allows easier localization of Skills by having the framework set the default without any changes necessary by the Skill writers.

Other minor changes:
* Changed the default return value of get_gender*() to None instead of False
2019-03-14 10:57:31 +01:00
ChristopherRogers1991 ffd58cb4ef Feature/common io t updates (#2050)
* Split ADJUST into ADJUST and SET

* Use enum names instead of values.

* Add properties to CommonIoTSkill

* property -> attribute to avoid conflict with builtin

* Add increase and decrease actions

* Fix copy/paste error
2019-03-13 22:51:54 -05:00
Steve Penrod 230c3057b4 Give Padatious high and low match passes
Padatious was accepting fairly low confidence matches (0.5).  This
would match a phrase such as "Where is the Empire State Building?" to the
intent "Where were you born?"  (Which is a 0.54 match)

Now there are two passes mad on the Padatious fallback.  The first is
looking for high confidence matches (> 0.8).  Then other fallbacks -- such
as the CommonQuery fallbacks -- have an opportunity to consume the
utterance.  If they don't consume it, Padatious is invoked again with
looser confidence before finally invoking the Unknown fallback.
2019-03-05 03:33:02 -06:00
Steve Penrod 286fa6314f Imporove user feedback during startup
Now the eyes go to a khaki color and "< < < LOADING < < <" displays
during the skill startup.  When Padatious finishes the first training
we now emit a "mycroft.ready" on the messagebus.

A change to the skill_mark_1 to look for "mycroft.ready" instead of
"mycroft.skills.initialized" provides a good visual change to show that
it is ready for use.
2019-02-28 14:58:19 -06:00
Åke 5529acde12
Merge pull request #2030 from MycroftAI/bugfix/hide-warnings
Hide deprecated warning in certain cases
2019-02-28 21:12:17 +01:00
Steve Penrod f5025f5eaf Fix PEP8 2019-02-28 13:15:03 -06:00
Steve Penrod 419a8c531d Hide deprecated warning in certain cases
The deprecation warning was firing off at the load of every skill when
the decorators are being iterated through by internal code (which
includes the self.config with an @property).  Add check for these
special cases to not show a warning.
2019-02-28 13:11:07 -06:00
Steve Penrod 603973ecf3 Typo in Common Query 'encolsure'
Fixed a type in the Common Query scoring system that broke a bonus check.
2019-02-28 12:39:38 -06:00
Steve Penrod d25d91e034 Tweak CommonPlay scoring
The scoring for CommonPlay would favor skills that responded with overly long
matches.  E.g. "Huey Lewis and the News" would be considered a better fit than
just "News" for the request "Play the News"
2019-02-28 11:06:52 +01:00
Steve Penrod d65555c327 Deprecate self.config in skills (#2025)
* Deprecate self.config in skills

Skills should contain their own settings, the self.config concept is being
deprecated.

Also removed the defaults set for several old MycroftAI skills.  The 19.02
version of these Skills initializes the default values using:
```python
self.settings["key"] = default
```

* Update padatious config to work with the config property.
2019-02-28 10:50:08 +01:00
ChristopherRogers1991 cf5d7b80c5 Feature/common io t (#2015)
* Add base common_iot_skill

* can_run takes IoTRequest

* Minor cleanup + documentation

* Fix pep8 issues

* Adjust scene and entity registration.

The controller skill is not guaranteed to be alive before
CommonIoTSkills, so we must call for values when it is alive, in
addition to accepting them at any time from other skills.

* Safer parsing

* Address PR feedback

* Add skill_id to register message

* Minor docstring edits
2019-02-28 01:31:03 -06:00
Åke d3e6a10ecc GUI Remove pages/namespaces (#2002)
* Add remove page methods

* Implement SkillGUI.clear()

The method will now remove the namespace entirely from the gui.

This adds the message gui.clear.namespace

* Remove debug prints from SkillGUI

* Correcting docstring

* More docstring changes

* Remove whitespace added by Github webUI
2019-02-28 00:21:08 -06:00
Åke 8e495870c2 Feature/skill manager error checks (#1981)
* Attempt to create skill directory if not existing

* Handle missing priority skills

* Minor update of comments

* Handle skill load exception

Make sure an exception while trying to load/reload skill doesn't shutdown thread.

* Handle MsmException during SkillManager creation

If SkillManager can't be created due to an MsmException wait for network connection and retry.

* Update immediately if skill install file is missing

Missing skill install file indicates that this is a new venv and the requirements of the skills will need to be reinstalled.

* Add basic test for skill_manager

Basically only creating the skill_manager but it ensures that msm can be used on all supported python versions
2019-02-28 00:18:48 -06:00
Åke 6c14d7bc36 Refactor/19.02 removes (#2019)
* Remove the deprecated emitter

* Remove channels config key for listener

This has never been used.
2019-02-28 00:09:47 -06:00
Åke 11dae04451 Feature/threaded emitter (#2008)
* Update to pyee 5.0.0

- Update requirement
- Make the SkillSettings class hashable

* Update adapt to 0.3.2

* Upgrade websocket-client

* Remove special threading for common query
2019-02-27 23:41:52 -06:00
Åke 71088f8fcb Feature/update requirements (#1998)
* Update to pyee 5.0.0

- Update requirement
- Make the SkillSettings class hashable

* Update adapt to 0.3.2

* Upgrade websocket-client
2019-02-27 23:41:24 -06:00
Åke 84754668a6
Merge pull request #2018 from MycroftAI/refactor/default-message-vals
Add default values to Message attributes
2019-02-26 16:34:17 +01:00
Åke Forslund be72733abb Fix context checks
- intent_service
- MycroftSkill
2019-02-26 15:46:12 +01:00
Åke 4de2bee18c
Merge pull request #2017 from MycroftAI/feature/first-boot-check
Try updating the system on boot when not paired
2019-02-26 13:53:09 +01:00
Åke ded9f8a11d
Merge pull request #2016 from MycroftAI/feature/ntp-reply
Wait for ntp sync complete message
2019-02-26 10:52:49 +01:00
Matthew D. Scholefield af2b448321 Try updating the system on boot when not paired
This sends a new system.update.check message when the device is booted and not paired
It is not sent every boot because the command could upgrade across major versions which the user could not want.
2019-02-26 02:37:59 -06:00
Matthew D. Scholefield 59ede0de8c Wait for ntp sync complete message
We can easily wait for the message, even if it doesn't exist
2019-02-26 00:55:51 -06:00
Åke b59fa51b1e remove compaitbility methods for installer skill (#2006)
- load_skills_data()
- write_skills_data()
2019-02-25 00:42:06 -06:00
Åke Forslund 40eca55cf2 Expand .voc files in MycroftSkill.voc_match()
- Create a read_vocab_file() function that normal vocab loading and voc_match both uses. This function handles blank lines and comments
- Use a simpler regex instead of word logic to match
- Add a couple of test cases for the method
2019-02-22 18:49:01 +01:00
Steve Penrod eac364f0f8 Fix behavior of MycroftSkills.voc_match()
Previously the voc_match() method had several problems:
* Blank lines in the .voc file would cause it to match all strings
* Comments weren't ignored
* Substrings matched so "book" would match "ok", for instance
2019-02-22 04:25:57 -06:00
Åke 7674fa1c65
Merge pull request #1995 from MycroftAI/feature/settings-cleanup
Clean up some exception handling in settings code
2019-02-18 09:11:01 +01:00