openHAB Cloud: trouble understanding current state of ecosystem

Short summary:

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:

  1. 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.

  2. I’ve installed the openHAB skill from the Alexa Skill Store and granted access to myopenhab.org.

  3. 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.

  4. 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.

  5. 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.

  6. I’ve triggered a smart device search via the Alexa app.

So here are my questions:

  1. 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?

  2. Why does the exposed item not show up on myopenhab.org? What do I have to do for that?

  3. 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?

  4. Are the rumors true that myopenhab.org is not fully functional anymore to high load?

Best regards,
ceedee

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:

https://myopenhab.org/rest/items/

You can just open it with your web browser.

You can search for your item labeled with “A Lamp” there.

Most important are your labels. They have to be unique and EVERY item you want to see in Alexa needs a label.

1 Like

@Celaeno1 I’ve posted the item syntax I used in my .items-file above. Did I do something wrong?

No. Both is possible. For testing I would use this:

Switch IlightsLamp "A Lamp" <light> [ "Switchable" ] {channel="osramlightify:power:99-99-99-00-11-5E-1A-09:switch"}

You should use [ “Switchable” ] with a space between the brackets and the quotes.

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.

First get rid your exposed items from “Openhab Cloud Connector Configuration”. Then restart the “Cloud Connector Service”.

Then search in

https://myopenhab.org/rest/items/

for your word: Swichable

If it is there, then search in Alexa APP.

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?

No. You should search for Switchable in:

https://myopenhab.org/rest/items

Best you search for the phrase: “tags”:[

Then should be there: right beside the word Switchable, and left beside your label: “A Lamp”.

If there are OTHER tags inside, see if there is also a lable and a keyword like Switchable or Lighting or heating in the same line.

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.

When you open it in any normal web browser there is NO limit.

https://myopenhab.org/rest/items

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.

See also this:

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).

I’ve searched for similar bugs being reported and came to https://github.com/openhab/openhab-alexa/issues/253, where a “fix” was committed in https://github.com/openhab/openhab-alexa/pull/273/commits/ffcfa53b33a3846a646baf5e29d9c67f3e70899d. The fix consists just of a retry to increase the chance of a succesful retrieval of the items.

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.

What about splitting your .items file.

According to Openhab docs you can create as many .items files as you like.

I would then put all tagged items into one special file e.g. alexa.items.

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?

I’ve created a GitHub issue for this: https://github.com/openhab/openhab-cloud/issues/284
I’m not sure if it will be accepted, but I gave it a try.

1 Like

400 items (are synced) even with only ONE item in .items file?

This sounds like you have set “Simple Item Linking” in PaperUI --> Configuration --> System

If you have .items files for ALL your items then you don’t need that. But you maybe have to change your ThingIDs in .items files.

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.

AFAIK, no.

But it is just a search and replace of the ThingIDs.

Any simple Editor has this function.

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 :wink: