Niko Home Control


(fcela) #82

Hi Mark,
the version in the meantime i will get the full debug log:

BR.
Marek.


(Mark Herwege) #83

@fcela I may have found the reason for the errors you were seeing. While it was working in my live environment, I now saw similar error in my development IDE. After some guidance from the reviewer on my PR, I think I may have solved this. Can you try the new version I have uploaded.
Beyond this, there are quite a few changes to improve code quality. It should not impact functionality, but I would appreciate if you let me know if anything is broken.


(fcela) #84

Hi Mark,
i have replaced the last version of the binding and restarted the service.
I don’t know why all the things remain unitialized after then although I could see the items online in the event.log (check https://www.dropbox.com/s/h3xbk0frigzk3a5/events.log?dl=0). I have tried to refresh the web gui several times, nothing has changed

After then I removed one item and readd the one again. All the items are online now, don’t understand what could happened.
Maybe I had to wait i little bit more, really don’t now.
Anyway, all the things are online.
Thank you very much.


(Mark Herwege) #85

I have uploaded a new version of the binding to my dropbox folder. A lot of clean-up has happened under the hood. This new version should also auto-discover the bridge in a simple network without further configuration, but to aid configuration a little bit if required a parameter was added. I also think the binding is more resilient to communication errors and will auto-correct in a number of cases.
I would welcome all feedback and error reports, either here or on github.
For updated documentation, please look here: documentation.


(Mark Herwege) #86

There is a new version of the binding available on the dropbox folder with changes after review from @Kai.
Please note a few parameters were changed (uppercase to lowercase, broadcastaddr parameter dropped). If you have a running system, you will have to rediscover the bridge and actions, or change the configuration files. The current documentation is here. I hope this will soon be ready for merge, so it will become available in the snapshot releases.


(fcela) #87

Hi Mark,

I uploaded last version yesterday.
The last version is working for me quite nice.
I have not found any error till now.
Thank you very much for your effort.
BR.
Marek.


(Mark Herwege) #88

@fcela Great to hear it is working as expected. Note that the binding is now merged and available in the current openHAB snapshot release. So no need to drop in the jar file anymore. You can just install like any other binding when on the snapshot release.


(Ward) #89

Thanks for this great binding!

The discovery in Paper UI is working perfect. However, I wanted to declare everything within .things, .items etc and I noticed the documentation is not completely correct:

For the .items file you wrote an example

Switch LivingRoom {channel=“nikohomecontrol:onOff:nhc1:1#switch”} # Switch for onOff type action

But this was not working for me (thing wasn’t able to link to item). I needed to replace the ‘#’ by an ‘:’

Switch LivingRoom {channel=“nikohomecontrol:onOff:nhc1:1:switch”}

I also added some labels and locations to the things and items, but this is just cosmetical.

A small part of my files:
.things

Bridge nikohomecontrol:bridge:nhc [ addr=“192.168.0.175”, port=8000, refresh=300 ] {
onOff badkamer “NHC badkamer” @ “NHC” [ actionId=27 ]
onOff badkamermeubel “NHC badkamermeubel” @ “NHC” [ actionId=28 ]
}

.items

Switch NHC_badkamer “NHC badkamer” {channel=“nikohomecontrol:onOff:nhc:badkamer:switch”}
Switch NHC_badkamermeubel “NHC badkamermeubel” {channel=“nikohomecontrol:onOffdimmer:nhc:badkamermeubel:switch”}

.sitemap

sitemap nhc label=“NHC”
{
Frame label=“badkamer” {
Switch item=NHC_badkamer
Switch item=NHC_badkamermeubel
}


(Mark Herwege) #90

@wars Thank you for the feedback. I don’t actually use textual configuration myself. Discovering things automatically is just so much easier. I will get the documentation updated.


(Ward) #91

I understand, but I prefer the freedom that I have when using textual config. When adding all my actions of NHC, it’s also easier en faster to do it in text files.
Are there any plans to read the alarm messages? I now have a script which reads them so I can create an archive of these messages. So I can probably add it within OpenHAB, but it would be nice when it’s integrated :slight_smile:

{“cmd”:“getalarms”}


(Mark Herwege) #92

It was my intention to include it, but it was not on the top of my priority list yet.

I want to use trigger channels for this, but need to investigate further.

{"event":"getalarms"} 

is being sent by the controller when there is a new message or alarm. That is what I intend to propagate through a trigger. The trigger could be used in rules.

{"cmd":"getalarms"}

would list all past alarms and messages still stored in the controller. The use of that is less obvious to me. I would need a channel dynamically defined by individual alarm/message to do something meaningful with it. I would expect you could log the alarms and messages as they happen through the event, rather than querying for it with the cmd.
I did notice the “confirmed” flag you can set through the app does not trigger an event. I cannot link it back to the right alarm though, as it would mean I need to keep a database of these alarms in the binding, something I don’t think I should do.
If have some work set out trying to figure out the different alarm and message types. If you have a log of these messages in your install, that would help in developing. If you switch on the bindings debug log it will show all events the controller sends.


(Ward) #93

did some tests:
type 0: alarm
type 1: message

{"cmd":"getalarms","data":[ 
{"id":6,"type":0,"date":"20170706212100","text":"test alarm ON","confirmed":0},
{"id":9,"type":1,"date":"20170706212059","text":"test melding OFF","confirmed":0},
{"id":8,"type":1,"date":"20170706212056","text":"test melding ON","confirmed":0},
{"id":7,"type":0,"date":"20170706212052","text":"test alarm OFF","confirmed":1},
{"id":6,"type":0,"date":"20170706212018","text":"test alarm ON","confirmed":1},
{"id":4,"type":1,"date":"20170706211233","text":"night","confirmed":0},
{"id":3,"type":1,"date":"20170706204143","text":"Garagepoort","confirmed":0},
{"id":3,"type":1,"date":"20170706203408","text":"Garagepoort","confirmed":0},
{"id":3,"type":1,"date":"20170706190803","text":"Garagepoort","confirmed":0},
{"id":3,"type":1,"date":"20170706190134","text":"Garagepoort","confirmed":0}]
}

Where can I turn on binding debug log?


(Mark Herwege) #94

@wars How to turn on logging is defined here. For this binding specifically: log:set DEBUG org.openhab.binding.nikohomecontrol in the Karaf console.
I have been playing a bit with alarms and have alarm triggers integrated. I have not been able to fully test yet, primarily because I did not find the time to load a test version of the program in the controller, to have more alarms to test with. However, feel free to try and let me know how it works out. Nothing changed but the triggers. Here is the .jar addon on a dropbox folder. Uninstall the release binding an drop this in your addons folder.
You may have to delete and recreate the bridge if you did so through PaperUI. You should see 2 trigger channels on the bridge: alarm and notice. You use them from rules. Here is an example:

rule "example trigger rule"
when
    Channel 'nikohomecontrol:bridge:nhc1:alarm' triggered or
    Channel 'nikohomecontrol:bridge:nhc1:notice' triggered
then
    var message = receivedEvent.getEvent()
    logInfo("nhcTriggerExample", "Message: {}", message)
    ...
end

(Ward) #95

thanks for the update.

I just tested it and seems to work great. Added some pushover notifications in the rules.
Now it’s realy easy to store the alarms/notices in a db and see an overview.

As soon as I receive an alarm, openhab picks it up, without confirming it. Is it necessary to see if an alarm has been confirmed?
Actually I never use the ‘alarms’, only the ‘notices’.

openhab.log:

2017-07-11 00:20:06.327 [INFO ] [thome.model.script.nhcTriggerExample] - Message: test alarm OFF
2017-07-11 00:20:17.588 [INFO ] [thome.model.script.nhcTriggerExample] - Message: test melding ON
2017-07-11 00:20:24.884 [INFO ] [thome.model.script.nhcTriggerExample] - Message: test melding OFF
2017-07-11 00:20:41.450 [INFO ] [thome.model.script.nhcTriggerExample] - Message: test alarm ON
2017-07-11 00:20:48.682 [INFO ] [thome.model.script.nhcTriggerExample] - Message: test melding ON
2017-07-11 00:20:53.829 [INFO ] [thome.model.script.nhcTriggerExample] - Message: test melding OFF
2017-07-11 00:20:54.675 [INFO ] [thome.model.script.nhcTriggerExample] - Message: test alarm OFF

events.log

2017-07-11 00:20:06.314 [ChannelTriggeredEvent     ] - nikohomecontrol:bridge:nhc:alarm triggered test alarm OFF
2017-07-11 00:20:17.587 [ChannelTriggeredEvent     ] - nikohomecontrol:bridge:nhc:notice triggered test melding ON
2017-07-11 00:20:24.883 [ChannelTriggeredEvent     ] - nikohomecontrol:bridge:nhc:notice triggered test melding OFF
2017-07-11 00:20:41.448 [ChannelTriggeredEvent     ] - nikohomecontrol:bridge:nhc:alarm triggered test alarm ON
2017-07-11 00:20:48.672 [ChannelTriggeredEvent     ] - nikohomecontrol:bridge:nhc:notice triggered test melding ON
2017-07-11 00:20:53.828 [ChannelTriggeredEvent     ] - nikohomecontrol:bridge:nhc:notice triggered test melding OFF
2017-07-11 00:20:54.673 [ChannelTriggeredEvent     ] - nikohomecontrol:bridge:nhc:alarm triggered test alarm OFF

(Mark Herwege) #96

@wars It worked for me as well. I created a pull request for the added functionality. I don’t think the missing confirmation is a problem at the moment. It is used in their app as a flag.


(Wim) #97

Hi,

Can somebody confirm that in openHAB you receive information that a button in NHC is pushed?
I am designing the automation of our new home and the idea would be to use NHC mainly for the push buttons. The actions will in many cases be performed by other technologies like DALI, zwave or rs232 from openHAB.
I’ve read that alarms and notices are received in openHAB but I’m not sure that this includes the push buttons. Or for example the temperature measured by the thermostat.

My apologies if this is not the right place for this question.

Wim


(Mark Herwege) #98

@wimg You would still have to create activities in the Niko Home Control programming software that link your buttons to no or (virtual) outputs. It is these activities that get exposed through the binding. Therefore in the binding it looks like switches that switch an activity on or off (or sliders for dimmers).
I am not sure about the added value of this though. The most expensive component in the NHC installation is the connected controller, which you would need. NHC push buttons are not cheap either. Can’t you use straight Niko push bottons with some other controllers? They have the same look.


(Wim) #99

@Mherwege Indeed, not an ideal workaround. And I assume reading out temperature is definitely not going to work.
I am looking for a solution based on bus-communication for flexibility and to avoid pulling cables from every place where I want “input” to the switchboard. Same reason why I like DALI: it avoids having to pull a cable from the switchboard to every light you want to control.
I’ll check some other solutions like Bticino, KNX and other bus protocols. In my case, cost is not the main decision factor. Flexibility and my time to get it up and running is as important.

Thanks for the information!

Wim


(Joris Philippaerts) #100

I just installed Niko Home Control in my new house, and found out Niko didn’t provide a way to use 2 different functions behind a single button (short press/long press). With the use of a Rbp3 with openHabian and NHC-binding, I managed to get this working!

The only problem I’m still facing is my (brand new) Telenet modem-router not allowing DHCP-reservation. When the end of the DHCP-lease for the Niko Connected Controller is reached, it will get a new IP-address and the openHab NHC binding won’t work anymore.
There is no way to assign a static IP-address in the NHC Connected controller itself.

I first triend openHab for Windows, where I could change IP-address to hostname in the binding-properties and save this without any problems.
The rbp3 with openhabian on the other hand automatically changes the hostname back to the IP-address after some time.
When I define the controller as a static “thing” in the default.things-file with the hostname of the controller, the binding keeps having the status “uninitialized”…

Is there a solution for this problem?


(Ward) #101

I bought my own router to bypass this. Although, in the past, when I only had a Telenet modem/router, my ip’s almost never changed.

But I’m interested how you implemented 2 functions (short/long press) for one button?

NHC II will be released this month, hopefully the binding will still work, because the whole thing has been redesigned.