[SOLVED] [Main] Konnected Binding

https://ci.openhab.org/job/PR-openHAB2-Addons/11293/

Is the build for the addons. But i don’t know when or how that gets added into the snapshot builds. It looks like those are only done once a day?

Hmm, ok i found the jar from the build… but not sure where to put it since I was using the full snapshot. It doesn’t like being in the addons dir. I’ll have to poke around some more.

The addons directory is where it is supposed to go. But make sure you have uninstalled the binding from paperUI before placing it in there. Also when doing the manual install you have to run the feature:install openhab-transport-upnp from the karaf console.

But this should make it into the next full snapshot as well and will be able to be installed internally from that snapshot whenever that is built. I’m just not sure of the release schedule. It also looks like the fixes just missed out on making it into the m6 testing release but i will have to confirm that.

thanks. will try that.

@tracstarr thanks please do and post any logs if you have issues.

@Rsslone and @tracstarr below is a link to an updated version of the binding that has configurable request timeout and retry count parameters on the things. Please feel free to play around with the numbers and see what works the best in your setups to keep the things online and prevent the fluttering from online - offline. I have the defaults set to 2 and 30 seconds respectively i am curious to see if that is effective or if that should be modified.

https://drive.google.com/open?id=1axZz0eAErGvJ7PQkgIm1zOqBi5WDjuXq

thanks. I’m just sitting down now to hopefully get the latest build up and running to test it out. Added another konnected this afternoon to finish my conversion. So many wires…

I must be missing a step here somewhere.

I just setup the most recent snapshot build from about an hour ago. It found 3/4 modules. They are showing online. I added one channel for now, a motion sensor. It’s setup as a switch. I then added an item

Contact	Living_Room_Motion	"Living Room M" 			(Motion_Sensors){channel="konnected:module:2311760:kmpzone2"}

Followed by a simple sitemap

sitemap home label="Home" {

Switch item=Living_Room_Motion icon="door" mappings=[OPEN="Open", CLOSED="Closed"]

}

When there is motion at the sensor, nothing happens. I don’t see anything in logs nor does the sitemap show any state. The light on the motion sensor comes on, so i know it’s detecting.

I’ve also noticed when I look at the konnected device, the API url that’s linked throws an error if i go to it directly - not sure if that’s valid or not.

Is there a way to debug if the konnected modules are actually trying to send out signals? Maybe the board connection is wrong.

As stated above they are no longer contacts, instead they’re read-only switches. Change your item from “Contact” to “Switch” and the mappings will change to ON = “Open”, OFF=“Closed”. Here is my setup if you’d like an example.

.items

Switch FrontDoor "Front Door [MAP(alarmsensors.map):%s]" <frontdoor> {channel="konnected:module:13302072:Zone_2"}

.sitemap

Frame label="Alarm Sensors" {
        Text item=FrontDoor valuecolor=[==OFF="blue",==ON="Red"]
}

alarmsensors.map (transform)

ON=OPEN
OFF=CLOSED
-=ERROR (UNKNOWN)

This will make a listing like this.

Thanks. Even after the change I get nothing. Should I expect anything in logs when receiving messages from konnect? I’m off to bed and will try again tomorrow.

Do you have debug logging turned on? If so then yes there should be something in the logs. You should see the json strings received with the pin numbers of the states with the form of The raw json data is: {“state”:1,“pin”:5}.

Then you should see it match the event to the zone:

The configrued zone of channelID: konnected:module:1586287:Zone_3 was a match for the zone sent by the alarm panel: 3 on thing: 1586287

etc.

I want to confirm that you can access the Alarm panel status page at https://ip/port/status this should show the sensors that have been configured.

Keep in mind the pins don’t match the zones in a one to one ratio. ( i.e. pin 4 does equal zone 4) But also confirm that the alarm panel is showing the proper endpoint for your openHAB server which should be http://ipofopenhabserver:port/konnected

1 Like

On the status page of the panel there are no sensors configured. All the arrays are empty. The endpoint is listed correctly, but if i manually go to it an exception is thrown.

That exception might be normal. That’s where the modules are sending the data and I don’t think its supposed to be accessed by web. Set your log level to trace as Volfan describes here and attempt update the channel config. What solved the problem for me though on the previous build was to set all the channels up, then restart openhab, the config got updated and sent to the modules after the restart.

@rsslone there is a website that allows access on each of the modules. It can be used to debug communication between openHAB and the module. It looks like to me from what he is describing when accessing the status page of the module is that the module is not receiving a configuration update from openHAB. I agree that i need to see the full log file though to confirm where the problem is though.

So @tracstarr if you could please update to at least debug (or trace as suggested by @rsslone) and then restart openHAB and upload a full copy of the log file thanks.

I know there is a Konnected Device Status page you can go to, but I think he was referencing the API endpoint URL back to the openhab instance. If

<openhabIP>:<openhabPORT>/konnected

is supposed to be functional, it isnt for me.

Ah you are correct. This address is not a functional address. I read right over that part. :grinning:

1 Like

I’ve attached my log from a clean setup of openhab and the latest build from your google drive link above.

It should show the process of adding 3 konnected things and also trying to add a zone channel. After this looking at the status page of the modules shows what the payload says it wants to put.

Then adding the one single item throws an exception.

openhab.log (22.9 KB)

The Channel konnected:module:4477781:Zone_6 is not linked to an item
2018-11-21 20:27:32.879 [DEBUG] [ed.internal.handler.KonnectedHandler] - The Channel konnected:module:4477781:Out is not linked to an item
2018-11-21 20:27:32.880 [DEBUG] [ed.internal.handler.KonnectedHandler] - The Channel konnected:module:4477781:kp2_zone2 is not linked to an item
2018-11-21 20:27:32.881 [DEBUG] [ed.internal.handler.KonnectedHandler] - The payload is: {"sensors":[],"actuators":[],"dht_sensors":[],"ds18b20_sensors":[],"token":"konnected:module:4477781","apiUrl":"http://192.168.20.148:8080/konnected","blink":true,"discovery":true}
2018-11-21 20:27:32.883 [DEBUG] [onnected.internal.KonnectedHTTPUtils] - The String url we want to put is : http://192.168.20.120:12477/settings
2018-11-21 20:27:32.886 [DEBUG] [onnected.internal.KonnectedHTTPUtils] - The payload we want to put is: {"sensors":[],"actuators":[],"dht_sensors":[],"ds18b20_sensors":[],"token":"konnected:module:4477781","apiUrl":"http://192.168.20.148:8080/konnected","blink":true,"discovery":true}
2018-11-21 20:27:33.670 [DEBUG] [onnected.internal.KonnectedHTTPUtils] -

So there is a weird exception in the logs at the start but this is worked out and the binding starts i am assuming that the one channel that you have added is the one you want to link. From what you linked above it looks like your items file is off. Change your items file to the below and it should link:

Switch Living_Room_Motion “Living Room M” (Motion_Sensors){channel=“konnected:module:4477781:kp2_zone2”}

The binding will only send channels to the Konnected Modules that are linked to items.

In doing So I get:

13:05:48.304 [INFO ] [del.core.internal.ModelRepositoryImpl] - Refreshing model 'alarm.items'
13:05:48.313 [DEBUG] [ted.internal.handler.KonnectedHandler] - The channelUID is: konnected:module:4477781:kp2_zone2 and the zone is :
13:05:48.314 [DEBUG] [ted.internal.handler.KonnectedHandler] - getasstring: konnected:module:4477781:kp2_zone2 getID: kp2_zone2 getGroupId: null toString:konnected:module:4477781:kp2_zone2
13:05:48.316 [DEBUG] [ted.internal.handler.KonnectedHandler] - The command payload  is: {"pin":2}
13:05:48.316 [INFO ] [smarthome.event.ItemUpdatedEvent     ] - Item 'Living_Room_Motion' has been updated.
13:05:48.317 [DEBUG] [konnected.internal.KonnectedHTTPUtils] - The String url we want to get is : http://192.168.20.120:12477/device
13:05:48.536 [DEBUG] [konnected.internal.KonnectedHTTPUtils] - []
13:05:48.537 [ERROR] [home.core.thing.link.ThingLinkManager] - Exception occurred while informing handler: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:224) ~[?:?]
        at com.google.gson.Gson.fromJson(Gson.java:887) ~[?:?]
        at com.google.gson.Gson.fromJson(Gson.java:852) ~[?:?]
        at com.google.gson.Gson.fromJson(Gson.java:801) ~[?:?]
        at com.google.gson.Gson.fromJson(Gson.java:773) ~[?:?]
        at org.openhab.binding.konnected.internal.handler.KonnectedHandler.sendSetSwitchState(KonnectedHandler.java:483) ~[?:?]
        at org.openhab.binding.konnected.internal.handler.KonnectedHandler.getSwitchState(KonnectedHandler.java:459) ~[?:?]
        at org.openhab.binding.konnected.internal.handler.KonnectedHandler.handleCommand(KonnectedHandler.java:106) ~[?:?]
        at org.eclipse.smarthome.core.thing.binding.BaseThingHandler.channelLinked(BaseThingHandler.java:233) ~[?:?]
        at org.eclipse.smarthome.core.thing.link.ThingLinkManager.lambda$0(ThingLinkManager.java:300) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:?]
        at java.util.concurrent.FutureTask.run(Unknown Source) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
        at java.lang.Thread.run(Unknown Source) [?:?]
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
        at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385) ~[?:?]
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:213) ~[?:?]
        ... 16 more

With no changes on the status page of that panel and no additional logs when I activate the sensor.

@tracstarr can you upload the full log plead thanks! Also what are you running the 2.2.4 version of the firmware on the modules themselves?