Niko Home Control

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.

Mark, you changed something in de code last time. Please find below the post.

I receive the same error as previous.

version 2.0.0.201701061342 is working
version 2.0.0.201701271105 is not working

Unable to start bundle 207: Could not resolve module: org.openhab.binding.nikohomecontrol [207]
Unresolved requirement: Import-Package: org.openhab.core.library.types

@WesleyStroop I didn’t find this package dependency in my development version anymore. It shouldn’t be there anyway. I did another compile and put it online, double checking I don’t have that dependency in there.
Also, I believe this package belongs to the 1.x compatibility layer. So I believe it will work if you have 1.x legacy binding support enabled. That shouldn’t be required though and if still is, we need to dig further.
Try my latest version and see what it does. Then also provide me a full log trace so I can verify what exactly happens.

Hi Mark,

Perfect, it’s working. And the “Alles UIT” switch is added and working.

Below the output from my logs, based on grep niko.

log.xml (48.0 KB)

@WesleyStroop Happy you got it working.
I had a quick look at your logfile. The last lines indicate you may still have items linked to the a thing created form the previous bridge. But that is just a configuration issue. Linking it to the proper thing should resolve it.
Have you tried using “Alles UIT” from openHAB? Did that work? If so, the Niko Home Control action type 0 is now also supported in the code. I would be keen to see an exact log of the response for that. I am curious if there is some extra info sent.
Kan you keep it up and running for a while? A stress test would be nice.

Hi Mark,

The keep running part will be a bit more difficult. I installed the openhab2 on my Synology NAS, but it seems to be unstable, this is with the openhab2 package. Also the interface of the openhab2 android version is not suitable to work with. All the switches are just listed, not per location. I still need to figure out how this is done correctly with locations.

I probably need to install the openhab2 manually on my synology and install the service manually.
Still this will take some investigation.

I tested everything on a VM on my PC.

Once I have it all up and running I will let you know, but I need some time on this. Thanks already for the great support on this.

Rgds,

@WesleyStroop No hurry. I guess it will be some time before this gets reviewed and included in the distribution anyway. But you have already been a great help in trying this out. Any further testing from anyone can only improve quality.
On the locations, they only have an effect in PaperUI. It groups things on the PaperUI interface. This does not have an effect on sitemaps or item groups. As the binding does not create items, only things, it does not have control over this. The default sitemap indeed does not do any groupings, so just lists them. But you can create groups and sitemaps the way you want using standard openHab2 functionality, just like with items linked to any other binding.
I also believe there is an active forum thread about installing on Synology. I don’t have one, so cannot help on that.

@Mherwege : I finally had a chance to test out your binding with a 550-00003 controller. It picks up all the Dimmers and Switches without a glitch. It also detects the different “actions” i defined in NHC to set scenes/moods (Watch TV, Go to bed, etc…).

Please let me know when you are ready to start adding motor controls (blinds), thermostats, and digital/analogue sensors. I have the NHC modules for each and eager to test when time permits.

@Denethor Thank you for testing the Niko Home Control binding. I am happy you confirmed it also works with the newer controller.

I don’t have any motor control, thermostats or other sensors. Therefore I need extra input to be able to add it in the binding. I did foresee to add it in when I could get more info.

Ideally, I would like to have a Wireshark trace of the communication between the Niko Home Control app and the controller at startup and use of any of the above. I used Andy to install the Android app on a PC and catch all communication.
A quick first step would be if you could send me a full debug log trace of the Niko Home Control binding in openHab. Enable debug for the binding and grep NikoHomeControl from the openhab.log file. This will give me all structural info about the Niko Home Control actions you have in your system I currently do not support. I should be able to make them visible. I will struggle putting in some of the commands to drive these because these are not visible as long as I cannot test sending them. And as I do not know what to send… So that’s where I need the Wireshark trace.

I am also not sure I will be able to make the sensors visible to openHab. All openHab sees is what is also visible in the Niko Home Control app. If it is there, I can capture it. If it is not, it may require changing the Niko Home Control configuration itself, or it may not be possible at all.

@Mherwege : Find a dump of the debug log here (i restarted the bundle) http://pastebin.com/dC6NeyCn . I will try to do a wireshark trace this weekend when i have some time. I will perform this from a Bluestacks emulator as i’m running MacOS.

The thermostat and sensors have not yet been correctly programmed in NHC, but the blinds are.

@Denethor I put in the blinds action type in the discovery. So you should be able to add them as things now. You will not be able to do anything with it now, but the logs will create extra info if you try to open/close that could be helpful in figuring it out for me.
Also, could you try opening/closing using other controls than openHab when openHab is running? It should write events in the log file of openHab I can also study to adjust the code.
Many thanks for testing this. The new jar is here.

@Mherwege the updated binding indeed discovers the blinds! But as you said, i can’t link them to any item. I added one as an thing, and as requested, i opened/closed them using the regular NHC push buttons. It did write some events to the event log. Please find it here http://pastebin.com/GR8KW6cS

I also saw some Java errors, but i don’t believe they are related. I did not yet have time to run an emulator with Wireshark, will report back once i have. If there are any other events you would like me to create, let me know. Thanks again for your hard work in creating the binding.