settingsmeta.json
or settingsmeta.yaml
file. This file must be in the root directory of the Skill and must follow a specific structure.settingsmeta.json
file:settingsmeta.yaml
file:false
is surrounded by "quotation marks". This is because Mycroft expects a string of "true"
or "false"
rather than a Boolean.skillMetadata
object. This object must contain one or more sections
elements.name
attribute that is used as the heading for that section, and an Array of fields
.fields
. Each field is a setting available to the user. Each field takes four properties:name
(String)name
of the field
is used by the Skill to get and set the value of the field
. It will not usually be displayed to the user, unless the label
property has not been set.type
(Enum)text
: any kind of textemail
: text validated as an email addresscheckbox
: boolean, True or Falsenumber
: text validated as a numberpassword
: text hidden from view by defaultselect
: a drop-down menu of optionslabel
: special field to display text for information purposes only. No name or value is required for a label
field.label
(String)value
(String)settingsmeta
file, they will be presented to the user on their personal Skill Settings page.settings.json
file. This file is automatically created when a Skill is loaded even if the Skill does not have any settings. Your Skill then accesses the settings from this file. Nowadays the file is located in the Skill's XDG_CONFIG_DIR (usually ~/config/mycroft/skills/<skillname>
), however if a settings.json
file already exists in the Skill's root directory (the deprecated location) that location is used for compatibility.show_time
variable from our example above we would use the Dict.get
method:get
method will return None
. Instead of assigning this to a variable and then testing for None
, we can provide a default value as the second argument to the get
method.show_time
setting has not been assigned, it will return the default value False
.Dict.get
method above rather than accessing the setting directly with:settings
dictionary will not be available in your Skills __init__
method as this is setting up your Skills Class. You should instead use an initialize
method which is called after the Skill is fully constructed and registered with the system. More detail is available at:settings.json
. To perform some action when settings are updated, you can register a callback function in your Skill.on_settings_changed
method to be our callback function. We have then immediately called the method to perform the relevant actions when the Skill is being initialized even though the Skills settings have not changed.on_settings_changed
method we have assigned the value of the show_time
setting to a local variable. Then we have passed it as an argument to another method in our Skill that will trigger the display of the time based on its value.show_time
setting will persist until a new setting is assigned locally by the Skill, or remotely by the user clicking save
on the web view.