Niko Home Control

(Mark Herwege) #162

@Serrrano @extric99
I think I found the error. I loaded a new version. Can you try again?

(serrrano) #163

@Mherwege @extric99

Working great . teste extric99 scenario and all work without error


(Mark Herwege) #164

@Serrrano Thank you for the test.
@extric99 Can you confirm?
Also, do I now have the invert flag correct? If you both need to invert for proper operation, I prefer to switch it around.
If all OK, I will push this version for review and inclusion in the master.

(Mark Herwege) #165

I have created PR #3337. Many thanks to @extric99 and @Serrrano for all the testing so far.

(Christophe) #166

I tested it and functionally it works fine and seems stable. I am unable to make it crash anymore.

I noticed two minor (and i stress minor) issues:

  • when i input a new position when the roller shutter is moving the UI displays not the new target but the position of the roller shutter when the new target was entered. This happens 1/10 times. When the roller shutter stops the correct position is shown so this is minor.
  • with the above use case you see rounding errors in the end position appearing. I only used 10,50,70 etc as target positions but the roller shutter would display 9 or 11 as end position. Again a minor issue.

None of the above is impacting the behaviour so it is working fine for me.

(Mark Herwege) #167

@extric99 Thank you for the test.
I can see why both of these things happen:

  • New position when moving: the binding will stop the motor to get an exact position feedback from NHC before starting it again. When the binding receives a position, it will show this, so will get slightly out of sync. I may be able to correct it, but need to think it through. It should be minor though. I am just not sure why it happens 1/10 times, and not all the time.

  • Rounding errors happen because time is calculated in full seconds. Changing that to milliseconds will improve it a lot, but I will never get exact precision.

(Mark Herwege) #168

@extric99 @Serrrano A few refinements on the above remarks have been pushed and are available here. The accuracy should be improved. I also changed the UI position update to not update when stopping during move. Again, these are small fixes. I keep on doing them, but I will not stop review for it. I can always create small patches later.

(Christophe) #169

I am interested in sharing creative solutions using the Niko Home binding. Therefore I create a topic here Creative solutions or implementations using the NikoHome binding.
Please share your ideas and solutions here so we can learn from each other.

(Bjorn) #170


Maybe I missed it somewhere but does the binding also gets the state back from NHC. When I push a real button I would also like to see the state of the Thing/Item change. Is this implemented?

(Mark Herwege) #171

@B-Virtual feedback should work. Please provide details on what you are doing. What version do you run? Can you provide debug logs of feedback not working?

(Mark Herwege) #172

I have a test version available that implements rollershutter percent values. I need multiple testers for this before I can finalize the PR. Please see Niko Home Control Rollershutters - testing required for my testing ask.
Many thanks.

(Yannic VH) #173

Any news on the thermostats?

I’ve integrated NHC with my google home using openhab.
Looking forward to be able to fetch current temperatures and rollershutter positions :slight_smile:

If you need any more help/logs on thermostats/rollershutters/… let me know.

(Mark Herwege) #174

Rollershutters should fully work with openHAB 2.3.
I will need logs for thermostats. First thing is a debug log when the binding starts. Secondly, try controlling the thermostat from the app and get me the debug log at that time.
I hope that is all I need. If not, I will need a wireshark when controlling the thermostat from the app.

(Christophe) #175

I can confirm what @Mherwege stated above. I recently upgraded to 2.3 stable with a Apple homekit binding and thanks to the great work Mark did on the 2.3 version binding we can now fully control rollershutters with Siri, Alexa etc. I can open my rollershutters 40% via voicecommands.

(Christophe) #176

Was anyone able to figure out how we can capture the output of a motion detector? I guess we will need something like a virtual item that the motion can control but I am not able to configure it in the niko software.

(Mark Herwege) #177

@extric99 I cannot test the motion detectors as I don’t have any.
I did notice though that you cannot add an action to a smartphone if the action has a motion detector as an input. However, when I created an action, added that to the phone and only afterwards added the motion detector as an input to the action, it accepted it. The action stayed connected to the phone.
If that works, you probably do not even need a virtual output, just an action, linked to a phone, with one input, the motion detector.

(Yannic VH) #178

DEBUG log doesn’t give me any info on the thermostats.
The actions I use to set modes on my thermostat just execute the action with that ID.
But I don’t get any additional info on what happens further down the line.

Can you give some extra instructions on what you’d need from wireshark capturing and how I would go about this?
Do you mean capturing traffic directly on the CC?
I tried capturing all traffic to my CC on my router.
However this also doesn’t give any details about the internal logic.

(Mark Herwege) #179


First, all of this only works with Niko Home Control I and in your home network. It does not work remotely.

When the app starts on an Android phone (and you are in the same network as the IP interface), it sends the following messages with responses to port 8000 on the IP interface (> is out, < is in):

send:     {"cmd":"listthermostat"}
response: {"cmd":"listthermostat","data":[]}
send:     {"cmd":"listthermostatHVAC"}
response: {"cmd":"listthermostatHVAC","data":[]}

I have implemented these outgoing messages in the binding and get the empty responses as you see back (I don’t have thermostats). I would expect you see something coming back, so the reply messages should not be empty.
These commands are sent when the binding starts and are written in the debug log if debug logging for the binding is on. So there definitely should be something in the debug log. Switch on debug logging on the binding and it should be there.
Also, when the thermostat is operated, I do expect Niko to emit events, something like:


The exact syntax may be different. Also these event messages should be in the binding log file when debug logging is on.
This of course does not give me the exact command syntax to execute yet, but I may be able to guess from that.

If not, we effectively need to capture the ethernet communication between your app and the IP interface when you operate the thermostat. The content of the action messages are specific to the action types, so I need these details. I have always done that by installing the Niko app in an Android emulator (Andy or Bluestacks) on my laptop and capture the traffic to the Niko ip interface. Capturing all traffic on your internal network to/from the ip interface should also capture this traffic though. We can filter on IP address of the app and IP address of the Niko ip interface to see the relevant traffic. That’s what you use Wireshark for. Capturing traffic on your router to/from the internet will not tell you anything. It has to be the traffic on your internal network.
So in summary, my recipe has always been:

  • Install Wirehark on a PC (include wincap)
  • Install and Android emulator (Andy or Bluestacks), and install the Niko app in the emulator
  • Start capturing in Wireshark
  • Open the app, go to your thermostat actions and do something with it (turn on/off, set temperature point …). Try all logical actions you can think of.
  • Stop the capture in Wireshark and save the capture file.
  • Get the capture file to me and let me know the IP address of your IP interface and of the PC with the Android emulator, so I can filter the capture.

(Yannic VH) #180


Found the logs, says I don’t have any thermostats?

2018-06-12 14:09:50.485 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: send json {"cmd":"listthermostat"} from thread 317016
2018-06-12 14:09:50.504 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: received json {"cmd":"listthermostat","data":[]} on thread 317016
2018-06-12 14:09:50.506 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: not acted on json {"cmd":"listthermostat","data":[]}
2018-06-12 14:09:50.508 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: send json {"cmd":"listthermostatHVAC"} from thread 317016
2018-06-12 14:09:50.552 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: received json {"cmd":"listthermostatHVAC","data":[]} on thread 317016
2018-06-12 14:09:50.553 [DEBUG] [rotocol.NikoHomeControlCommunication] - Niko Home Control: not acted on json {"cmd":"listthermostatHVAC","data":[]}

(Mark Herwege) #181

Can you control your thermostats from the Niko app? If you can, I made the wrong assumption thinking that info passed through the messages above.
We would then need to do a capture of the communication with the app, as described, to find out what the exact messages are.
Edit: Actually, thinking about it, if the thermostat actions are modeled as actions in NHC and visible in the app, you should see a message in the log when you change the thermostat settings through the app, some form of a event listactions message with the id of the actions linked to the thermostat. The debug log will show you all actions at startup of the binding. The ones the binding cannot handle will be ignored, but can still be found under the cmd listactions log entry at startup.