Niko Home Control

@extric99 the only difference I see at the moment in the current version of the binding vs the 2.5 version for rollershutters is the introduction of an invert flag. You may have to remove and readd the things for that to become visible.

Also, have a look at the time in your first log. 4620 (in 1/10th seconds) corresponds to almost 8 min. That can’t be right. These values are defined in the NHC programming software and retrieved from there. Check for some cmd listactions for rollershutter 40 in your log at initialization of the binding (value2 should be openTIme, value3 closeTime) to see if the value is correct there and maybe not picked up properly. Again, I don’t see changes to that code in the binding.

error:0 means there is no error.

All I can see is the invert flag seems to be set. That’s why 91 becomes 9 to OH. Note that the default up/down convention between OH and the NHC values is exactly opposed.

Woops, missed that! I’m on 3.3, so I will not have any difficulties I assume.
I still didn’t find any reason to upgrade to NHC II…

@Mherwege

Hi Mark. I remember the invert flag as we talked about that initially years ago. If I use it the blind does not work at all. The issue that I see is that when I use the niko buttons the actual position of the blind is used which I can see in the openhab log and the on HomeKit (shows x% open). However when I use the OpenHab app to open or close the blind HomeKit shows only open or closed. It does not reflect the state of the blind. I can not use HomeKit either to partially close or open a blind, only to send open or close commands. If I try to use HomeKit to partially open a blind, the binding stops working with the blind and I need to reset the blind by pressing the niko button a few times. I believe we had this issue before when the binding could manage the decimals correctly.

This is why it would seems to me that the binding is not (correctly) using the state of the blind anymore. Not sure if that is due to the binding or underlying OpenHab changes from 2.X to 3.X. It would also appear so from the log where the % open or close is visible when using button but not the openhab app. (see areas in grey below)

Inverted direction on Thing = False
Test 1

  • Blinds Open
  • Press close on niko button
  • Press open on niko button

Test 2

  • Blinds Open
  • Press down on OpenHab app button
  • Press up on OpenHab app button

I see the exact same issue in Homebridge/HomeKit for the this use case.
The state of the blind is not being passed on and it is completely absent from the log just like in the openhab log

@extric99 The logs in image format are not readable. Can you just copy and paste them in in code blocks?
The partial open/close (with a decimal position) cannot work in your environment because the open/close times seem to be incorrect. The time needed to run to a position is calculated based on open/close time and a stop command is given when that time is up. But as the open/close time is too long, it will always run to complete open or closed. I don’t know why it is so long.

I added the logs to a PDF because copying them from fronttail is making them even more unreadable. Hope this helps…

I don’t understand the comment about the open/close time. Am I missing something?

The down command is handled from 09:42.42:141 to 09:42.42:241 or 1/10 of a second.

The blind goes down for a bit more than 3 seconds before the stop command is issued.
The stop command is handled from 09:42.45:917 to 09:42.46:009 or just over 1/10 of a second.

What is preventing the calculation of the partial open close?

@extric99 Please, for logs no images or PDF’s, just the text. That allows searching, filtering, highlighting etc. when doing an analysis. I can perfectly select text from frontail in my browser and copy/paste it. It will only copy the text. And then include it in a code fences in your comment (there are a few icons to do that in the edit window, or just 3 backticks on the line before and after the log). I don’t need the nice colors.

I see in the log something like ´rollershutter 40 move time 42000´. This looks very strange, because it would correspond to 4200 seconds. So it would only schedule a stop after 4200 seconds. I don’t think that is right.

The blind is set to open and close in 42s in the niko settings.

This is the log of 2 times the same action where I lower the blind with the openhab app and open it again.
The log is different as the first time it seems to work correctly and the state is reported from 100 >12 However when opening the blind it goes from 12 > 0 while I would expect it goes back to 100.

The second time I close and open the blind with the app the state is not reported anymore. It goes from 0 >100 and 100>0

Update: I removed the binding and all things but the issues still persists after re-adding everything.
I need to invert the direction in openhab to match the position the Niko app is showing me.
However if I do this the openhab app is not working anymore. Not sure if maybe a conflict in the direction is the source of the issue

2022-12-21 13:00:10.661 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'Slaapkamer_Gordijn' received command DOWN
2022-12-21 13:00:10.662 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'Slaapkamer_Gordijn' predicted to become DOWN
==> /var/log/openhab/openhab.log <==
2022-12-21 13:00:10.669 [DEBUG] [handler.NikoHomeControlActionHandler] - handle command DOWN for nikohomecontrol:blind:440e003a366a:40:rollershutter
2022-12-21 13:00:10.670 [DEBUG] [ol.internal.protocol.nhc1.NhcAction1] - execute action Down of type ROLLERSHUTTER for 40
2022-12-21 13:00:10.672 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - handleRollerShutterCommand: rollershutter 40 command Down
2022-12-21 13:00:10.673 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - handleRollerShutterCommand: rollershutter 40, current position 0
2022-12-21 13:00:10.673 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - handleRollerShutterCommand: rollershutter 40 task executing immediately
2022-12-21 13:00:10.675 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - executeRollershutterTask: rollershutter 40 task triggered
2022-12-21 13:00:10.676 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - handleRollerShutterCommand: rollershutter 40 task running
2022-12-21 13:00:10.677 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - send json {"id":40,"value1":254,"cmd":"executeactions"}
2022-12-21 13:00:10.679 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - received json {"cmd":"executeactions", "data":{"error":0}}
2022-12-21 13:00:10.680 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - execute action success
2022-12-21 13:00:10.744 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - received json {"event":"listactions","data":[{"id":40,"value1":0}]}
2022-12-21 13:00:10.745 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - event execute action 40 with state 0
2022-12-21 13:00:10.745 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - setRollershutterMovingFalse: rollershutter 40 not moving
2022-12-21 13:00:10.746 [DEBUG] [econtrol.internal.protocol.NhcAction] - update channel state for 40 with 0
==> /var/log/openhab/events.log <==
2022-12-21 13:00:12.222 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'Slaapkamer_Gordijn' received command STOP
==> /var/log/openhab/openhab.log <==
2022-12-21 13:00:12.227 [DEBUG] [handler.NikoHomeControlActionHandler] - handle command STOP for nikohomecontrol:blind:440e003a366a:40:rollershutter
2022-12-21 13:00:12.228 [DEBUG] [ol.internal.protocol.nhc1.NhcAction1] - execute action Stop of type ROLLERSHUTTER for 40
2022-12-21 13:00:12.228 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - handleRollerShutterCommand: rollershutter 40 command Stop
2022-12-21 13:00:12.229 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - handleRollerShutterCommand: rollershutter 40, current position 0
2022-12-21 13:00:12.230 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - handleRollerShutterCommand: rollershutter 40 task executing immediately
2022-12-21 13:00:12.230 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - executeRollershutterTask: rollershutter 40 task triggered
2022-12-21 13:00:12.231 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - handleRollerShutterCommand: rollershutter 40 task running
2022-12-21 13:00:12.231 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - send json {"id":40,"value1":253,"cmd":"executeactions"}
2022-12-21 13:00:12.233 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - received json {"cmd":"executeactions", "data":{"error":0}}
2022-12-21 13:00:12.234 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - execute action success
2022-12-21 13:00:12.309 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - received json {"event":"listactions","data":[{"id":40,"value1":88}]}
2022-12-21 13:00:12.310 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - event execute action 40 with state 88
2022-12-21 13:00:12.310 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - setRollershutterMovingFalse: rollershutter 40 not moving
2022-12-21 13:00:12.311 [DEBUG] [econtrol.internal.protocol.NhcAction] - update channel state for 40 with 88
==> /var/log/openhab/events.log <==
2022-12-21 13:00:12.314 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Slaapkamer_Gordijn' changed from 100 to 12
2022-12-21 13:00:25.610 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'Slaapkamer_Gordijn' received command UP
2022-12-21 13:00:25.611 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'Slaapkamer_Gordijn' predicted to become UP
2022-12-21 13:00:25.613 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Slaapkamer_Gordijn' changed from 12 to 0
==> /var/log/openhab/openhab.log <==
2022-12-21 13:00:25.616 [DEBUG] [handler.NikoHomeControlActionHandler] - handle command UP for nikohomecontrol:blind:440e003a366a:40:rollershutter
2022-12-21 13:00:25.617 [DEBUG] [ol.internal.protocol.nhc1.NhcAction1] - execute action Up of type ROLLERSHUTTER for 40
2022-12-21 13:00:25.618 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - handleRollerShutterCommand: rollershutter 40 command Up
2022-12-21 13:00:25.618 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - handleRollerShutterCommand: rollershutter 40, current position 88
2022-12-21 13:00:25.619 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - handleRollerShutterCommand: rollershutter 40 task executing immediately
2022-12-21 13:00:25.620 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - executeRollershutterTask: rollershutter 40 task triggered
2022-12-21 13:00:25.621 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - handleRollerShutterCommand: rollershutter 40 task running
2022-12-21 13:00:25.622 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - send json {"id":40,"value1":255,"cmd":"executeactions"}
2022-12-21 13:00:25.624 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - received json {"cmd":"executeactions", "data":{"error":0}}
2022-12-21 13:00:25.625 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - execute action success
2022-12-21 13:00:25.732 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - received json {"event":"listactions","data":[{"id":40,"value1":100}]}
2022-12-21 13:00:25.732 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - event execute action 40 with state 100
2022-12-21 13:00:25.733 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - rollershutterMoveTime: rollershutter 40 move time 5040
2022-12-21 13:00:25.734 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - setRollershutterMovingTrue: rollershutter 40 moving
2022-12-21 13:00:25.735 [DEBUG] [econtrol.internal.protocol.NhcAction] - update channel state for 40 with 100
2022-12-21 13:00:30.775 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - setRollershutterMovingTrue: rollershutter 40 stopped moving
2022-12-21 13:00:36.181 [DEBUG] [ikoHomeControlBridgeDiscoveryService] - discovery broadcast on 192.168.0.255
2022-12-21 13:00:36.183 [TRACE] [nal.protocol.NikoHomeControlDiscover] - bridge discovery response 440E003A366AC0A800A6FFFFFF00
2022-12-21 13:00:36.185 [DEBUG] [nal.protocol.NikoHomeControlDiscover] - IP address is {440e003a366a=/192.168.0.166}, unique ID is 440e003a366a
2022-12-21 13:00:36.687 [DEBUG] [ikoHomeControlBridgeDiscoveryService] - NHC I bridge found at /192.168.0.166
==> /var/log/openhab/events.log <==
2022-12-21 13:00:39.407 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SunElevation' changed from 15.485718377541374 to 15.472485435470785
2022-12-21 13:00:58.427 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'Slaapkamer_Gordijn' received command DOWN
2022-12-21 13:00:58.429 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'Slaapkamer_Gordijn' predicted to become DOWN
2022-12-21 13:00:58.431 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Slaapkamer_Gordijn' changed from 0 to 100
==> /var/log/openhab/openhab.log <==
2022-12-21 13:00:58.435 [DEBUG] [handler.NikoHomeControlActionHandler] - handle command DOWN for nikohomecontrol:blind:440e003a366a:40:rollershutter
2022-12-21 13:00:58.436 [DEBUG] [ol.internal.protocol.nhc1.NhcAction1] - execute action Down of type ROLLERSHUTTER for 40
2022-12-21 13:00:58.437 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - handleRollerShutterCommand: rollershutter 40 command Down
2022-12-21 13:00:58.438 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - handleRollerShutterCommand: rollershutter 40, current position 100
2022-12-21 13:00:58.438 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - handleRollerShutterCommand: rollershutter 40 task executing immediately
2022-12-21 13:00:58.439 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - executeRollershutterTask: rollershutter 40 task triggered
2022-12-21 13:00:58.439 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - handleRollerShutterCommand: rollershutter 40 task running
2022-12-21 13:00:58.440 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - send json {"id":40,"value1":254,"cmd":"executeactions"}
2022-12-21 13:00:58.442 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - received json {"cmd":"executeactions", "data":{"error":0}}
2022-12-21 13:00:58.443 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - execute action success
2022-12-21 13:00:58.538 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - received json {"event":"listactions","data":[{"id":40,"value1":0}]}
2022-12-21 13:00:58.539 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - event execute action 40 with state 0
2022-12-21 13:00:58.540 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - rollershutterMoveTime: rollershutter 40 move time 42000
2022-12-21 13:00:58.541 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - setRollershutterMovingTrue: rollershutter 40 moving
2022-12-21 13:00:58.541 [DEBUG] [econtrol.internal.protocol.NhcAction] - update channel state for 40 with 0
2022-12-21 13:00:59.928 [DEBUG] [very.NikoHomeControlDiscoveryService] - getting devices on 440e003a366a
==> /var/log/openhab/events.log <==
2022-12-21 13:01:03.451 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'Slaapkamer_Gordijn' received command STOP
==> /var/log/openhab/openhab.log <==
2022-12-21 13:01:03.457 [DEBUG] [handler.NikoHomeControlActionHandler] - handle command STOP for nikohomecontrol:blind:440e003a366a:40:rollershutter
2022-12-21 13:01:03.458 [DEBUG] [ol.internal.protocol.nhc1.NhcAction1] - execute action Stop of type ROLLERSHUTTER for 40
2022-12-21 13:01:03.458 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - handleRollerShutterCommand: rollershutter 40 command Stop
2022-12-21 13:01:03.459 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - handleRollerShutterCommand: rollershutter 40, current position 0
2022-12-21 13:01:03.459 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - handleRollerShutterCommand: rollershutter 40 moving, therefore stop
2022-12-21 13:01:03.460 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - rollershutterPositionStop: rollershutter 40 executing
2022-12-21 13:01:03.461 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - send json {"id":40,"value1":253,"cmd":"executeactions"}
2022-12-21 13:01:03.463 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - received json {"cmd":"executeactions", "data":{"error":0}}
2022-12-21 13:01:03.464 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - execute action success
2022-12-21 13:01:03.521 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - received json {"event":"listactions","data":[{"id":40,"value1":88}]}
2022-12-21 13:01:03.522 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - event execute action 40 with state 88
2022-12-21 13:01:03.523 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - setRollershutterMovingFalse: rollershutter 40 not moving
2022-12-21 13:01:03.524 [DEBUG] [ol.internal.protocol.nhc1.NhcAction1] - received requested rollershutter 40 position event 88
2022-12-21 13:01:03.524 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - executeRollershutterTask: rollershutter 40 task triggered
2022-12-21 13:01:03.525 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - handleRollerShutterCommand: rollershutter 40 task running
2022-12-21 13:01:03.526 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - send json {"id":40,"value1":253,"cmd":"executeactions"}
2022-12-21 13:01:03.528 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - received json {"cmd":"executeactions", "data":{"error":0}}
2022-12-21 13:01:03.529 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - execute action success
==> /var/log/openhab/events.log <==
2022-12-21 13:01:23.686 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'Slaapkamer_Gordijn' received command UP
2022-12-21 13:01:23.687 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'Slaapkamer_Gordijn' predicted to become UP
2022-12-21 13:01:23.689 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Slaapkamer_Gordijn' changed from 100 to 0
==> /var/log/openhab/openhab.log <==
2022-12-21 13:01:23.692 [DEBUG] [handler.NikoHomeControlActionHandler] - handle command UP for nikohomecontrol:blind:440e003a366a:40:rollershutter
2022-12-21 13:01:23.693 [DEBUG] [ol.internal.protocol.nhc1.NhcAction1] - execute action Up of type ROLLERSHUTTER for 40
2022-12-21 13:01:23.694 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - handleRollerShutterCommand: rollershutter 40 command Up
2022-12-21 13:01:23.695 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - handleRollerShutterCommand: rollershutter 40, current position 0
2022-12-21 13:01:23.696 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - handleRollerShutterCommand: rollershutter 40 task executing immediately
2022-12-21 13:01:23.697 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - executeRollershutterTask: rollershutter 40 task triggered
2022-12-21 13:01:23.698 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - handleRollerShutterCommand: rollershutter 40 task running
2022-12-21 13:01:23.699 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - send json {"id":40,"value1":255,"cmd":"executeactions"}
2022-12-21 13:01:23.701 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - received json {"cmd":"executeactions", "data":{"error":0}}
2022-12-21 13:01:23.702 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - execute action success
2022-12-21 13:01:23.766 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - received json {"event":"listactions","data":[{"id":40,"value1":100}]}
2022-12-21 13:01:23.767 [DEBUG] [l.nhc1.NikoHomeControlCommunication1] - event execute action 40 with state 100
2022-12-21 13:01:23.768 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - rollershutterMoveTime: rollershutter 40 move time 42000
2022-12-21 13:01:23.769 [TRACE] [ol.internal.protocol.nhc1.NhcAction1] - setRollershutterMovingTrue: rollershutter 40 moving
2022-12-21 13:01:23.769 [DEBUG] [econtrol.internal.protocol.NhcAction] - update channel state for 40 with 100
2022-12-21 13:01:36.692 [DEBUG] [ikoHomeControlBridgeDiscoveryService] - discovery broadcast on 192.168.0.255
2022-12-21 13:01:36.695 [TRACE] [nal.protocol.NikoHomeControlDiscover] - bridge discovery response 440E003A366AC0A800A6FFFFFF00
2022-12-21 13:01:36.696 [DEBUG] [nal.protocol.NikoHomeControlDiscover] - IP address is {440e003a366a=/192.168.0.166}, unique ID is 440e003a366a
2022-12-21 13:01:37.198 [DEBUG] [ikoHomeControlBridgeDiscoveryService] - NHC I bridge found at /192.168.0.166

Why is the 42000 an issue. If I look at the code it is expecting the duration is miliseconds. Are there maybe other parts where the code is expecting the duration to be in seconds?

        if (logger.isTraceEnabled()) {
            logger.trace("scheduleRollershutterStop: schedule rollershutter {} stop in {}ms", id, duration);
        }
        rollershutterStopTask = scheduler.schedule(() -> {
            logger.trace("scheduleRollershutterStop: run rollershutter {} stop", id);
            executeRollershutterStop();
        }, duration, TimeUnit.MILLISECONDS);

When I calculate this I get to the same result: (100-0)x42*10 = 42000
100 the start position
0 the close position
42 the number of seconds I programmed in the niko software.

    private long rollershutterMoveTime(int currentValue, int newValue) {
        int totalTime = (newValue > currentValue) ? getOpenTime() : getCloseTime();
        long duration = Math.abs(newValue - currentValue) * totalTime * 10;
        if (logger.isTraceEnabled()) {
            logger.trace("rollershutterMoveTime: rollershutter {} move time {}", id, duration);
        }

@extric99 You are right about this. The value is correct. It has been too long I didn’t delve into the NHC I code. I am looking at what is happening exactly and see if I can find something.

This looks correct. Earlier in the log, the state is set to DOWN, which corresponds to 100. UP corresponds to 0. This is exactly opposite of the binding log. So in the events you should see the opposite of the binding log, except when the invert flag is set.

I do think there must be a conflict in direction somewhere, but cannot put my finger on it yet.
There seems to be some interference with stop commands given, so every action may influence the next one.

To analyzing for me, can you do a few tests and clearly indicate what you have done each time and what the result in OH is. I will need logs for each of these tests, clearly identified. Leave the invert flag off for now.

  1. With the rollershutter in position open (UP=0), from OH give down command and wait until the end (don’t push stop).
  2. After finishing this, and the presentation in the app being stable, give an UP command in OH and STOP while in motion.
  3. Give another UP in OH command and wait until the rollershutter is fully up.
  4. From UP (open position) again, give a percentage command in OH. Remember, UP=0, DOWN=100 for OH. Let it run until it stops.
  5. Start again with the rollershutter in open position (UP). This time give a down command from the wall button. Let it run to the end.
  6. Give an up command from the wall button, followed by a stop command from the wall button while in motion.
  7. Give another up command from the wall button and wait until the rollershutter is fully up.

I hope this will already help me identify the issue. Next tests would be with the invert flag, and mixing OH command and wall button commands. That may not be necessary if I find the issue with these tests.

Mark
Thanks for looking into this, truly appreciate it.
I am on family cooking duty so I will only look into this somewhere next week.

Merry X-mass to all.

The Niko Home Control binding only exposes 1 channel for blinds.

Apple HomeKit makes a clear distinction between CurrentPosition and TargetPosition.

And openHAB distinguishes the current state from the target state through sendCommand() and postUpdate().

I suppose that the only way of getting this to work, is by creating proxy items that mimic the current and target position, and let openHAB take care of setting the target position by sending commands to the one channel exposed by the Niko Home Control binding.

Something like:

Group gRollerShutter_Bedroom_1 "Blinds Bedroom 1" <rollershutter>
Number RollerShutter_Bedroom_1_TargetPosition "Target Position" (gRollerShutter_Bedroom_1) { homekit=WindowCovering.targetPosition }
Number RollerShutter_Bedroom_1_CurrentPosition "Target Position" (gRollerShutter_Bedroom_1) { channel="nikohomecontrol:blind:xyzzy", homekit="WindowCovering.currentPosition" }

You then need to add a rule that will send the appropriate state update to RollerShutter_Bedroom_1_CurrentPosition when operating the blinds via the RollerShutter_Bedroom_1_TargetPosition proxy Item.

sendCommand would be used to send a command to a device (through the binding). postUpdate is used by a binding when it receives a state update from the physical device. NHC only sends state updates when the rollershutter ends its movement, so no value in having a second channel. There is no intermediate state available while moving.
I don’t use homekit, but the homekit documentation suggests linking both items (current and target) to the same channel is fine. The target state will then be used for both.

Thanks for clarifying this.

In essence, if I want to operate a Thing from within openHAB, I have to use sendCommand for the binding to do its magic.

Likewise, if the binding receives a status update from the same Thing, it will issue postUpdate to inform openHAB.

I had a quick look at the NHC hobby API documentation, and I understand that there is no active polling required, eveything is handled through publish & subscribe over MQTT.

If state changes are only reported by the Hobby API when an end position (target position) has been reached, we could technically distinguish between currentPosition and targetPosition. At least if the Hobby API reports whenever an action was initiated and when it ended, preferably with the state conveyed in each related MQTT message.

Then we could infer that ìsMoving as being identical to currentPosition != targetPosition or that the target position hasn’t been reached as long as isMoving is true. We would this way substitute for the state predictor in openHAB.

There is actually a third mandatory parameter for blinds (Homekit WindowCovering category): positionState. It should be either opening, closing or stopped, see Homekit documentation.

You can associate both currentPositionand targetPosition to the same Item (linked to the Thing channel), but then you get frequent state mismatches, in particular with blinds which report that they are open although they are closed. These mismatches occur when trying to send another state update to a blind while it is still moving.

Unfortunatelly this config modification ( org.openhab.threadpool:ThingHandler=10) doesn’t help. It works just after openhab service restarted but 1-2 minutes after start there is always delay few (10-120) seconds. Mark may I help with debuging somehow?

Thanks.

I have done complete cleanup of all unecessary rules, bindings, items and now it works for several (6) days without a hassle. It seems there was mess with rules that made threads busy. Thanks once more.

@fcela Good you got it working. I don’t think I can help much on NHC I anymore. I don’t have an installation myself, so it gets difficult.

I noticed that sometimes the binding loses connection with the hobby API from Niko Home Control II is lost. The openhab.log file then contains lines like:

2023-04-28 15:23:36.287 [WARN ] [very.NikoHomeControlDiscoveryService] - not connected