Niko Home Control

For all wishing to test, documentation is available in my git repo here.

I reinstalled my virtual machine Debian, installed java 8, installed beta5 offline, moved the niko jar in the addons folder.
Started the openhab2 server, and went to the website, but no bindings could be found. When I manually add for example binding = sonos in addons.cfg, it shows me the sonos binding, but not the niko one.
I will try again tomorrow and then send you the log-files.
rgds,

@WesleyStroop Sorry to see you have problems with this. I am running this on a Windows 10 PC. I just tested again removing the jar file from the addons directory, removing the bundle from openhab, adding it back, and stopping and restarting openhab. The binding correctly goes away and is reinstalled. I don’t have to do anything in the configuration files.
Just a few suggestions:

  • Put the addons.cfg file back to its initial state. This file will indicate what gets started at the very first launch. Simple in your file means minimum addons (only things that can be managed through the user interface). If you launch the UI with the default file for the first time, it should come up with a selection screen to choose the package. Pick standard or advanced.

  • Add the binding to the addons directory.

  • Start openHab and type bundle:list in the karaf console. Do you see the Niko Home Control binding in the list? If so, the binding is installed.

  • If it is there, you could try uninstalling from the console using bundle:unistall id, where id is the id you get from bundle:list. Then stop openHab and start again. Check if the bundle is there. It should if you have it in your addons directory.

  • Did you put any configuration in the things or items files for Niko Home Control? Please remove these if you did. Rather try through PaperUI. Looking at your previous log file, it looked like the binding was there, but there was a mismatch between the thing and item. The thing should have been: nikohomecontrol:onOff:nhc:40, not nikohomecontrol:onOff:nhc as in the log file. See here for the binding documentation.

It is normal for the Sonos binding to be picked up when you have it in the addons.cfg file. This binding is already part of the distribution. The Niko Home Control binding is not, so that is probably the difference. That’s why manual loading is required.

Hi Mark,

I did again a clean install of everything, new debain jessy/ new java8 / openhab2b5 / niko.jar in addons folder.
No adjustments to anything, as you recommended.

bundle:list shows me no NIKO, executed command

bundle:list | grep niko

after searching the openhab forums, it seems that I can install via this command:

openhab> bundle:install https://github.com/mherwege/niko-homecontrol/blob/master/addons/binding/org.openhab.binding.nikohomecontrol/org.openhab.binding.nikohomecontrol-2.0.0-SNAPSHOT.jar?raw=true
Bundle ID: 179

So it’s now installed.

openhab> bundle:list
179 | Installed | 80 | 2.0.0.201612210807 | NikoHomeControl Binding

But still no binding available in the Paper UI

When I run bundle:restart 179
I get in my error log following

2017-01-04 21:47:31.280 [DEBUG] [e.osgi.LoggingCommandSessionListener] - Command: ‘bundle:restart 179’ failed: org.apache.karaf.shell.support.MultiException: Error restarting bundles:
Unable to start bundle 179: Could not resolve module: org.openhab.binding.nikohomecontrol [179]
Unresolved requirement: Import-Package: org.openhab.core.library.types

2017-01-04 21:47:31.281 [ERROR] [apache.karaf.shell.support.ShellUtil] - Exception caught while executing command
org.apache.karaf.shell.support.MultiException: Error restarting bundles:
Unable to start bundle 179: Could not resolve module: org.openhab.binding.nikohomecontrol [179]
Unresolved requirement: Import-Package: org.openhab.core.library.types

   at org.apache.karaf.shell.support.MultiException.throwIf(MultiException.java:61)
   at org.apache.karaf.bundle.command.Restart.doExecute(Restart.java:56)[38:org.apache.karaf.bundle.core:4.0.8]

@WesleyStroop I can’t put my finger on this immediately. The dependency it refers to I believe to be a common dependency, not one created by the nikohomecontrol binding. So I am surprised to see karaf is not able to resolve that dependency. I am on a slightly older build and will try with a newer build in the next few days. I will keep you posted.

@WesleyStroop I upgraded my openHab install and tried again myself. I now had the same error at initial startup of openHab. However, when I stopped the openHab server and started again, all was fine.
I have updated the binding to better handle disconnects and reconnects to the IP interface. I have now put it on dropbox as gitHub sometimes causes corruption when downloading binary files. Can you try this version?

It worked, now it automatically found the niko jar in the addons folder.

I will test further.

Thanks already for the efforts done,

All seems to be working fine, automatically fills the inbox. But it seems that only the first setup is found. Later added switches are not found.
Also need to test the dimmers, for this i need to resetup the niko itself, which will take a bit more time.

Thanks already very much for this.

@WesleyStroop Do you mean you run openHab with the binding, and than change the configuration in the Niko Home Control controller to add switch or dimmer actions? The discovery does not run automatically. It runs when the binding is added, or when it is called for an existing binding from paperUI. I don’t think it makes sense to run this continously or as a scheduled job because you typically do not change the Niko Home Control setup a lot. When you start the discovery again from paperUI on the already configured bridge, all new actions should be found and ones that do not exist anymore should get removed. Things or items will not be touched.
Also note only actions in the Niko Home Control controller assigned to the Niko mobile app are visible to the binding. Can you check you see the action (switch or dimmer) in the Niko app?

It seems all is discovered.

Only the “Turn off everything” is not found.

I just noticed that this is a different icon then the others. I can manually add it maybe, by using the numbers at the end, which are not available.

nikohomecontrol:onOff:088e7f33:55
nikohomecontrol:onOff:088e7f33:56
nikohomecontrol:onOff:088e7f33:58
nikohomecontrol:onOff:088e7f33:70
nikohomecontrol:onOff:088e7f33:71
nikohomecontrol:onOff:088e7f33:72
nikohomecontrol:onOff:088e7f33:73
nikohomecontrol:onOff:088e7f33:77

@WesleyStroop Is “Turn off everything” visible in the Niko app? If so, I would expect it to be discovered.
The numbers that are not available are, or not used, or not configured for the Niko app. I have notice in my setup there are numbers missing, most likely due to configuration changes. When an action is removed, you may have a hole in the numbering scheme.
If you are sure you see the action in the Niko app, could you try turning on DEBUG logging for the binding and get me a copy of the discovery part in the DEBUG log? See here how to do that. I am curious to see if there is a specific json string for this “Turn off everything” action the binding cannot interpret.

Hi Mark, please find below my log file for NIKO.

It seems the everything off is not included. If I recal correctly, this was a seperate action in the niko setup.

Thanks,

13:45:03.475 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: IP address is /192.168.0.121
13:45:03.477 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: connected
13:45:03.477 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: send json {“cmd”:“systeminfo”}
13:45:03.479 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: received json {“cmd”:“systeminfo”,“data”:{“swversion”:“1.8.0.32326”,“api”:“1.19”,“time”:“20170121134522”,“language”:“NL”,“currency”:“EUR”,“units”:0,“DST”:0,“TZ”:3600,“lastenergyerase”:“”,“lastconfig”:“20150909210257”}}
13:45:03.481 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: systeminfo
13:45:03.482 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: send json {“cmd”:“startevents”}
13:45:03.483 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: received json {“cmd”:“startevents”, “data”:{“error”:0}}
13:45:03.484 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: startevents
13:45:03.484 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: start events success
13:45:03.484 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: send json {“cmd”:“listlocations”}
13:45:03.489 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: received json {“cmd”:“listlocations”,“data”:[ {“id”:0,“name”:“”},{“id”:1,“name”:“Garage”},{“id”:2,“name”:“Keuken”},{“id”:3,“name”:“Wasplaats”},{“id”:4,“name”:“Terras”},{“id”:5,“name”:“Eetkamer”},{“id”:6,“name”:“Woonkamer”},{“id”:7,“name”:“Bureau”},{“id”:8,“name”:“Inkomhal”},{“id”:9,“name”:“Toilet”},{“id”:10,“name”:“Buiten voordeur”},{“id”:11,“name”:“Voortuin”},{“id”:12,“name”:“Overloop”},{“id”:13,“name”:“Slaapkamer links”},{“id”:14,“name”:“Slaapkamer rechts”},{“id”:15,“name”:“Slaapkamer ouders”},{“id”:16,“name”:“Badkamer”},{“id”:18,“name”:“Zolderkamer”},{“id”:20,“name”:“Sferen”}]}
13:45:03.491 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: list locations
13:45:03.491 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: send json {“cmd”:“listactions”}
13:45:03.542 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: received json {“cmd”:“listactions”,“data”:[ {“id”:25,“name”:“Garage”,“type”:1,“location”:1,“value1”:0},{“id”:26,“name”:“Garagepoort”,“type”:1,“location”:1,“value1”:0},{“id”:27,“name”:“Wasplaats”,“type”:1,“location”:3,“value1”:0},{“id”:28,“name”:“hoofdverlichting wand terras”,“type”:1,“location”:4,“value1”:0},{“id”:29,“name”:“Hoek keuken”,“type”:1,“location”:2,“value1”:0},{“id”:48,“name”:“keukentafel”,“type”:1,“location”:2,“value1”:0},{“id”:49,“name”:“Spotjes keuken”,“type”:1,“location”:2,“value1”:0},{“id”:50,“name”:“Terras”,“type”:1,“location”:4,“value1”:0},{“id”:51,“name”:“Hoek aan terras”,“type”:1,“location”:6,“value1”:0},{“id”:52,“name”:“Tafel eetkamer”,“type”:1,“location”:5,“value1”:0},{“id”:30,“name”:“Boekenkast”,“type”:1,“location”:5,“value1”:0},{“id”:31,“name”:“Stopcontact woonkamer”,“type”:1,“location”:6,“value1”:0},{“id”:53,“name”:“Haard”,“type”:1,“location”:6,“value1”:0},{“id”:54,“name”:“Hoofd woonkamer”,“type”:1,“location”:6,“value1”:0},{“id”:55,“name”:“Vooraan eetkamer”,“type”:1,“location”:5,“value1”:0},{“id”:32,“name”:“Stopcontact eetkamer”,“type”:1,“location”:5,“value1”:0},{“id”:33,“name”:“Hoofd Bureau”,“type”:1,“location”:7,“value1”:0},{“id”:34,“name”:“Spotjes bureau”,“type”:1,“location”:7,“value1”:0},{“id”:35,“name”:“Spot inkom”,“type”:1,“location”:8,“value1”:0},{“id”:36,“name”:“Wand inkom”,“type”:1,“location”:8,“value1”:100},{“id”:37,“name”:“Toilet”,“type”:1,“location”:9,“value1”:0},{“id”:58,“name”:“bediening wandverlichting voordeur”,“type”:1,“location”:10,“value1”:0},{“id”:38,“name”:“Grondspots”,“type”:1,“location”:11,“value1”:0},{“id”:39,“name”:“Spotjes overloop”,“type”:1,“location”:12,“value1”:0},{“id”:40,“name”:“Wandverlichting overloop”,“type”:1,“location”:12,“value1”:0},{“id”:41,“name”:“Hoofd slaapkamer links”,“type”:1,“location”:13,“value1”:0},{“id”:42,“name”:“Hoofd slaapkamer rechts”,“type”:1,“location”:14,“value1”:0},{“id”:43,“name”:“hoofdlicht”,“type”:1,“location”:15,“value1”:0},{“id”:44,“name”:“Dressing”,“type”:1,“location”:15,“value1”:0},{“id”:45,“name”:“Spotjes”,“type”:1,“location”:16,“value1”:0},{“id”:46,“name”:“Badkamermeubel”,“type”:1,“location”:16,“value1”:0},{“id”:56,“name”:“TV Sfeer”,“type”:1,“location”:20,“value1”:0},{“id”:65,“name”:“Alles UIT”,“type”:0,“location”:20,“value1”:0},{“id”:70,“name”:“Technische ruimte”,“type”:1,“location”:18,“value1”:0},{“id”:71,“name”:“zolderhal”,“type”:1,“location”:18,“value1”:0},{“id”:72,“name”:“zolder links”,“type”:1,“location”:18,“value1”:0},{“id”:73,“name”:“zolder rechts”,“type”:1,“location”:18,“value1”:0},{“id”:77,“name”:“Kolonisten”,“type”:1,“location”:20,“value1”:0}]}
13:45:03.544 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: list actions
13:45:03.545 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: send json {“cmd”:“listthermostat”}
13:45:03.548 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: received json {“cmd”:“listthermostat”,“data”:}
13:45:03.549 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: not acted on json {“cmd”:“listthermostat”,“data”:}
13:45:03.549 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: send json {“cmd”:“listthermostatHVAC”}
13:45:03.551 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: received json {“cmd”:“listthermostatHVAC”,“data”:}
13:45:03.552 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: not acted on json {“cmd”:“listthermostatHVAC”,“data”:}
13:45:03.552 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: send json {“cmd”:“readtariffdata”}
13:45:03.554 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: received json {“cmd”:“readtariffdata”,“data”:}
13:45:03.556 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: not acted on json {“cmd”:“readtariffdata”,“data”:}
13:45:03.556 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: send json {“cmd”:“getalarms”}
13:45:03.562 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: received json {“cmd”:“getalarms”,“data”:[ {“id”:3,“type”:1,“date”:“20170119160639”,“text”:“iemand aan de voordeur”,“confirmed”:0},{“id”:3,“type”:1,“date”:“20170119160244”,“text”:“iemand aan de voordeur”,“confirmed”:0},{“id”:3,“type”:1,“date”:“20170119160242”,“text”:“iemand aan de voordeur”,“confirmed”:0},{“id”:3,“type”:1,“date”:“20170111145651”,“text”:“iemand aan de voordeur”,“confirmed”:0},{“id”:3,“type”:1,“date”:“20170110140634”,“text”:“iemand aan de voordeur”,“confirmed”:0},{“id”:3,“type”:1,“date”:“20170110140631”,“text”:“iemand aan de voordeur”,“confirmed”:0},{“id”:3,“type”:1,“date”:“20170110140628”,“text”:“iemand aan de voordeur”,“confirmed”:0},{“id”:3,“type”:1,“date”:“20170110080425”,“text”:“iemand aan de voordeur”,“confirmed”:0},{“id”:3,“type”:1,“date”:“20170110080424”,“text”:“iemand aan de voordeur”,“confirmed”:0},{“id”:3,“type”:1,“date”:“20170110080423”,“text”:“iemand aan de voordeur”,“confirmed”:0}]}

@WesleyStroop It does indeed look like it is a specific action type. My “Alles Uit” is just like a switch action, so I do not know exactly why yours is different from mine. In you log, “alles UIT” is type 0 while switch actions have type 1 and dimmer actions have type 2. The binding only acts on type 1 and 2 at the moment. As the message types are different, I need separate code for each.
Do you mind sending me your nhc file (the Niko Home Control configuration file used to load the configuration in te controller)? I hope to find some clue then on what the difference is. If I can change the “alles uit” in my system to look like yours, I can test a fix myself. Just direct send the file to me. My current guess is I can probably treat it the same as type 1 (switch action), but I cannot be sure.
As a work around, you can alway define a group item combining all your items in openHab and use that group item to model a “alles UIT”. Rather than sending one command for “alles UIT”, openHab would send distinct commands for each item in the group.

@WesleyStroop I have updated the binding to also include type 0 actions, assuming they will react the same as type 1. Can you test the new version? It will generate extra log info for me to be able to adjust if required. Please try the binding, check if your “alles UIT” shows up in discovery, and if you can use it. Create a debug log when doing so. If it does not work, it should give me enough info to figure it out.
The new version is available on dropbox here.
I have also introduced a connection refresh parameter. I noticed I lost my connection after a while. I now restart it regularly. Setting the parameter to 0 will not restart it.

Hi Mark,

the action is logged in the openhab.log as type 0, but it’s not showing in the PAPER UI

openhab.log:2017-01-31 19:22:32.702 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: received json {“cmd”:“listactions”,“data”:

{“id”:65,“name”:“Alles UIT”,“type”:0,“location”:20,“value1”:0}

Also discovered this

2017-01-31 19:21:06.227 [DEBUG] [org.openhab.binding.nikohomecontrol ] - BundleEvent STARTED - org.openhab.binding.nikohomecontrol
2017-01-31 19:21:06.227 [DEBUG] [mpl.info.InfoBundleTrackerCustomizer] - Ignore incorrect info null provided by bundle org.openhab.binding.nikohomecontrol
2017-01-31 19:21:06.231 [INFO ] [g.apache.aries.spifly.dynamic.bundle] - Bundle Considered for SPI providers: org.openhab.binding.nikohomecontrol
2017-01-31 19:21:06.231 [INFO ] [g.apache.aries.spifly.dynamic.bundle] - No ‘SPI-Provider’ Manifest header. Skipping bundle: org.openhab.binding.nikohomecontrol

I guess this would be the reason, why it’s not pickup:

2017-01-31 19:39:44.532 [ERROR] [ome.core.thing.internal.ThingManager] - Exception occured while initializing handler of thing 'nikohomecontrol:onOff:0bde90b8': java.lang.NumberFormatException: For input string: "0bde90b8"
java.util.concurrent.ExecutionException: java.lang.NumberFormatException: For input string: "0bde90b8"
        at java.util.concurrent.FutureTask.report(FutureTask.java:122)[:1.8.0_111]
        at java.util.concurrent.FutureTask.get(FutureTask.java:206)[:1.8.0_111]
        at org.eclipse.smarthome.core.common.SafeMethodCaller.callAsynchronous(SafeMethodCaller.java:188)[96:org.eclipse.smarthome.core:0.9.0.b2]
        at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:81)[96:org.eclipse.smarthome.core:0.9.0.b2]
        at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:65)[96:org.eclipse.smarthome.core:0.9.0.b2]
        at org.eclipse.smarthome.core.thing.internal.ThingManager$9.run(ThingManager.java:710)[103:org.eclipse.smarthome.core.thing:0.9.0.b2]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_111]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_111]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)[:1.8.0_111]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.8.0_111]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_111]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_111]
        at java.lang.Thread.run(Thread.java:745)[:1.8.0_111]
Caused by: java.lang.NumberFormatException: For input string: "0bde90b8"
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)[:1.8.0_111]
        at java.lang.Integer.parseInt(Integer.java:580)[:1.8.0_111]
        at java.lang.Integer.parseInt(Integer.java:615)[:1.8.0_111]
        at org.openhab.binding.nikohomecontrol.handler.NikoHomeControlHandler.initialize(NikoHomeControlHandler.java:85)[180:org.openhab.binding.nikohomecontrol:2.0.0.201701061342]
        at org.eclipse.smarthome.core.thing.internal.ThingManager$9$1.call(ThingManager.java:713)[103:org.eclipse.smarthome.core.thing:0.9.0.b2]
        at org.eclipse.smarthome.core.thing.internal.ThingManager$9$1.call(ThingManager.java:1)[103:org.eclipse.smarthome.core.thing:0.9.0.b2]
        at org.eclipse.smarthome.core.common.SafeMethodCaller$CallableWrapper.call(SafeMethodCaller.java:179)[96:org.eclipse.smarthome.core:0.9.0.b2]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_111]
        ... 3 more

Could you check the exact version of the binding you have running? It should be:

10 | Active | 80 | 2.0.0.201701271105 | NikoHomeControl Binding

You get this by typing bundle:list | grep Niko in the Karaf console. If you have another version or multiple lines, you should remove these. bundle:update <id> should update to the latest in your addons directory.

Are you on the release version of OH2? I see the error in the ThingManager call, but it is calling for a thing that could not exist. The thing id at the end is missing from the string. That’s what is confusing me at the moment.

The previous version of the binding worked for you (except for the 0 type). I have the above version now running since creation without any issues on a Raspberry. So I do suspect some other issue in loading bundles in your environment. I will try to look if I can find something on the errors you are seeing when I find some time.
I don’t find anything on apache.aries or mpl.info in any of my log files. So that is another strange thing for me. To my knowledge these are not OH2 components at all.

See extract from the error in your logfile. This is not the most recent version of the binding that is executing. Try with the most recent version from the dropbox link I provided before, and get me all the debug log entries from the NikoHomeControl binding.

The messages in the log file come from Karaf and seem to happen with other bundles as well, so I don’t think that’s a problem. To me the most likely issue at the moment is the mismatch in the binding version.

Strange, I did download the new version. Maybe I need to reinstall it in KARAF.

As of now the “ALLES uit” is listed. I didn’t notice it before.

I will have a go this evening.

Rgds,

same error as in the beginning.

178 | Resolved | 80 | 2.0.0.b5 | openHAB Paper UI Theme Fragment, Hosts: 175
205 | Installed | 80 | 2.0.0.201701271105 | NikoHomeControl Binding
openhab> bundle:restart 205
Error executing command: Error restarting bundles:
Unable to start bundle 205: Could not resolve module: org.openhab.binding.nikohomecontrol [205]
Unresolved requirement: Import-Package: org.openhab.core.library.types

@WesleyStroop How did you solve this last time? When I had this error, simply stopping and starting openHab solved the issue, no change to my code at all.