Nikobus rollershutter - blinds module feedback (feedback voor rolluikmodule)

Tags: #<Tag:0x00007f616ef05d80> #<Tag:0x00007f616ef05b50> #<Tag:0x00007f616ef05970>

Hi,

is anyone using the Nikobus binding in combination with the rollershutter - blinds module (rolluikmodule)?

I have quite a lot of those modules in my installation and I tried to configure them and these are my findings:
Configuring the outputs of the shutter modules as rollershutter in Openhab works fine and controls the blinds to go up-down or stop.
Configuration looks like
Rollerschutter rolluik {nikobus=“C964:4”}

Where I struggle is getting the feedback to work. My blinds are controlled by physical buttons as well and when I try to configure those physical buttons to update the state of the channelgroup of the rollershutter module (exactly like I do with wall switched controlling a switch module) it fails.

So when I do something like

Switch Office_Top_Left “Schutter up” {nikobus="#N006884[C964-2]"}

(with #N006884 the address of the physical button and [C964-2] the reference to channelgroup 2 of the module) it fails and breaks the entire feedback functionality of the Nikobus binding.
In the log files I receive an error message mentioning something like "expected ack not received within time 2000).

So it looks like the binding is sending the status update requests just like it does for a switch module but is not capable of reading the response of the shutter module.
Once this error is received no feedback is working any more (also not the switch module feedback functionality that worked before). No physical configured button is recognized any more and no Nikobus status is happening any more.

So my question:

  1. Is anyone using Nikobus with rollershutter modules ?
  2. How did you configure this (did you configure module outputs as rollershutter items or did you configure virtual buttons or real buttons to control your blinds and just send these (virtual button commands to the Nikobus without status tracking of the blinds)
  3. Do you have status update when blinds are controlled by a physical button and how did you configure this (does the module have 1 channel group or 2 or did you use specific syntax?)

Thanks a lot.

Nobody using nikobus binding with shutters or blinds? If you do are you getting info about the status of the rollershutter or screen in openHAB (whether it’s open or closed)

Hey, I have a similar installation and it seems to be working.

Patrick,

that’s interesting. What OH version are you running? And how did you configure your rolleshutters in Nikobus, did you configure a T2 “running time” “looptijd”, so when you press up, does the light on the Nikubus module remain up or does it go to neutral after some time (60s or 90s).

If you control your shutter via a wall switch (up or down) does the status (open/close) adapt in Openhab ?

Hey,

So after some testing it turns out this isn’t working as I expected.

The Binding does return a state when the shutters move as a result of a Nikobus event (wall switch, module button directly), but it’s always 1, regardless if it’s up or down. Then after 60 seconds it returns to 0. I guess this is the time-out you described.

Sending commands works fine.

Is that what you are experiencing?

I’m running OH2.1 stable on a RPi3.

Well, I didn’t really get to that point but it does make sense. On the module itself you will see the red led on during up and down (reflecting the relay to be closed). 60 seconds indeed is a common timeout (though you can change it for long or slow rollershutters or screens in the Nikobus configuration tool).

After that the open/close relay is released and led go out (and binding probably gets 0 on status update).

I haven’t had time for this lately but might look into this in the coming months.

What I’m thinking about is create 2 variable for each roller shutter (a status variable and a motion initiated variable) and the for each of the rollershutters (which are a lot in my case :frowning: ) a rule along the lines of

If any of the commands triggering the roller id detected do following
if status is opening or closing => change status to stopped and calculate position based on current timestamp vs motion initiated timestamp
else set motioninitiated timestamp, set status to opening or closing depending on command and call expire binding for timing it takes shutter to close entirely (when expire finishes and status is still opening or closing (hasn’t been changed to stopped because another command fired same rule again) set status to 100% or 0%).

If these are persisted this should work but frankly I don’t like it too much, way to complicated to just track status of shutter, so if anyone has a better idea or has already built a rule to track shutter status (for shutters that don’t report back %) that would be great to understand and learn from it

I tried setting up item states to capture the states of nikobus but I couldn’t get it to work. The signal from nikobus was unreliable/buggy.

The biggest issue I had has to do with the Binding sending the states for all relays on a single module. Even when my item states matches exactly the relay states it sometimes sent the wrong states which causes another shutters to open or close. It seems the Binding stores the relay states somewhere other than the item states and I can’t figure out how to set those states correctly.

Also when I send the up/down command to the bus the relay does not set to stop by itself. So I created a rule to set send the stop command after 60 seconds. That seems to work okay.

Yes I left that route and started capturing the screen state based on the time between the commands send on the bus that control the screen. So time based screen or rollershutter position feedback based on rules.

I have it working but it ended up being a lot of code per screen - shutter. On the positive side this will tell you not just when the screen is open or closed, when you stop the screen during opening it will tell you it’s 75% open or 33% open for example. The code also uses current_position and target_position items which is in line with the structure homekit is using, so this can be mapped one on one to homekit in node red. So you will see the window covering items opening and closing in the Apple home application.

Here is my code, no promises or guarantees. I’m not a developer so for sure this can be done more efficient.

There are a few things to know/measure and it assumes the Nikobus modules are configured in M1 mode with a runtime
First the T2 runtime value configured through the Nikobus software: here 60sec and this value is the expire binding value
Secondly measure the time it takes for the screen to completely open or close (here 30 sec), the runtime val parameter in the rules file.

The items in the opening and closing rule are the button items (virtual or real) that you configured in Openhab that open or close the screen. (For real buttons open is the upper button, close the bottom button and stop is either upper or bottom while running)

The item file is

Group gScreen
Rollershutter screen_bureau "Screen bureau" (gScreen)
Number screen_bureau_current_position "current pos [%.1f]" (gScreen)
Number screen_bureau_target_position "target pos [%.1f]" (gScreen)
String screen_bureau_state "state  [%s]" (gScreen) { expire="60s,STOPPED" }
DateTime screen_bureau_time (gScreen)

and this is the rules file

val Number screen_bureau_runtime = 30
var Number screen_bureau_gelopen = 0
var Number screen_bureau_newposition = 0

// Opgelet: % aanduiding is % open voor Homekit, dus 0% is gesloten en 100% is open
// Opgelet: % aanduiding is % gesloten voor Openhab, dus 0% is open en 100% is gesloten

rule "screen bureau openhab item received command" 
	when 
		Item screen_bureau received command
	then 
		if ((receivedCommand == UP) || (receivedCommand == 0))
            {  
				VB4_2C_screen_bureau_op.sendCommand(ON)      
            }
        if ((receivedCommand == DOWN) || (receivedCommand == 100))
            {  
				VB4_2D_screen_bureau_neer.sendCommand(ON)      
            }
		if ((receivedCommand == STOP) && (screen_bureau_state.state.toString != "STOPPED"))
            {  
				VB4_2C_screen_bureau_op.sendCommand(ON)      
            }
	end


rule "screen bureau open" 
	when 
		Item NB_RB_bureaudeurlinks_BP8_A received update ON or
		Item VB4_2C_screen_bureau_op received update ON
	then 
		if ((screen_bureau_state.state.toString == "OPENING") || (screen_bureau_state.state.toString == "CLOSING"))
            {  
				screen_bureau_state.postUpdate("STOPPED")      
            }
        else
        	{ 
				screen_bureau_state.postUpdate("OPENING")   
				screen_bureau_time.postUpdate(now.toString())
				if (screen_bureau_current_position.state == NULL) { screen_bureau_current_position.postUpdate(0) }
				screen_bureau_target_position.postUpdate(100)
				
            }
	end

rule "screen bureau dicht" 
	when 
		Item NB_RB_bureaudeurlinks_BP8_B received update ON or
		Item VB4_2D_screen_bureau_neer received update ON
	then 
		if ((screen_bureau_state.state.toString == "OPENING") || (screen_bureau_state.state.toString == "CLOSING"))
            { 
				screen_bureau_state.postUpdate("STOPPED")      
            }
        else
        	{ 
				screen_bureau_state.postUpdate("CLOSING")
				screen_bureau_time.postUpdate(now.toString())
				if (screen_bureau_current_position.state == NULL) { screen_bureau_current_position.postUpdate(100) }
				screen_bureau_target_position.postUpdate(0)
				       
            }
	end

rule "screen bureau stopped" 
	when Item screen_bureau_state changed
	then 
		if (screen_bureau_state.state.toString == "STOPPED")
			{ 
				
				if (((now.millis - (screen_bureau_time.state as DateTimeType).calendar.timeInMillis)/1000) > screen_bureau_runtime) 
					{
  						screen_bureau_current_position.postUpdate(screen_bureau_target_position.state)
						screen_bureau.postUpdate(100 - (screen_bureau_current_position.state as DecimalType))
					}
				else 
					{
						if (screen_bureau_target_position.state > screen_bureau_current_position.state)
							{
								screen_bureau_gelopen = 100*((now.millis - (screen_bureau_time.state as DateTimeType).calendar.timeInMillis)/1000)/screen_bureau_runtime
								screen_bureau_newposition = ((screen_bureau_current_position.state as DecimalType) + screen_bureau_gelopen).intValue
								if (screen_bureau_newposition > 100) { screen_bureau_target_position.postUpdate(100) } else { screen_bureau_target_position.postUpdate(screen_bureau_newposition) } 
								screen_bureau_current_position.postUpdate(screen_bureau_target_position.state)
								screen_bureau.postUpdate((100 - (screen_bureau_current_position.state as DecimalType)).intValue)
							}
						if (screen_bureau_target_position.state < screen_bureau_current_position.state)
							{
								screen_bureau_gelopen = 100*((now.millis - (screen_bureau_time.state as DateTimeType).calendar.timeInMillis)/1000)/screen_bureau_runtime
								screen_bureau_newposition = ((screen_bureau_current_position.state as DecimalType) - screen_bureau_gelopen).intValue
								if (screen_bureau_newposition < 0) { screen_bureau_target_position.postUpdate(0) } else { screen_bureau_target_position.postUpdate(screen_bureau_newposition) } 
								screen_bureau_current_position.postUpdate(screen_bureau_target_position.state)
								screen_bureau.postUpdate((100 - (screen_bureau_current_position.state as DecimalType)).intValue)
							}	
					}
			}	
	end

It should now be fairly easy to add a rule that when the rollershutter item receives a command an ON command is sent to the nikobus item (virtual or real button) that opens or closes the screen.
I’m not sure I will be doing that as I don’t use the standard GUI. So my next step will be making sure I link it to the Apple home app so I can see there if it’s open or closed, how far and allowing me to open and close from within the Home app

How did you get HomeKit to see your Niko shutter?

I followed the logic of this post Other homekit types through node-red
just with WindowCovering instead of fan or window.

Below a screenshot of my flow in node red. I now see the status of the screen in the Apple home app (open close and even % open) and can open and close the nikobus screen from the Apple home app

@rswennen is it possible to export your flow or describe it in details?

[{“id”:“cf3ade28.66f3b”,“type”:“openhab2-in”,“z”:“cd7c326a.010ac”,“name”:"",“controller”:“613f7b1c.90cb24”,“itemname”:“screen_bureau_current_position”,“x”:150,“y”:180,“wires”:[[“284e1d93.725eb2”],[]]},{“id”:“a46dcd86.abef”,“type”:“openhab2-in”,“z”:“cd7c326a.010ac”,“name”:"",“controller”:“613f7b1c.90cb24”,“itemname”:“screen_bureau_target_position”,“x”:150,“y”:240,“wires”:[[“dc9bc9ff.9b75d8”],[]]},{“id”:“284e1d93.725eb2”,“type”:“json”,“z”:“cd7c326a.010ac”,“name”:"",“pretty”:true,“x”:390,“y”:180,“wires”:[[“cc4ccfff.2fce”]]},{“id”:“cc4ccfff.2fce”,“type”:“function”,“z”:“cd7c326a.010ac”,“name”:"",“func”:“var newMsg = { payload: {“CurrentPosition”:msg.payload} };\nreturn newMsg;”,“outputs”:1,“noerr”:0,“x”:530,“y”:180,“wires”:[[“ed30400d.84239”]]},{“id”:“dc9bc9ff.9b75d8”,“type”:“json”,“z”:“cd7c326a.010ac”,“name”:"",“pretty”:true,“x”:390,“y”:240,“wires”:[[“c5e5744a.135ce8”]]},{“id”:“c5e5744a.135ce8”,“type”:“function”,“z”:“cd7c326a.010ac”,“name”:"",“func”:“var newMsg = { payload: {“TargetPosition”:msg.payload} };\nreturn newMsg;”,“outputs”:1,“noerr”:0,“x”:530,“y”:240,“wires”:[[“ed30400d.84239”]]},{“id”:“ed30400d.84239”,“type”:“homekit-service”,“z”:“cd7c326a.010ac”,“accessory”:“a7534cc9.9d077”,“name”:“Screen bureau”,“serviceName”:“WindowCovering”,“x”:740,“y”:180,“wires”:[[“3534290e.fe0276”]]},{“id”:“e4837be7.b98018”,“type”:“function”,“z”:“cd7c326a.010ac”,“name”:“Invert target position”,“func”:“var newMsg = { payload:(100 - msg.payload.TargetPosition)};\nreturn newMsg;”,“outputs”:1,“noerr”:0,“x”:1200,“y”:180,“wires”:[[“ab8492e7.e40f”]]},{“id”:“ab8492e7.e40f”,“type”:“openhab2-out”,“z”:“cd7c326a.010ac”,“name”:"",“controller”:“613f7b1c.90cb24”,“itemname”:“screen_bureau”,“topic”:“ItemCommand”,“payload”:"",“x”:1420,“y”:180,“wires”:[]},{“id”:“3534290e.fe0276”,“type”:“switch”,“z”:“cd7c326a.010ac”,“name”:“Home app triggered ?”,“property”:“hap.context”,“propertyType”:“msg”,“rules”:[{“t”:“nnull”}],“checkall”:“true”,“outputs”:1,“x”:960,“y”:180,“wires”:[[“e4837be7.b98018”]]},{“id”:“613f7b1c.90cb24”,“type”:“openhab2-controller”,“z”:"",“name”:“OH2”,“protocol”:“http”,“host”:“localhost”,“port”:“8080”,“path”:"",“username”:"",“password”:""},{“id”:“a7534cc9.9d077”,“type”:“homekit-accessory”,“z”:"",“accessoryName”:“Screen bureau”,“pinCode”:“111-11-111”,“port”:"",“manufacturer”:“Default Manufacturer”,“model”:“Default Model”,“serialNo”:“Default Serial Number”,“accessoryType”:“14”}]

@SpeedMaxX here you go :slight_smile:

THX!

My problem now is, that I am not able to install node-red-contrib-homekit.

How did you do?

I followed this guide https://flows.nodered.org/node/node-red-contrib-homekit

Hi @rswennen,

Following your post Other homekit types through red-node I managed to build a similar flow for my Z-Wave rollershutter.

I am facing one issue and I am curious if you encounterd the same: when opening the blind the icon in Apple Home app is continuously updating (spinning circle). Only when closing the blind the icon is updating in closed status.

Additionally, what is the reason for the json objects (for whatever reason I am not able to import your red-node export)?

Chris - It looks like you’re doing the same thing I just set up last night. My blinds aren’t Z-wave but the “fix” should be the same.

In order to command your blinds you’re sending “TargetPosition” if I remember correctly. This tells HomeKit that the blinds are moving - at which point the blinds wait for a “CurrentPosition” update to know the blinds are open. In my case I’ve created a second command to send into the blinds after 12 seconds for the “CurrentPosition” - I’ll put a picture of the flow so you can see.

What happens is the command comes from OH, gets changed to HomeKit JSON:

{"TargetPosition":100}
{"CurrentPosition":100}

But the “CurrentPosition” is delayed by 12 seconds (the amount of time my curtian takes to open). You’ll see additionally that I’ve put a link for the “Dimer Out” item that sends the value back through the “CurrentPosition” delay - this is in the case the command came from HomeKit rather than OH.

@crxporter
Thanks for the hint, it led me to build the following.
I am reading the power consumption of the rollershutter motor (available on FGR-222 zwave device).
As soon as the consumption = 0 I am updating “CurrentPosition” with the value of “TargetPosition” in function “CurrentPosition”:

Hi Rohnny,

Is this feedback program for a Nikobus Rollershutter Module still working or are there better ways to get this done?

Kind regards,