forslund / cmd_skill

A simple mycroft skill for launching shell scripts and system commands
GNU General Public License v3.0
12 stars 7 forks source link

How to configure on a Mark1? #3

Closed maglub closed 5 years ago

maglub commented 5 years ago

Hi,

I am trying to get this working, but I am perhaps a bit too new to the config.

I have tried the following:

msm install https://github.com/forslund/cmd_skill

And now, I am stuck... I have no idea what to configure and how?

pi@mark_1:~/skills/cmd_skill.forslund $ ls -al
total 80
drwxr-xr-x  7 mycroft mycroft  4096 May 10 08:04 .
drwxrwxrwx 40 mycroft mycroft  4096 May 10 07:58 ..
drwxr-xr-x  8 mycroft mycroft  4096 May 10 07:58 .git
-rw-r--r--  1 mycroft mycroft     6 May 10 07:58 .gitignore
-rw-r--r--  1 mycroft mycroft 35147 May 10 07:58 LICENSE.txt
-rw-r--r--  1 mycroft mycroft   676 May 10 07:58 README.md
-rw-r--r--  1 mycroft mycroft  1863 May 10 07:58 __init__.py
drwxr-xr-x  2 mycroft mycroft  4096 May 10 07:58 __pycache__
drwxr-xr-x  3 mycroft mycroft  4096 May 10 07:58 dialog
drwxr-xr-x  3 mycroft mycroft  4096 May 10 07:58 regex
-rw-r--r--  1 mycroft mycroft    35 May 10 08:00 settings.json
drwxr-xr-x  3 mycroft mycroft  4096 May 10 07:58 vocab

In my cmd_skill directory there is a settings.json file, which contains the following:

pi@mark_1:~/skills/cmd_skill.forslund $ cat settings.json 
{"__mycroft_skill_firstrun": false}

I created a script, which should put the date into /tmp/magnus.out

pi@mark_1:~/skills/cmd_skill.forslund $ cat /home/forslund/scripts/generate_report.sh 
#!/bin/bash

date >> /tmp/magnus.out

What would my next step be, so that I can tell mycroft to run the skill?

forslund commented 5 years ago

Hi,

This is quite an old skill (created before settings.json was a thing) so it uses the mycroft.conf for configuration.

mycroft.conf is located under /home/mycroft/.mycroft on the mark-1 to edit it you need to switch user to the mycroft user:

sudo su mycroft

then use nano (or an editor of your choice) to edit /home/mycroft/.mycroft/mycroft.conf

It usually looks like this when first opening:

{
  "max_allowed_core_version": 19.2
}

Then add the skill config to the structure as provided in the readme. example:

{
  "max_allowed_core_version": 19.2,
  "CmdSkill": {
      "alias": {
        "generate report": "/home/forslund/scripts/generate_report.sh"
      }
  }
}

Note the added , after the 19.2. json is very strict on these kinds of things.

I've started on modernizing the skill to allow using the settings.json and maybe even home.mycroft.ai's skill settings.

maglub commented 5 years ago

Thanks a lot for the pointers!