My plans are to move on from Hue Emulation to openHAB Cloud to expose items to Alexa and other cloud services. Yet I’ve not succeeded in exposing openHAB items to my Echo devices.
It seems to me that a lot of the tutorials I find on the web are outdated. I’m even not sure if the openHAB cloud is still fully operational since I’ve found notes that due to a high load of the database used on server side some features have been shut off.
Long story:
Here’s what I’ve done so far and experienced on the way:
I’ve created a myopenhab.org account using uuid and secret from my openHAB 2.4 raspi. Furthermore I’ve installed the openHAB Cloud Connector 2.4.0 addon. Via PaperUI I’ve set to connector addon to operate against https://myopenhab.org/, allowing for Remote Access and Notifications. I hit save and rebooted my openHAB raspi. When openHAB was booted up again, myopenhab.org showed the online state of my raspi. Furthermore I can access my local sitemaps etc. from myopenhab.org.
I’ve installed the openHAB skill from the Alexa Skill Store and granted access to myopenhab.org.
No exposed items are shown on myopenhab.org in the items tab. I tried to expose an item via PaperUI configuration of the Cloud Connector addon by expanding the dropdown “Items to expose to apps such as IFTTT”, but the dropdown was empty.
I’ve tried adding an item via expert mode and manually entering the item name. At first this did not work unless I changed the item configuration from
Switch IlightsLamp "A Lamp" <light> ["Switchable"] {channel="osramlightify:power:99-99-99-00-11-5E-1A-09:switch"}
to Switch IlightsLamp "A Lamp" <light> {alexa="Switchable", channel="osramlightify:power:99-99-99-00-11-5E-1A-09:switch"}
Now that single item appeared in the dropdown, even with a checkmark. But still, it is not visible on myopenhab.org.
Via a GET request against https://myopenhab.org/rest/items/ I found out, that the items of my openHAB raspi are somewhat synced to myopenhab.org. At first, I thought, that not all items are synced, but I suppose that this was due to a 64KB limit for this get request. When performing a GET against https://myopenhab.org/rest/items/ I got a proper response for items not listed within the first 64KB.
I’ve triggered a smart device search via the Alexa app.
So here are my questions:
In tutorials / videos on the Cloud Connector people could simply add items to expose via PaperUI, i.e. not using the expert mode. What am I doing wrong?
Why does the exposed item not show up on myopenhab.org? What do I have to do for that?
It seems that there’s difference whether I want to expose items to IFTTT or the Alexa. Can anybody explain how to expose items to the Alexa?
Are the rumors true that myopenhab.org is not fully functional anymore to high load?
As far as I know, that feature was disabled. People were exposing all their items. overloading & crashing the server. You can set up your own hosted cloud server though since the code is freely available.
For using your items with Alexa ONLY, you DO NOT HAVE TO EXPOSE ANY item.
In openhab you must tag your items properly or use the new metadata. You have to put them either into an .items file or if you create and link items to channels via PaperUI, you can add tags via REST API. How to add metadata using different way than via .items file, I don’t know actually.
All items (tagged/metadata or not) can be found here:
Ok, then I’ll revert my changes to the from state. Is rebooting or some refresh at any other service required for testing? I’ll do a rescan of my devices after a reboot of openHAB.
I though “Switchable” is a tag which defines the modes of operation on this item. The addressable name for this item should be “A Lamp” afaik. For finding the item in myopenhab.org I can look it up via https://myopenhab.org/rest/items/IlightsLamp, right? Should I check specific attributes?
To what purpose? As written in my initial post, I cannot rely on the response of that REST call, since it exceeds a 64KB-Limit, i.e. resulting in truncating the response. That’s why I’m asking what exactly I shall look up – I was guesing I shall look up something of the item to control via Alexa: IlightsLamp.
To find out if there are any tags without a label and/or keyword.
Alexa finds only “devices” when a label and a keyword like Switchable is bound to an item. If a label is missing, Alexa finds nothing. E.g. you have 25 tags and 24 have a label, then it doesn’t matter having them all correct. The one without the label is the breaker.
Ok, I’ve come closer to finding out what the problem is:
Despite my claim that there’s a 64KB limit to the REST-API, which is in fact wrong, there is a problem with the REST-API which conflicts with the Alexa skill for openHAB.
When retrieving https://myopenhab.org/rest/items with Firefox, Chrome or even curl from a Linux machine I did not get the full JSON back. It stopped somewhere at a 8KB boundary. Curiously, when repeating the HTTP request, it sometimes stopped at another size (but always at a 8KB boundary).
Knowing that I’ve removed all items from my configuration except one test item with proper tagging. Still, due to a lot of things configured (which implicitly created items due to a setting in PaperUI), over 400 items are contained in this JSON, but few enough so that refreshing a couple of times in my browser led to a complete JSON response.
Now I re-triggered a device search via the Alexa app and it found my test item. I could see in the log viewer that when performing a voice command with Alexa for the test item, its state changed.
So I conclude, that the same problem I’ve refreshing the URL in the browser, the Alexa skill has, too. I cannot confirm this without having access to logs, but I find it very likely.
Unfortunately, this limits my options. All I can do is file another bug report on GitHub.
My items are already split into many files. Regardless of this and regardless of tagging, ALL items are synced to myopenhab.org. Is there a way to specifically sync items to myopenhab.org?
Yes, Simple Item Linking is the cause for these implicit items. I could change it, of course, but this requires a tremendous amount of work. Or is there some converter / converter script?
A possible workaround could be to put all Alexa relevant items into a single file, temporarily delete all other item files, have Alexa discover the devices and then then re-integrate the deleted item files. The Alexa skill seems to require access to the full list only for device discovery. I can control the one discovered device right now via Alexa.
I think I’ve to create thing-files on my own, don’t I? Will turning of simple linking mode just stop the implicit creation of items, or does it interfer with my things as well? If not, why would I have to adjust thing ids? I’m not familiar with manual creation of most of my things – this is why I would prefer an automatism