Hi,
My experience of many years of integrating complex systems is that breaking tasks down into individual steps, each checked with testing of some sort, is the best approach. Finding where a log file is, and looking to see what it contains tests your understanding.
More often than not, logs have shown a component didn’t work the way I thought, and I learned something. It’s also motivating to see a part of a complex system work - even if it’s a small part.
With that in mind, here’s a step-by-step…
Configure and test OpenHAB
Before working with Mycroft, I’d suggest checking that…
- Does your OpenHAB install work?
- Can you switch your desired Items on or off via an OpenHAB SiteMap?
- Can you see status changes on an OpenHAB web interface, and see the changes on the ESH console?
I say that particularly as the Item definitions you gave earlier don’t include any binding information, and the Sonos binding has many Channels to control (i.e. not just on/ off, like a simple switch). Start simple - confirm you understand and have tested on /off of one device in OpenHAB.
In case you’ve not seen then, there are quite good confg docs here:
https://docs.openhab.org/configuration/index.html
I access the OpenHAB console by SSH’ing into my server, and then SSH’ing a second time locally into OpenHAB. If you use OpenHABian, this may be simpler with a web-based log viewer.
https://docs.openhab.org/administration/console.html
Before moving to Mycroft, you can also manually test the interface Mycroft will use - REST.
- test the openHAB REST interface by manually opening a web browser and going to: http://
your OpenHAB server:8080/rest/items
- This should show a JSON formatted list of all your items which is not easy to read, but very useful.
- Do the same as Mycroft will do, and use CONTROL-F in the browser to search for Switchable or Lighting tags.
You should see Items with :
"tags":["Switchable"],
"tags":["Lighting"],
Your last post suggests you should be able to browse to:
http://192.168.1.244:8080/rest/items
If you don’t get a list of items, check the OpenHAB console, any firewalls (none on a RPi, but you might be using a PC/ Mac), if the software is running, and your IP addresses.
Configure and test Mycroft OH2 binding - based on a Mark 1
Once you have tested OpenHAB (and only after you’ve tested…
), you can start on Mycroft.
- Update, install and test Mycroft and the OH2 binding by SSH’ing into Mycroft:
sudo msm update
msm search openhab
msm info openhab-skill
msm install openhab-skill
msn list
I didn’t see msm list the openhab-skill as installed, but it was there and worked.
- Mycroft skill config seems to be in two places:
cat /etc/mycroft/mycroft.conf
cat /home/mycroft/.mycroft/mycroft.conf
- I found adding
openHABSkill params into /home/mycroft/.mycroft/mycroft.conf worked for me.
cat /home/mycroft/.mycroft/mycroft.conf
{
"tts": {
"mimic": {
"path":"/usr/local/bin/mimic"
}
},
"SkillInstallerSkill": {
"path": "/usr/local/bin/msm"
}, <<<<<<======= N.B. this extra comma!
"openHABSkill": {
"host": "youropenhabservername",
"port": "8080"
}
}
N.B - note the extra comma before the new openHABSkill block.
- Restart the skills and watch the logs:
sudo service mycroft-skills restart
tail -f /var/log/mycroft-skills.log
python -m mycroft.client.text.main --quiet
- You should see lots of scrolling debug information, either by tailing the log file directly, or by using python to open the Mycroft console. The console allows you to type in a spoken command - ideal for testing.
- Speak (or type into the console)
refresh openhab items
- You should see a
connectionpool line connecting from Mycroft into OpenHAB and hear All right. I found nn items
- If you don’t - check the OH2 REST interface via a browser again, and look for errors in both OH2 and Mycroft logs.
- Speak (or type into the console)
list openhab items
- You should hear
Found the following items: .... and a list of the Item names.
- If the list isn’t what you’ve tagged in the OH2 config, check the OH2 *.items config - again, use the manual browser test above to look for the tags Mycroft is looking for (Switchable, Lighting).
You should now be able to say something like… turn on mydevice light, and see Mycroft connect to OpenHAB and the Item turn on.
I hope this helps you (and hopefully others…) get Mycroft turning your home automation on and off via OpenHAB.