Creating my first skill with essentially no experience - Mycroft MagicMirror skill


#41

@KathyReid Making an image of the Pi with both installed should not be that hard. The only thing is I will have to do it from scratch as all of the images I have made for myself as “backups” contain my personal information and keys to different API’s. Another tough thing will be finding time, it’s summer now and my kids are very active. I’ll see what I can do. Oh, and the two installs require just more than will fit on an 8gb card. So I’ll have to learn how to crunch down the partition of a 16gb card to just the right size to make the image as small as possible.


#42

@KathyReid @forslund I’ve finally spent a little time to correctly configure the ipwhitelist in the config.js of my MagicMirror and can include the instructions in the README for the magic-mirror-voice-control-skill repo.

I should be able to change the code for the skill to allow users of any Mycroft (Mark 1, Picroft, Mark 2, etc.) to set the ip of their MagicMirror and not require the instance of Mycroft to be located on the same RPi. I have not done that yet, however I will work on the code changes some this weekend. This will make the skill available to a much wider audience.

It will probably take some time to figure out the best way for users to “tell” Mycroft what the ip address of their MagicMirror is. obviously the CLI would be easiest, but I would really like Mycroft to first check to see if the ip has been set when it first loads the skill. If the ip has not been set, have Mycroft ask the user by saying something like “to activate the magic-mirror-voice-control-skill you must first tell me your mirror’s ip address” expect.response=true. Then the user could utter “192 dot 168 dot 1 dot 120” for example, or just type it into the CLI. If the ip has already been set, just continue to load the skill, but add error handling if the ip changes or the Mirror is unavailable.

Any thoughts?


#43

There is also the option of using the skill settings at home to enter the ip address via text. Not as cool but should be functional.


#44

That’s a good point Ake - more info here


#45

@KathyReid @forslund I have successfully written the code changes to the magic-mirror-voice-control skill. The skill will now work with any instance of Mycroft. Whether it be a Picroft, Mark 1, or any other version of Mycroft. The skill will check to see if the MagicMirror’s ip has been configured by looking in the skill’s directory for the ip.json file. If it does not exist, Mycroft will tell the user that to activate the skill the user needs to tell Mycroft what the MagicMirror’s ip is and will then save the ip.json file with the address that the user utters. Of course the user could always type the appropriate command into the CLI if they wish.

I have included error handling that will verify that it is a valid ip address, and that the MagicMirror is accessible at that ip address through the MMM-Remote-Control module.

I am still unsure how to test the skill to have it added to the Mycroft skills repo. Short of someone trying it out on an existing Mycroft platform that also has a MagicMirror with a properly installed MMM-Remote-Control module available on their home network.

While I appreciate the suggestion of using the home.mycroft.ai to allow users to configure the ip, I know personally I would rather do that locally and by speaking directly to Mycroft instead of having to store that information somewhere else. Also, the simplicity of being able to have mycroft automatically reload the skill if I update the ip by voice command seemed preferable to me as well.

What do you suggest my next steps should be?

Cheers!
Dave


:bulb: Mycroft Magic Mirror
#46

I’ve posted an example of the magic-mirror-voice-control-skill on the MagicMirror Forum:

Yet another AI for MagicMirror: This time it’s Mycroft.

I’m hoping to get more feedback about other improvements that can be made.

FYI


#47

Incredible work, @dmwilsonkc!

Testing

This is a challenge that we’ve been discussing a lot within the Skills Team. Several Mycroft Skills use third party devices or services that cannot easily be tested without either having additional equipment available or knowing the third party API well. To work around this, we decided that if there was one other person (ie not the Skill Author) in the community to “vouch” for the Skill then we would accept it. I don’t know here whether there are any other people in the community running Magic Mirror or interested in doing so - don’t suppose you have anyone in mind? If we can get them to “vouch” for the Skill then the next step would be to submit this Skill to the mycroft-skills repo, 18.02 branch.

Updating the IP address

Using Skill Settings it would be possible to allow the user to configure the IP address on home.mycroft.ai, but I don’t know whether this setting is mutable using any methods from the MycroftSkill class within a Skill. @forslund do you know if this is possible?


#48

@KathyReid I may have been a little confusing in my earlier post. I have already configured the skill to update the MagicMirror’s IP address without using home.mycroft.ai. All the user needs to do is say “hey Mycroft”… “Set mirror IP address to 192 dot 168 dot X dot XXX” or type it into the CLI and Mycroft will verify that it is a legitimate IP address and save the ip.json file in the skills directory and reload the skill. When the skill reloads it verifies that Mycroft can actually communicate with the MagicMirror on that IP address. If not, it asks the user to verify the IP address and then stops. If it does connect, it tells the user that it has successfully connected to the MagicMirror. So no need to have the user go to home.mycroft.ai.

This is assuming that the only time a user is trying to issue commands to the MagicMirror is when they are at home on their local network. This skill will not work over the Internet… Unless the user can send commands to Mycroft located at home via text or app via a mobile device. Mycroft and the MagicMirror need to be on the same local network. And the MagicMirror’s ipwhitelist needs to be configured to accept incoming requests from Mycroft’s IP address.

I just wanted to avoid using the home.mycroft.ai if possible. This way, it’s all stored on the local machine, and can be changed by just telling Mycroft to change it if need be.