Strange error when updating an item file

I am seeing the same as @Elad_Mor with or without the underscore and trying to configure my Alexa network shows zero items during Device Discovery in the app.

What ping are you getting to the myopenhab.org server?

Also does this link give you your items? If not using openhabian replace with your IP of your server…
http://openHABianPi:8080/rest/items/
The items will need both a TAG and also a LABEL, at least with the google home it will not work unless you add labels to your items, not sure if the same applies to Alexa.

What is the above url suppose to show?
I get ALOT of text, which mainly seems like my items. But it doesn´t look like something right or usefull?

It is supposed to show all your items in JSON FORMAT. That is the raw data the cloud connector fetches your items in before sending it onto the cloud server.

Example of my stripped down output is below. I seem to have a unique issue where I can only get 5 tagged items to sync, any more tags and it fails:

[{"link":"http://openhabianpi:8080/rest/items/BabyMonitor","state":"NULL","editable":false,"type":"Switch","name":"BabyMonitor","label":"Baby monitor","tags":["Switchable"],"groupNames":[]},{"link":"http://openhabianpi:8080/rest/items/FeedingLights","state":"NULL","editable":false,"type":"Switch","name":"FeedingLights","label":"Feeding lights","tags":["Switchable"],"groupNames":[]},{"link":"http://openhabianpi:8080/rest/items/ChangingLights","state":"NULL","editable":false,"type":"Switch","name":"ChangingLights","label":"Changed lights","tags":["Switchable"],"groupNames":[]},{"link":"http://openhabianpi:8080/rest/items/SleepingLights","state":"NULL","editable":false,"type":"Switch","name":"SleepingLights","label":"Sleeping lights","tags":["Switchable"],"groupNames":[]},{"link":"http://openhabianpi:8080/rest/items/TVDimming","state":"NULL","editable":false,"type":"Switch","name":"TVDimming","label":"TV dimming","tags":["Switchable"],"groupNames":[]}]

Edit: Since it has no carriage/line returns it shows as a single line here but in a browser if you zoom in and out you can get it to display 1 item per line. Hold CTRL button down and use your mouses scroll wheel.

@itbeyond @Elad_Mor do you have a label the thing in quotes after the item name ?

This is required or Alexa will not function. The Alexa docs as well as the google docs don’t explicitly state this, but a label is required.

For example

Switch item_name “item label” [ “Lighting”…

Failure to have the item label will cause Alexa to discover no devices.

@matt1 & @Thedannymullen Ping results as follows:

ping myopenhab.org
PING myopenhab.org (139.162.171.235) 56(84) bytes of data.
64 bytes from li1488-235.members.linode.com (139.162.171.235): icmp_seq=1 ttl=49 time=365 ms
64 bytes from li1488-235.members.linode.com (139.162.171.235): icmp_seq=2 ttl=49 time=365 ms
64 bytes from li1488-235.members.linode.com (139.162.171.235): icmp_seq=3 ttl=49 time=365 ms
64 bytes from li1488-235.members.linode.com (139.162.171.235): icmp_seq=4 ttl=49 time=365 ms
64 bytes from li1488-235.members.linode.com (139.162.171.235): icmp_seq=5 ttl=49 time=364 ms

My /rest/items shows results however I have only 1 light configured with tags and in the items it looks like this:

Switch Kitchen_PantryLights “Pantry Lights OH” (gDevices,gRoom_Kitchen) [ “Lighting” ] {mios=“unit:vera,device:100/service/SwitchPower1/Status”}

In the /rest/items output it appears like this:

{“link”:“http://openhabianpi:8080/rest/items/Kitchen_PantryLights",“state”:“OFF”,“editable”:false,“type”:“Switch”,“name”:“Kitchen_PantryLights”,“label”:"Pantry Lights OH”,“category”:“light”,“tags”:[“Lighting”],“groupNames”:[“gDevices”,“gRoom_Kitchen”]}

I have just tried another discovery and again nothing in Alexa App. I also note that on myopenhab.org there is nothing showing in my items list if it is meant to be in there. I can see my OH server is connected correctly to myopenhab.org and I can use the Android app remotely to view items and sitemaps.

Any Ideas?

Your items file looks correct.

I am possibly concerned about the output of the rest api. Unless it is a cut/paste issue it shows some in blue some in black? The issue though is the blue ends right in the middle of the label.
If you install the rest api docs t allows you to see the rest api items in a more formatted way. I won’t have my laptop to help you through install for a few days. If you don’t have it solve by the end of week ping me on im I can type something and post here.

On the items showing up in the cloud connector. I found the following things.

  1. The items won’t get pushed until they experience a state change.
  2. In my setup unless they are explicitly declared in the openhab.cfg file or paper ui under openhab cloud setting. They don’t show up. They do however function. It is strange. I have 8 items that are tied to Alexa but only 2 show up in my Openhab.

One last silly question, you did add the openhab skill in Alexa? If so it should show as connected in a tab in my openhab. As I don’t have my laptop I can’t tell you which one. I don’t remember right now, but it’s there.

Please use code fences, I can see smart quotes and they will cause issues but unless u post in code fences it may just betheforum.

Btw do not exposeitems as that is not needed unless you use IFTTT as it will constantly use your internet even when not using a app or ui. Also best to keep The load on myopenhab as low as u can as it is a community runserver. The items at myopenhab will only update if u expose an item and then move the control. As mentioned do not expose any items just be sure to have remote andnotifications selected and then the tags do the rest.

The online tab unless I am wrong ONLY shows your openhabserver is connecting to the myopenhab server, nothing more. There is a place in the menu where you can see thesucessful oauth2 connections from Google home or Alexa apps with a rubbish bin icon next to them to remove them.

1 Like

@matt1 & @Thedannymullen - thanks for the input. Sorry I did not put in code fences I was looking for that. There are no funny links or blue lines on my output i just presented itself in the forum.

My item is being state changed all the time so this should not be an issue. I have just installed the REST API Docs and ran a GET on Items for the item involved here is the result in code fences:

{
  "link": "http://openhabianpi:8080/rest/items/Kitchen_PantryLights",
  "state": "OFF",
  "editable": false,
  "type": "Switch",
  "name": "Kitchen_PantryLights",
  "label": "Pantry Lights OH",
  "category": "light",
  "tags": [
    "Lighting"
  ],
  "groupNames": [
    "gDevices",
    "gRoom_Kitchen"
  ]
}

As you can see it looks fine - It changes state no problems, has rules with expire bindings, works in the android app etc.

When I installed the API Docs however I got a lot of WARNINGS in the logtail the most relevant being this:

2018-07-24 12:15:06.195 [WARN ] [org.eclipse.jetty.server.HttpChannel] - //openhabianpi:8080/rest/sitemaps/default/gRoom_Kitchen?_=5995273660b96

javax.servlet.ServletException: javax.servlet.ServletException: A MultiException has 1 exceptions.  They are:

1. java.lang.IllegalStateException: ServiceLocatorImpl(__HK2_Generated_3,4,22948653) has been shut down

	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:88) [183:org.ops4j.pax.web.pax-web-jetty:6.0.9]

	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) [84:org.eclipse.jetty.server:9.3.21.v20170918]

	at org.eclipse.jetty.server.Server.handle(Server.java:534) [84:org.eclipse.jetty.server:9.3.21.v20170918]

	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:333) [84:org.eclipse.jetty.server:9.3.21.v20170918]

	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) [84:org.eclipse.jetty.server:9.3.21.v20170918]

	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283) [76:org.eclipse.jetty.io:9.3.21.v20170918]

	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108) [76:org.eclipse.jetty.io:9.3.21.v20170918]

	at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93) [76:org.eclipse.jetty.io:9.3.21.v20170918]

	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303) [87:org.eclipse.jetty.util:9.3.21.v20170918]

	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148) [87:org.eclipse.jetty.util:9.3.21.v20170918]

	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136) [87:org.eclipse.jetty.util:9.3.21.v20170918]

	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) [87:org.eclipse.jetty.util:9.3.21.v20170918]

	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) [87:org.eclipse.jetty.util:9.3.21.v20170918]

	at java.lang.Thread.run(Thread.java:748) [?:?]

There were a heap of warnings but all very similar.

I just disabled/removed the Alexa link from myopenhab.org and recreated the account linking from the Alexa app - tried discovery and still nothing? Everything looks right apart from the warnings but still no go. I have read about the _ in item names - is this a real problem?

Jetty is also used by cloud connector so if u get errors that may stop it from running best to fix. Remove your sitemap file for testing and reboot your openhab server after clearing tmp and cache folders. Search forum for how and don’t delete the folders only contents

@matt1 Thanks mate that was it cleared the cache and tmp and presto it came up. Took some time to go Online but now working perfectly.

Good to hear it is fixed, but that is bad news for me as I was hoping others would say it is a server issue. I am still hunting on how to fix my setup. Perhaps you can help me out, that JSON output you posted, is that how it was formatted? Or did you edit it to make it look pretty? Mine came out as a single line with no carriage returns (press enter to make new line) and that may possibly be a hint as to what is wrong with my setup. Please reply in my thread so as not to hijack this one…

When I finally fix my setup I plan to do a major write up and push request for the documentation on how to setup and fault find the cloud connector.

2 Likes

@matt1 I am in full agreement that the cloud docs could use some improvement. I have submitted issues on git for the problems I have found. The google side seemed to be receptive while the Alexa side and the cloud connector people have given no response yet to the issues.

On fault finding, yes definitely need some tools or something to help us. You can see on the forums that many people have issues. In my opinion these issues can turn people off to openHAB which is the opposite behavior of what you want.

I would love to see some better syntax checking first. If for example a tag is required then openHAB should throw and error. If a space is required between quotes and a bracket the. OpenHAB should throw a error. This would help all users. But the first step is to update the docs as if they do the have the requirements explicitly spelled out then we can develop syntax checks!

I still need to investigate a few things on my end, but I think I have a few more issues on git for the cloud connector.

1 Like

I hope I do not double post, but I wanted to mention, that this behaviour is not “harmless” as mentioned in some posts. This kills the homekit connection.
I have an items file with about 100 homematic items, of which I tagged all lights as lighting and all switches as switchable. On a fresh restart of OH (latest openhabian, 2.3) everything works fine and Apple Home discovers all items.
When I change a single thing in this items-file, the file gets reloaded, I get tons of “Could not update element with key” warnings and all items disappear from Apple Home. I then need to restart OH and all items reappear, though I need to sort them again into the rooms I created in Apple Home. Since I cannot do this sorting for 25+ items everytime I make a minor change in that items-file, this bug effectively breaks the homekit-functionality.

3 Likes

I totally agree. All my items contain underlines, and nö they are Not visible by Alexa anymore. Is there a solution for this, beide renaming all the items? Which part must not have underlines?

@misken totally agree have exactly the same issue with 50+ items I need to resort in the correct rooms each and every time.

With the latest Release (2.4) there is not shown any Error / warnings. I am not sure if the failure was solved or if the failure messages are solely supressed, because my Alexa still does not find any devices

Hi all.
If someone is facing the same problem:
I was able to solve the problem by installing an old Alexa APK in my Android device. In this app I was able to find the devices. After they were found and stored, it is possible to control them with the Echo Dot/ other Alexas as well