OpenHAB skill enhancement to use Skill settings fails


Can anyone help with a problem with the OpenHAB skill, or more specifically, what might be a back-end issue with settingsmeta.yaml please ?


A recent commit enhanced the OpenHAB skill to support skill settings, rather than mycroft.conf manual config, however the account control panel Skills page Configure Your Skills doesn’t show the OpenHAB skill, and manual editing gives upload settings errors.
Manual changes to the skill config file works fine, but gives server upload errors.


After many useful months of using Mycroft to control my OpenHAB home automation server via the OpenHAB skill, it stopped working after upgrading to 19.08.

This commit made changes to mode from mycroft.conf to skill settings, which is should be a useful enhancement:

Unfortunately, the skills Marketplace shows the openHAB skill in the IoT category, however attempting to install via the skills marketplace doesn’t seem to make any changes.

My Mycroft account Skills page Configure Your Skills doesn’t show the OpenHAB skill, however the command line on my Mark 1 does work, and shows the latest version:

$ msm list
...stuff deleted...
openhab-skill.openhab	[installed]
...stuff deleted...

$ sudo msm update
...stuff deleted...
INFO - Nothing new for openhab-skill.openhab
...stuff deleted...


After looking in the logs to find the config error, I manually hacked the skill config JSON file to get the skill working.

After restarting the skills, the OpenHAB skill originally failed to get local settings:

sudo service mycroft-skills restart
tail -f /var/log/mycroft/skills.log
2019-10-14 12:07:55.916 | INFO     | 29592 | mycroft.skills.skill_loader:load:112 | ATTEMPTING TO LOAD SKILL: openhab-skill.openhab
2019-10-14 12:07:55.933 | INFO     | 29592 | mycroft.skills.settings:get_local_settings:78 | /opt/mycroft/skills/openhab-skill.openhab/settings.json
2019-10-14 12:07:55.942 | ERROR    | 29592 | mycroft.skills.skill_loader:_create_skill_instance:222 | Skill __init__ failed with InvalidURL('Failed to parse: None:None',)
Traceback (most recent call last):

My workaround was to manually edit the openhab-skill.openhab/settings.json file to add add the host and port, then restart:

vim /opt/mycroft/skills/openhab-skill.openhab/settings.json
  # add host and port
  {"__mycroft_skill_firstrun": false, "host": "openhabserver.local", "port": "8080"}

sudo service mycroft-skills restart
tail -f /var/log/mycroft/skills.log

Removing the old config also tidied things up:

sudo vim /etc/mycroft/mycroft.conf
# removed...
  "openHABSkill": {
    "host": "opehabserver.local",
    "port": "8080"

This restored the skill so switch off radio started working again.

New error uploading config

It does look like the Mycroft server isn’t recognising the OpenHAB skill settings as a regular task tries to upload the local settings I manually created, and fails:

2019-10-14 12:58:55.158 | WARNING  | 30805 | mycroft.skills.settings:_update_settings_meta:301 | DEPRECATION WARNING: The "name" attribute in the settingsmeta file is no longer supported.
2019-10-14 12:58:55.644 | ERROR    | 30805 | mycroft.skills.settings:_issue_api_call:310 | Failed to upload skill settings meta for @...UUID removed...|openhab-skill
Traceback (most recent call last):
  File "/opt/venvs/mycroft-core/lib/python3.4/site-packages/mycroft/skills/", line 307, in _issue_api_call
  File "/opt/venvs/mycroft-core/lib/python3.4/site-packages/mycroft/api/", line 382, in upload_skill_metadata
    "json": settings_meta
  File "/opt/venvs/mycroft-core/lib/python3.4/site-packages/mycroft/api/", line 69, in request
    return self.send(params)
  File "/opt/venvs/mycroft-core/lib/python3.4/site-packages/mycroft/api/", line 152, in send
    return self.get_response(response, no_refresh)
  File "/opt/venvs/mycroft-core/lib/python3.4/site-packages/mycroft/api/", line 174, in get_response
    raise HTTPError(data, response=response)
requests.exceptions.HTTPError: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>


As the server backend isn’t offering parameters for the OpenHAB binding, I suspect the definition of the settingsmeta.yaml isn’t being recognised.

The skill file is here:

Looking at the Mycroft docs, the only obvious difference is a lack of a value: "", although this is hinted as being optional:

Any ideas please?

Using the fetched settings would need to be shifted from the __init__() to initialize() method.

I’ve been trying to make the difference between these methods more clear in the documentation.

Let us know if that resolves the issue


Thanks for that @gez-mycroft - fixed! :slight_smile:

As a quick and dirty test, I edited my local version of to leave only super() in __init__(), moving the MycroftSkill methods into initialize().

cd /opt/mycroft/skills/openhab-skill.openhab
sudo vim  /opt/mycroft/skills/openhab-skill.openhab/
sudo service mycroft-skills restart

The same upload_skill_metadata error continued, so after reading the docs you kindly pointed to, I worked out that the skill config settings are actually registered from the client to server. For some reason, I’d assumed the settings were defined server side from the skill code - nope!

The next fix was to add double quotes around the field labels and values in settingsmeta.yaml , and re-order the entities to match the example.

After a mycroft-skills reatart, I was surprised to see openHAB with the parameter entry fields ready to set in .

For the record, the tested settingsmeta.yaml contains:

name: openHAB
    - name: Connection
        - name: host
          type: text
          label: "OpenHAB server IP"
          value: ""
        - name: port
          type: number
          label: "OpenHAB server port"
          value: "8080"

@mortommy - I’ll raise an enhance request on GitHub referencing this fix now…

Thanks All!

1 Like