[SOLVED] [Main] Konnected Binding

Ok so i got the service working. It was an OSGI error and i did not have the proper reference to the sethttpservices and unsethttpservices methods set in the handlerfactory.

Now the servelet starts and is able to receive messages at the appropriate path.

Next step.

I need to have the binding send put and get requests. I know there are several bindings that already do this. I know there are a million ways this can be done. What is the best way to do this in a binding? Is there a preferred method or package set i should use? Does eclipse have a framework that can be utilised for this?

Ok i have the requests issue worked out using the Httputil command from eclipse. New issue.

So the put request is sent to the connected module to setup the pins. When the put request is sent the device resets. I have the binding setup to create the configuration that is being sent via channel linking. So when a channel is linked or unlinked it adds/removes information to the request.

So the problem is that I only want to actually call the put method once, or at least only every so often so that all changes are grouped together and send.

    public void channelLinked(ChannelUID channel) {
        // adds linked channels to list based on last value of Channel ID
        // which is set to a number
        logger.debug("Channel {} has been linked", channel.getId());
        sensors.add("{\"pin\":" + channel.getId().substring((channel.getId().length() - 1)) + "}");
        logger.debug(sensors.toString());
        updateKonnectedModule();

    }

So conceptually i think i need to have updateKonnectedmodule() only run if its not called again within some timeframe?

Any ideas?

Ok solved that problem and now i have a working alpha version of the binding that runs in the IDE but i can’t get it to compile with maven. Any ideas?

[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: org.openhab.binding.konnected 2.4.0.qualifie
r
[ERROR]   Missing requirement: org.eclipse.smarthome.config.core 0.10.0.20180614
1343 requires 'package org.eclipse.smarthome.core.common 0.0.0' but it could not
 be found
[ERROR]   Cannot satisfy dependency: org.openhab.binding.konnected 2.4.0.qualifi
er depends on: package org.eclipse.smarthome.config.core 0.0.0
[ERROR]
[ERROR] See http://wiki.eclipse.org/Tycho/Dependency_Resolution_Troubleshooting
for help.
[ERROR] Cannot resolve dependencies of MavenProject: org.openhab.binding:org.ope
nhab.binding.konnected:2.4.0-SNAPSHOT @ C:\OPENHABDEV\openhab2-master2\git\openh
ab2-addons\addons\binding\org.openhab.binding.konnected\pom.xml: See log for det
ails -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MavenExecution
Exception

Ok so still can’t get it to compile but moving forward with development. Hopefully someone will eventually see this and be able to help me. However. I have a new problem… I need to add configuration parameters to some of my channels. However, whenever i add the value i get null pointer exceptions in the log and the binding doesn’t work:

2018-06-26 15:25:59.165 [DEBUG] [e.s.a.core.internal.RuleEngine:256  ] - ModuleHandlerFactory added.
2018-06-26 15:25:59.169 [ERROR] [.c.thing.link.ThingLinkManager:302  ] - Exception occurred while informing handler: nulljava.lang.NullPointerException: null
	at org.openhab.binding.konnected.internal.KonnectedHandler.channelLinked(KonnectedHandler.java:124)
	at org.eclipse.smarthome.core.thing.link.ThingLinkManager.lambda$0(ThingLinkManager.java:300)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

2018-06-26 15:25:59.170 [ERROR] [.c.thing.link.ThingLinkManager:302  ] - Exception occurred while informing handler: nulljava.lang.NullPointerException: null
	at org.openhab.binding.konnected.internal.KonnectedHandler.channelLinked(KonnectedHandler.java:124)
	at org.eclipse.smarthome.core.thing.link.ThingLinkManager.lambda$0(ThingLinkManager.java:300)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

2018-06-26 15:25:59.174 [ERROR] [.c.thing.link.ThingLinkManager:302  ] - Exception occurred while informing handler: nulljava.lang.NullPointerException: null
	at org.openhab.binding.konnected.internal.KonnectedHandler.channelLinked(KonnectedHandler.java:124)
	at org.eclipse.smarthome.core.thing.link.ThingLinkManager.lambda$0(ThingLinkManager.java:300)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

2018-06-26 15:25:59.175 [ERROR] [.c.thing.link.ThingLinkManager:302  ] - Exception occurred while informing handler: nulljava.lang.NullPointerException: null
	at org.openhab.binding.konnected.internal.KonnectedHandler.channelLinked(KonnectedHandler.java:124)
	at org.eclipse.smarthome.core.thing.link.ThingLinkManager.lambda$0(ThingLinkManager.java:300)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

2018-06-26 15:25:59.177 [ERROR] [.c.thing.link.ThingLinkManager:302  ] - Exception occurred while informing handler: nulljava.lang.NullPointerException: null
	at org.openhab.binding.konnected.internal.KonnectedHandler.channelLinked(KonnectedHandler.java:124)
	at org.eclipse.smarthome.core.thing.link.ThingLinkManager.lambda$0(ThingLinkManager.java:300)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

2018-06-26 15:25:59.178 [ERROR] [.c.thing.link.ThingLinkManager:302  ] - Exception occurred while informing handler: nulljava.lang.NullPointerException: null
	at org.openhab.binding.konnected.internal.KonnectedHandler.channelLinked(KonnectedHandler.java:124)
	at org.eclipse.smarthome.core.thing.link.ThingLinkManager.lambda$0(ThingLinkManager.java:300)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

I posted a link to my code above in github but

in my config.xml

<config-description uri="channel-type:konnected:zone">
           <parameter name="config_isActuator" type="boolean">
                <label>IsActuator</label>
              <description>Is the thing connected an actuator</description>
                <default>false</default>
            </parameter>
</config-description>


and my channels.xml files

<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="konnected"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
    xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 org.eclipse.smarthome.thing-description.xsd">
   
   
    <!-- Zone Channel Type -->
    <channel-type id="zone">
        <item-type>String</item-type>
        <label>Pin</label>
        <description>The Zone Channel for adding Sensors</description>
        <config-description-ref uri="channel-type:konnected:zone" />
    </channel-type>
    </thing:thing-descriptions>

Just as an update i have the binding working now and a pull request has been created. There is a working version of the binding at the top of the pull request.

The binding is also available via the marketplace.

https://marketplace.eclipse.org/content/konnected-binding/external_link

2 Likes

Thanks for your work on this Zachary Christiansen!

I’m in the early stages of setting up my smart home. I’m planning on using Konnected. Originally I was going to use Home Assistant. At that point, Konnected made sense. Eventually, I decided that I liked the OpenHAB interface more. I was worried that I would have to write my own binding for Konnected. Then, I saw the work you have done. Your binding will be a huge help.

Like I said, I’m in the early stages. I bought all the security sensors and wires. I still have to run wires and install the sensors. I still need to buy my Konnected. I was thinking I would overkill it and get the 24 zone kit.

I am a web developer. I stared your git repo.
Does your binding support more than 6 zones? I ask because I only saw 6 zones in the thing-types.xml file.

I was also thinking that as I set it up I would document my steps and submit a pull request to update the Readme with more information. I figure that’s the least I could do to be helpful.

Thanks for your work on this @volfan6415.

I had been on the fence, wondering about writing a mqtt bridge. Now I’m buying a konnected and won’t need to.

Cheers!

So each konnected module itself only supports 6 zones. However the binding can support as many modules as you want. ( I currently use 5) so if you need more than 6 zones you just add more modules and you will have a seperate thing for each module.

1 Like

How far off are we from having this officially supported? I was looking into converting my system but I really was hoping for openhab support.

So the pull request is currently being reviewed. However i have been running the code that is in the pull request on my server for awhile now with no major issues. I am happy to walk you though setup of the manual add-on. As to when it will be merged in that will depend on when the review is completed and the time it takes for me to make the necessary changes to the review code. :slight_smile:

But it has been released on the marketplace and can be installed that way or manually via the download on the pull request link on github

Appreciate the fast response, I was out for a couple days so I was not able to reply then. I am still in the stages of research on what or how I want to convert our wired system to smartthings. I read in a previous comment that they thought this was tied to smartthings, I just want to clarify something as a noobie, what is the path of the communication with konnected? If my internet cuts out, will this still work locally with openhab? Also how would you compare the Konnected with the EyezOn EnvisaLink?

Thanks very much for your reply.

Correct. The konnexted modules communicate directly with openhab over the local network and are not internet dependent. So if your internet goes out the modules with will send the signals to openHAB.

As to the eyes on product I have not seen that product so can’t coment. But from my view it looks like some notable differences are the konnected decices are Wi-Fi, have support for more zones per board (6).

I’m sold on the idea. I just ordered a 12 zone kit the other day. I think I can manage myself but If I have any other questions to ask you or need help on the install where is the best place to reach you?

You can ping me back here in this thread. I check into the forums on a regular basis and I get notifications on this thread in particular.

1 Like

So I got the manual binding installed and its dependency and the modules connected to my network and assigned a static IP, but when I go to add the Konnected module to openHAB it says “ERROR: 500 - Internal Server Error”. Not sure what I’m doing wrong.

https://pastebin.com/T1pKtjj6

Here is the log. I’ve tried everything I could think of to get it working, granted I am a noobie.

@volfan6415

question once the thing is added and the channels created does the error persist when openhab is restarted?