Mycroft Community Forum

Scripting skill

https://github.com/jumper047/mycroft-scripting-skill

This skill allows you to write simple scripts and activate them with custom intents. For example, if you want to interact with home assistant but don’t like boring “switch on”, you cant write script triggering with “illuminate bedroom”, which inside mycroft will be translated to “switch on light in bedroom”, so you should not tinkering with home assistant’s plugins source codes to change activation phrases. Ofcourse scripts can be more complicated, you can execute multiple commands by one trigger etc - plugin’s readme contains few examples. Plugin is on early stage, and source code is a mess, but at least basic functions works fine. I’ll be glad if you share your usage scenarios/ideas/etc!

Installation

Just do msm install https://github.com/jumper047/mycroft-scripting-skill.git. No additional libreries required.

Usage

For now the only way to edit scripts is the config file located at ~/.mycroft/skills/ScriptingSkill/scripts.yaml
Open it, edit, save and say “Reload scripts”. That’s all.
There is the config file’s structure:

skill name:
- intent string
- actions string

another name:
- intent string
- action string

Scripts examples

Quick and drity replacement for flip coin skill:

flip a coin:
- (please|) flip a coin
- one_of(say tails|say heads)

Night light automation

night light:
- (switch|turn) on {switch} temporarliy; turn on
- switch on {switch} && sleep(50) && switch off {switch}
3 Likes

Hi Jumper - welcome to the forums and thanks for posting your Skill!

It’s a cool idea to let people create new intents or alias existing ones very quickly.

I wanted to point out our filesystem methods that might be useful for storing the scripts.yaml file. Using these will ensure the file is in a user writable directory and won’t get touched if the Skill gets updated.
https://mycroft-ai.gitbook.io/docs/skill-development/skill-structure/filesystem