searched around the web everywhere and tried different flows from other people but can't get it to work at all.
I can add and control the window coverings through homekit but the current state is never right.
the flow from @crxporter
when the shutters are open it displays closed on homekit
, then when I click it show spinning wheel as if its opens the currents but off course nothing happens because they are already open, but when I click again to close they actually close`
I added a video to show the problem and the flow from it
hope someone can figure this out
thx
video hope you guys can view it, didn't know how to show else on GitHub
https://share.icloud.com/photos/0rTEhywAWEf3YPFDpNfc7iSTA#Wervik_-_Geluwe
flow:
[{"id":"293fb4d.0d8f1cc","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"320daa8e.7b5226","type":"function","z":"293fb4d.0d8f1cc","name":"Target Position","func":"var input = msg.payload;\nvar delay = {payload:0};\nif(input < 101){\n msg.payload = {\n \"TargetPosition\": input\n };\n delay.payload = {\n \"CurrentPosition\": input\n };\n return [msg,delay];\n}","outputs":2,"noerr":0,"x":220,"y":60,"wires":[["5fe1c5be.2da3a4"],["3794b37e.5f61c4"]]},{"id":"5fe1c5be.2da3a4","type":"homekit-service","z":"293fb4d.0d8f1cc","isParent":true,"bridge":"4bc87cd0.337f6c","parentService":"","name":"Window","serviceName":"WindowCovering","topic":"","filter":false,"manufacturer":"geani","model":"rolluik","serialNo":"2","cameraConfigVideoProcessor":"","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":"","cameraConfigMaxWidth":"","cameraConfigMaxHeight":"","cameraConfigMaxFPS":"","cameraConfigMaxBitrate":"","cameraConfigVideoCodec":"","cameraConfigAudioCodec":"","cameraConfigAudio":false,"cameraConfigPacketSize":"","cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"","cameraConfigMapAudio":"","cameraConfigVideoFilter":"","cameraConfigAdditionalCommandLine":"","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{\"Brightness\":true}","x":560,"y":60,"wires":[["53512652.d14d88"],[]]},{"id":"3794b37e.5f61c4","type":"delay","z":"293fb4d.0d8f1cc","name":"","pauseType":"delay","timeout":"12","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":400,"y":100,"wires":[["5fe1c5be.2da3a4"]]},{"id":"49e17f83.3e741","type":"openhab2-in","z":"293fb4d.0d8f1cc","name":"Window","controller":"1324a901.5aef0f","itemname":"RolluikVooraan_Rollershutter","x":80,"y":120,"wires":[["320daa8e.7b5226"],[]]},{"id":"53512652.d14d88","type":"function","z":"293fb4d.0d8f1cc","name":"Curtain Out","func":"var t = context.get('t')||0;\nvar delay = {payload:0}\nif(msg.payload.TargetPosition){\n t = msg.payload.TargetPosition;\n context.set('t',t);\n msg.payload=t\n}\nif(msg.payload.TargetPosition === 0){\n t = msg.payload.TargetPosition;\n context.set('t',t);\n msg.payload=t\n}\nif (msg.hap.context !== undefined){\n delay.payload = {\n \"CurrentPosition\": t\n };\n return [msg,delay]\n}","outputs":2,"noerr":0,"x":710,"y":60,"wires":[["a99a1867.9f4ea"],["b9f9948.6680968"]]},{"id":"471228ad.f257a","type":"link in","z":"293fb4d.0d8f1cc","name":"","links":["b9f9948.6680968"],"x":295,"y":120,"wires":[["3794b37e.5f61c4"]]},{"id":"a99a1867.9f4ea","type":"openhab2-out","z":"293fb4d.0d8f1cc","name":"Window","controller":"1324a901.5aef0f","itemname":"RolluikVooraan_Rollershutter","topic":"ItemCommand","payload":"","x":880,"y":60,"wires":[[]]},{"id":"b9f9948.6680968","type":"link out","z":"293fb4d.0d8f1cc","name":"","links":["471228ad.f257a"],"x":855,"y":120,"wires":[]},{"id":"3f718ce3.acc744","type":"inject","z":"293fb4d.0d8f1cc","name":"","topic":"","payload":"{\"TargetPosition\": 0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":350,"y":200,"wires":[["5fe1c5be.2da3a4"]]},{"id":"5fbcfe45.80989","type":"inject","z":"293fb4d.0d8f1cc","name":"","topic":"","payload":"{\"CurrentPosition\": 0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":380,"y":360,"wires":[["5fe1c5be.2da3a4"]]},{"id":"4bc87cd0.337f6c","type":"homekit-bridge","z":"","bridgeName":"Rolluik achter","pinCode":"111-11-201","port":"","allowInsecureRequest":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":true},{"id":"1324a901.5aef0f","type":"openhab2-controller","z":"","name":"Pi bridge","protocol":"http","host":"192.168.0.1
3","port":"8080","path":"","username":"","password":""}]
I'm trying to copy your flow but it's been changed at some point between when you copied it and when you pasted it.
If you could send again with code fences around it would be very helpful. The code fences are the button in the github comments that looks like <> - this will keep everything formatted nicely without \n anywhere (you've copied from a text editor that wraps lines it seems...)
Also if you could make sure it is "valid"... Try this website as I see you're taking out some usernames and passwords. You can edit the JSON then copy-paste it.
[{"id":"293fb4d.0d8f1cc","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"320daa8e.7b5226","type":"function","z":"293fb4d.0d8f1cc","name":"Target Position","func":"var input = msg.payload;\nvar delay = {payload:0};\nif(input < 101){\n msg.payload = {\n \"TargetPosition\": input\n };\n delay.payload = {\n \"CurrentPosition\": input\n };\n return [msg,delay];\n}","outputs":2,"noerr":0,"x":220,"y":60,"wires":[["5fe1c5be.2da3a4"],["3794b37e.5f61c4"]]},{"id":"5fe1c5be.2da3a4","type":"homekit-service","z":"293fb4d.0d8f1cc","isParent":true,"bridge":"4bc87cd0.337f6c","parentService":"","name":"Window","serviceName":"WindowCovering","topic":"","filter":false,"manufacturer":"geani","model":"rolluik","serialNo":"2","cameraConfigVideoProcessor":"","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":"","cameraConfigMaxWidth":"","cameraConfigMaxHeight":"","cameraConfigMaxFPS":"","cameraConfigMaxBitrate":"","cameraConfigVideoCodec":"","cameraConfigAudioCodec":"","cameraConfigAudio":false,"cameraConfigPacketSize":"","cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"","cameraConfigMapAudio":"","cameraConfigVideoFilter":"","cameraConfigAdditionalCommandLine":"","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{\"Brightness\":true}","x":560,"y":60,"wires":[["53512652.d14d88"],[]]},{"id":"3794b37e.5f61c4","type":"delay","z":"293fb4d.0d8f1cc","name":"","pauseType":"delay","timeout":"12","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":400,"y":100,"wires":[["5fe1c5be.2da3a4"]]},{"id":"49e17f83.3e741","type":"openhab2-in","z":"293fb4d.0d8f1cc","name":"Window","controller":"1324a901.5aef0f","itemname":"RolluikVooraan_Rollershutter","x":80,"y":120,"wires":[["320daa8e.7b5226"],[]]},{"id":"53512652.d14d88","type":"function","z":"293fb4d.0d8f1cc","name":"Curtain Out","func":"var t = context.get('t')||0;\nvar delay = {payload:0}\nif(msg.payload.TargetPosition){\n t = msg.payload.TargetPosition;\n context.set('t',t);\n msg.payload=t\n}\nif(msg.payload.TargetPosition === 0){\n t = msg.payload.TargetPosition;\n context.set('t',t);\n msg.payload=t\n}\nif (msg.hap.context !== undefined){\n delay.payload = {\n \"CurrentPosition\": t\n };\n return [msg,delay]\n}","outputs":2,"noerr":0,"x":710,"y":60,"wires":[["a99a1867.9f4ea"],["b9f9948.6680968"]]},{"id":"471228ad.f257a","type":"link in","z":"293fb4d.0d8f1cc","name":"","links":["b9f9948.6680968"],"x":295,"y":120,"wires":[["3794b37e.5f61c4"]]},{"id":"a99a1867.9f4ea","type":"openhab2-out","z":"293fb4d.0d8f1cc","name":"Window","controller":"1324a901.5aef0f","itemname":"RolluikVooraan_Rollershutter","topic":"ItemCommand","payload":"","x":880,"y":60,"wires":[[]]},{"id":"b9f9948.6680968","type":"link out","z":"293fb4d.0d8f1cc","name":"","links":["471228ad.f257a"],"x":855,"y":120,"wires":[]},{"id":"3f718ce3.acc744","type":"inject","z":"293fb4d.0d8f1cc","name":"","topic":"","payload":"{\"TargetPosition\": 0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":350,"y":200,"wires":[["5fe1c5be.2da3a4"]]},{"id":"5fbcfe45.80989","type":"inject","z":"293fb4d.0d8f1cc","name":"","topic":"","payload":"{\"CurrentPosition\": 0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":380,"y":360,"wires":[["5fe1c5be.2da3a4"]]},{"id":"4bc87cd0.337f6c","type":"homekit-bridge","z":"","bridgeName":"Rolluik achter","pinCode":"111-11-201","port":"","allowInsecureRequest":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":true},{"id":"1324a901.5aef0f","type":"openhab2-controller","z":"","name":"Pi bridge","protocol":"http","host":"192.168.0.13","port":"8080","path":"","username":"","password":""}]
Ok cool, this looks very familiar - I'm guessing you borrowed heavily from my examples on the openhab forum. Great!
I would recommend making sure your openhab setup is working right. Can you verify that the payloads coming "out" of openhab (so your openhab2-in) are strictly integer payloads? Additionally, do your openhab nodes send updates once the window has stopped? I'm not sure which hardware you're using, my "window" item in openhab was actually set up as a dimmer switch... Your item may have more helpful features.
Try this:
Set up a debug node on your openhab2-in item and change the window from the openhab environment. You might get messages only when you initiate the change, only when the window has stopped moving, or both. Please check this.

(I don't have openhab installed so I replaced with an inject node)
From there we can troubleshoot or perhaps update your function node so that homekit reflects the correct window state. Finally we will revisit the node on the other side "Curtain Out" to see if it needs any changes.
I get this when I start closing them but when there closed
nothing happens
no updates of the status

Alright it looks like you're on a different version of openhab from the one I used. The value is not in msg.payload but msg.payload.value - also looks like a string instead of a number.
Change the first 2 lines of your Target Position node to:
var input = msg.payload.value;
input = Number(input);
Then see if things work better.
nothing changes ( I restarted the node-red service and openhab) didn't know if this was necessary
when they're closed nothing happens
So you're getting these payloads for "opening" the window but not "closing" the window?
Oh also does ā100%ā mean ā100% openā or ā100% closedā?
this is the log I get for closing now

it works for opening and closing, it just doesn't recognise the state it's in
last log 100% was for open
I think I see what's happening, I'm going to rework the functions a bit and send new copies
I didn't make any more material changes to Target Position function. Just the one I sent earlier changing the first line to input = msg.payload.value
For your Curtain Out function, I've learned quite a bit since I wrote the version you used... Your version was overwriting msg.payload instead of using a new object, the check for msg.hap.context that you had is a little unreliable, and it didn't end with a return which isn't awesome. I've updated it with what I now consider best practices - but I reserve the right to change my mind later!
Try these functions (triple click to select all):
[{"id":"1bb3f187.2b54ce","type":"function","z":"15015b6a.6c1025","name":"Target Position","func":"var input = msg.payload.value;\ninput = Number(input);\n\nvar delay = {};\nvar newMsg = {};\n\nif(input < 101){\n newMsg={\n payload: {\n \"TargetPosition\": input\n }\n };\n delay = {\n payload: {\n \"CurrentPosition\": input\n }\n };\n return [newMsg,delay];\n}\n\nreturn;","outputs":2,"noerr":0,"x":520,"y":960,"wires":[[],[]]},{"id":"6c759fd1.4f17a","type":"function","z":"15015b6a.6c1025","name":"Curtain Out","func":"var t = context.get('t')||0;\nvar delay = {};\nvar newMsg = {};\n\nif(msg.payload.TargetPosition !== undefined){\n t = msg.payload.TargetPosition;\n context.set('t',t);\n newMsg = {\n payload: t\n }\n node.send([newMsg,null]);\n}\n\n\nif (msg.hap !== undefined && msg.hap.context !== undefined){\n delay = {\n payload: {\n CurrentPosition: t\n }\n };\n node.send([null,delay]);\n}\n\nreturn;","outputs":2,"noerr":0,"x":810,"y":960,"wires":[[],[]]},{"id":"b80aa4be.c3b0c8","type":"inject","z":"15015b6a.6c1025","name":"","topic":"","payload":"{\"value\":\"0\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":410,"y":900,"wires":[["1bb3f187.2b54ce"]]},{"id":"63fbe092.5d0448","type":"inject","z":"15015b6a.6c1025","name":"","topic":"","payload":"{\"value\":\"100\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":420,"y":840,"wires":[["1bb3f187.2b54ce"]]}]
(Note I'm trying to explain as much as I can, I don't know your level of expertise - let me know if I've left anything out!)
Will try it out this evening. Now off to work š thx
just tried it but same issue, doesn't recognize state :(
are you anything with this, this is the response I get from the mqtt server?


also when changing state of shutter it changes in de debug window but nog the actual state of the openhab-in, don't know if that is supposed to be so?
It seems like there may be several things going on here - the "Window" openhab item has 2 outputs. I think one output sends the messages like you showed yesterday while the other one may just do numeric state of the item.
Do you have more debugs than what are in that screenshot? I.e. are the number items coming from "Target Position" function? If so, homekit won't understand just the numeric values, it needs messages like {"CurrentPosition":65}.
If you can take your whole current flow and copy it again I'll have a look to see if I see anything else
[{"id":"293fb4d.0d8f1cc","type":"tab","label":"window","disabled":false,"info":""},{"id":"320daa8e.7b5226","type":"function","z":"293fb4d.0d8f1cc","name":"Target Position","func":"var input = msg.payload.value;\ninput = Number(input);\nvar delay = {payload:0};\nif(input < 101){\n msg.payload = {\n \"TargetPosition\": input\n };\n delay.payload = {\n \"CurrentPosition\": input\n };\n return [msg,delay];\n}","outputs":2,"noerr":0,"x":220,"y":60,"wires":[["5fe1c5be.2da3a4"],["3794b37e.5f61c4","25a40ce.f2a64f4"]]},{"id":"5fe1c5be.2da3a4","type":"homekit-service","z":"293fb4d.0d8f1cc","isParent":true,"bridge":"4bc87cd0.337f6c","parentService":"","name":"Window","serviceName":"WindowCovering","topic":"","filter":false,"manufacturer":"geani","model":"rolluik","serialNo":"2","cameraConfigVideoProcessor":"","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":"","cameraConfigMaxWidth":"","cameraConfigMaxHeight":"","cameraConfigMaxFPS":"","cameraConfigMaxBitrate":"","cameraConfigVideoCodec":"","cameraConfigAudioCodec":"","cameraConfigAudio":false,"cameraConfigPacketSize":"","cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"","cameraConfigMapAudio":"","cameraConfigVideoFilter":"","cameraConfigAdditionalCommandLine":"","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{\"Brightness\":true}","x":560,"y":60,"wires":[["53512652.d14d88"],[]]},{"id":"3794b37e.5f61c4","type":"delay","z":"293fb4d.0d8f1cc","name":"","pauseType":"delay","timeout":"12","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":380,"y":140,"wires":[["5fe1c5be.2da3a4","b5666486.04e31"]]},{"id":"49e17f83.3e741","type":"openhab2-in","z":"293fb4d.0d8f1cc","name":"Window","controller":"1324a901.5aef0f","itemname":"RolluikVooraan_Rollershutter","x":80,"y":120,"wires":[["320daa8e.7b5226"],["b9996a56.0ebbc8"]]},{"id":"53512652.d14d88","type":"function","z":"293fb4d.0d8f1cc","name":"Curtain Out","func":"var t = context.get('t')||0;\nvar delay = {payload:0}\nif(msg.payload.TargetPosition){\n t = msg.payload.TargetPosition;\n context.set('t',t);\n msg.payload=t\n}\nif(msg.payload.TargetPosition === 0){\n t = msg.payload.TargetPosition;\n context.set('t',t);\n msg.payload=t\n}\nif (msg.hap.context !== undefined){\n delay.payload = {\n \"CurrentPosition\": t\n };\n return [msg,delay]\n}","outputs":2,"noerr":0,"x":710,"y":60,"wires":[["a99a1867.9f4ea"],["b9f9948.6680968"]]},{"id":"471228ad.f257a","type":"link in","z":"293fb4d.0d8f1cc","name":"","links":["b9f9948.6680968"],"x":255,"y":180,"wires":[["3794b37e.5f61c4"]]},{"id":"a99a1867.9f4ea","type":"openhab2-out","z":"293fb4d.0d8f1cc","name":"Window","controller":"1324a901.5aef0f","itemname":"RolluikVooraan_Rollershutter","topic":"ItemCommand","payload":"","x":880,"y":60,"wires":[["a72fd801.1fab5"]]},{"id":"b9f9948.6680968","type":"link out","z":"293fb4d.0d8f1cc","name":"","links":["471228ad.f257a"],"x":855,"y":120,"wires":[]},{"id":"3f718ce3.acc744","type":"inject","z":"293fb4d.0d8f1cc","name":"","topic":"","payload":"{\"TargetPosition\": 0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":340,"wires":[["5fe1c5be.2da3a4"]]},{"id":"5fbcfe45.80989","type":"inject","z":"293fb4d.0d8f1cc","name":"","topic":"","payload":"{\"CurrentPosition\": 0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":400,"wires":[["5fe1c5be.2da3a4"]]},{"id":"b9996a56.0ebbc8","type":"debug","z":"293fb4d.0d8f1cc","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":220,"y":280,"wires":[]},{"id":"25a40ce.f2a64f4","type":"debug","z":"293fb4d.0d8f1cc","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":610,"y":160,"wires":[]},{"id":"58389a6f.f0cecc","type":"inject","z":"293fb4d.0d8f1cc","name":"","topic":"","payload":"{\"TargetPosition\": 100}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":460,"wires":[["5fe1c5be.2da3a4"]]},{"id":"d03a2423.3c4708","type":"inject","z":"293fb4d.0d8f1cc","name":"{\"CurrentPosition\": 100}","topic":"","payload":"{\"CurrentPosition\": 100}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":220,"y":500,"wires":[["5fe1c5be.2da3a4"]]},{"id":"fc49ae32.bc3138","type":"inject","z":"293fb4d.0d8f1cc","name":"both messages open","topic":"","payload":"{\"TargetPosition\": 100,\"CurrentPosition\":100}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":320,"y":560,"wires":[["5fe1c5be.2da3a4"]]},{"id":"a72fd801.1fab5","type":"debug","z":"293fb4d.0d8f1cc","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":910,"y":240,"wires":[]},{"id":"b5666486.04e31","type":"debug","z":"293fb4d.0d8f1cc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":610,"y":300,"wires":[]},{"id":"4bc87cd0.337f6c","type":"homekit-bridge","z":"","bridgeName":"window","pinCode":"111-11-300","port":"","allowInsecureRequest":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":true},{"id":"1324a901.5aef0f","type":"openhab2-controller","z":"","name":"Pi bridge","protocol":"http","host":"192.168.0.13","port":"8080","path":"","username":"","password":""}]
just looked at something: apart from node-red, I took a look at my openhab
my home control is from niko, so when I use the app to control items, like the lightswitch
i see it turn on on openhab, but when I adjust the shutters nothings happens in openhab neither
so guess that's where the problem begins and don't know if there's anything you can do about it, since someone else wrote the binding for this niko home control
That would probably be a question for the Niko binding writers...
As far as your shutter item working (as discussed here) as long as OpenHAB knows the state of the item, homekit should be able to also know the state. I've just installed the openhab binding on my test computer so I can do another round of functions for you... stand by ...
Installing the openhab node was a good choice. I'd recommend using the 2nd output of the openhab node to begin your flow. This should always be an integer value of what % open your window is. The "Target Position" function takes the input payload, checks that it's an integer, and sends it to HomeKit as TargetPosition immediately and as CurrentPosition with a 12 second delay. This is so the Home app will show "opening" and "closing" for 12 seconds. That's how long my window takes to open, yours may be different.
Target Position function:

And coming out of HomeKit the "Curtain Out" function has 2 "if" conditions. The first will check if there is a new TargetPosition message and send it through the delay to update CurrentPosition. The second "if" will return true if the message initiated in the Home app. This is to prevent loops. If the message did come from HomeKit, then it will be sent on to OpenHAB.
Curtain Out function:

What this looks like on my screen - note I can't test the openhab function as I'm not running openhab...

Copyable flow:
[{"id":"1ca0e493.044f2b","type":"function","z":"651246ce.4978f8","name":"Target Position","func":"var input = msg.payload;\n\nvar delay = {payload:0};\n\n// If the message from OpenHAB is an integer, it will pass\n// the value (window % open) to HomeKit as TargetPosition\n// and CurrentPosition but with a 12 second delay \n// the delay is so home app shows \"opening\" or \"closing\"\n\nif(Number.isInteger(input)){\n msg.payload = {\n \"TargetPosition\": input\n };\n delay.payload = {\n \"CurrentPosition\": input\n };\n return [msg,delay];\n}\n\nnode.warn(\"Invalid input\");\n\nreturn;","outputs":2,"noerr":0,"x":280,"y":240,"wires":[["2a2425aa.66061a","6f61ce67.f1e228"],["845d00e0.9bb988"]]},{"id":"2a2425aa.66061a","type":"homekit-service","z":"651246ce.4978f8","isParent":true,"bridge":"ef10f1c8.45a558","parentService":"","name":"Window","serviceName":"WindowCovering","topic":"","filter":false,"manufacturer":"geani","model":"rolluik","serialNo":"2","cameraConfigVideoProcessor":"","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":"","cameraConfigMaxWidth":"","cameraConfigMaxHeight":"","cameraConfigMaxFPS":"","cameraConfigMaxBitrate":"","cameraConfigVideoCodec":"","cameraConfigAudioCodec":"","cameraConfigAudio":false,"cameraConfigPacketSize":"","cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"","cameraConfigMapAudio":"","cameraConfigVideoFilter":"","cameraConfigAdditionalCommandLine":"","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{\"Brightness\":true}","x":620,"y":240,"wires":[["bd86a229.3fe448"],[]]},{"id":"845d00e0.9bb988","type":"delay","z":"651246ce.4978f8","name":"","pauseType":"delay","timeout":"12","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":440,"y":320,"wires":[["2a2425aa.66061a","61ed4c94.be6764"]]},{"id":"7905f74e.0834f","type":"openhab2-in","z":"651246ce.4978f8","name":"Window","controller":"e1d9384.c483848","itemname":"RolluikVooraan_Rollershutter","x":80,"y":240,"wires":[[],["1ca0e493.044f2b","8bdd22b3.c924b"]]},{"id":"bd86a229.3fe448","type":"function","z":"651246ce.4978f8","name":"Curtain Out","func":"var t = context.get('t')||0;\nvar delay = {};\nvar newMsg = {};\n\n// This if statement will pass TargetPosition updates through\n// back to HomeKit as CurrentPosition\n\n// I'm not entirely sure this is necessary.\n\nif(msg.payload.TargetPosition !== undefined){\n t = msg.payload.TargetPosition;\n context.set('t',t);\n delay = {\n payload: {\n CurrentPosition: t\n }\n };\n node.send([null,delay])\n}\n\n// This if statement will send the command to OpenHAB\n// if the command was initiated in the Home app\n// (Loop prevention)\n\nif (msg.hap !== undefined && msg.hap.context !== undefined){\n newMsg = {\n payload: t\n };\n \n node.send([newMsg,null]);\n}\n\nreturn;\n","outputs":2,"noerr":0,"x":790,"y":240,"wires":[["5fcc01c.aa1d48","dd11b81.ba30048"],["484ad263.6e1e0c"]]},{"id":"6ef2191b.53f2a8","type":"link in","z":"651246ce.4978f8","name":"","links":["484ad263.6e1e0c"],"x":315,"y":360,"wires":[["845d00e0.9bb988"]]},{"id":"5fcc01c.aa1d48","type":"openhab2-out","z":"651246ce.4978f8","name":"Window","controller":"e1d9384.c483848","itemname":"RolluikVooraan_Rollershutter","topic":"ItemCommand","payload":"","x":980,"y":240,"wires":[[]]},{"id":"484ad263.6e1e0c","type":"link out","z":"651246ce.4978f8","name":"","links":["6ef2191b.53f2a8"],"x":915,"y":300,"wires":[]},{"id":"3b01bee3.d693da","type":"inject","z":"651246ce.4978f8","name":"","topic":"","payload":"{\"TargetPosition\": 0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":520,"wires":[["2a2425aa.66061a"]]},{"id":"439b1bf0.47662c","type":"inject","z":"651246ce.4978f8","name":"","topic":"","payload":"{\"CurrentPosition\": 0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":240,"y":560,"wires":[["2a2425aa.66061a"]]},{"id":"24863d70.7b8942","type":"inject","z":"651246ce.4978f8","name":"","topic":"","payload":"{\"TargetPosition\": 100}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":240,"y":600,"wires":[["2a2425aa.66061a"]]},{"id":"6c013782.2d55e8","type":"inject","z":"651246ce.4978f8","name":"{\"CurrentPosition\": 100}","topic":"","payload":"{\"CurrentPosition\": 100}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":240,"y":640,"wires":[["2a2425aa.66061a"]]},{"id":"484c744c.7e8e5c","type":"inject","z":"651246ce.4978f8","name":"both messages open","topic":"","payload":"{\"TargetPosition\": 100,\"CurrentPosition\":100}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":240,"y":680,"wires":[["2a2425aa.66061a"]]},{"id":"dd11b81.ba30048","type":"debug","z":"651246ce.4978f8","name":"Send to OpenHAB","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":950,"y":180,"wires":[]},{"id":"61ed4c94.be6764","type":"debug","z":"651246ce.4978f8","name":"CurrentPosition","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":640,"y":320,"wires":[]},{"id":"8bdd22b3.c924b","type":"debug","z":"651246ce.4978f8","name":"Raw item state (integer)","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":170,"y":320,"wires":[]},{"id":"6f61ce67.f1e228","type":"debug","z":"651246ce.4978f8","name":"TargetPosition","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":500,"y":200,"wires":[]},{"id":"ea8b338e.e9156","type":"inject","z":"651246ce.4978f8","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":80,"wires":[["1ca0e493.044f2b"]]},{"id":"d74823b9.b1018","type":"inject","z":"651246ce.4978f8","name":"","topic":"","payload":"10","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":120,"wires":[["1ca0e493.044f2b"]]},{"id":"dd1e595a.6c2d38","type":"inject","z":"651246ce.4978f8","name":"","topic":"","payload":"100","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":160,"wires":[["1ca0e493.044f2b"]]},{"id":"ef10f1c8.45a558","type":"homekit-bridge","z":"","bridgeName":"window","pinCode":"111-11-300","port":"","allowInsecureRequest":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":true},{"id":"e1d9384.c483848","type":"openhab2-controller","z":"","name":"Pi bridge","protocol":"http","host":"192.168.0.13","port":"8080","path":"","username":"","password":""}]
If I understand things correctly, this should be able to control your windows as easily as openhab can. Home app should show the same as openhab, but with a 12 second "opening" or "closing" delay.
Past this, I'm out of ideas. If it still isn't working, let's call out @radokristof who still uses OpenHAB and hangs out around here quite a bit...
still same thing, if I use the buttons on the wall it doesn't change the state on the app :(
will take a look at it tomorrow, early days for me at work .
but I'm glad you help out
if I use the buttons on the wall it doesn't change the state on the app
This part is an openhab issue. If you open/close only with the home app or openhab, do things work better?
The minute I force close the home app the shutters show always as closed. Lights work fine
Will try to contact the creator of the openHAB binding Tomorrow. Hopefully he can be off assistance
I will try to help.
However I must say that I don't have any shutters in openHAB nor in HomeKit yet (because I don't have motorized shutters...).
So in general it seems that state updates are not working, only commands.
I have tried to recap this conversation quickly, but I couldn't find some info (sorry if you have answered is somewhere):
So basically, it seems more of an issue of the binding. If these issues are solved in the binding and your implementation is correct in Node-RED, it will "magically" start to work here also. If not, we can help on these things better.
Figured out if I use the Niko app the shutters not showing correctly in openHAB so wil ask the creator tomorrow if he is aware off.
Iāll get back to you afterwards
When I control them with apple home app they adjust the same in openhab but just in reverse ( up is down and down is up)
But when I control with the niko app nothing changes in openhab
Even with the physical buttons on the walls, openhab nor home app donāt change the values,
Op 11 mei 2020, om 22:31 heeft Kristof Rado notifications@github.com het volgende geschreven:
I will try to help.
However I must say that I don't have any shutters in openHAB nor in HomeKit yet (because I don't have motorized shutters...).
So in general it seems that state updates are not working, only commands.
I have tried to recap this conversation quickly, but I couldn't find some info (sorry if you have answered is somewhere):What openHAB version do you use? openhab2 2.5.4-1
What NRCHKB version do you have? 1.0.4
Which openhab node do you use in Node-RED? node-red-contrib-openhab2. 1.1.7
These questions usually does not help in any way, but I might understand some problem, which existed in either of the services before.
So commands in general works? You can toggle the blinds and it will go up and down, both from openHAB and HomeKit, right?
If I'm correct, state updates does not work reliably in openHAB as well? Does openHAB always shows the correct state if you toggle them via the physical switch or the official Niko app?
If not, this is the problem which must be solved first.So basically, it seems more of an issue of the binding. If these issues are solved in the binding and your implementation is correct in Node-RED, it will "magically" start to work here also. If not, we can help on these things better.
ā
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/NRCHKB/node-red-contrib-homekit-bridged/issues/253#issuecomment-626944785, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJCPTIO6Y5CYXY2SZGKG5TRRBODXANCNFSM4M5LHCBA.
so contacted mark for the issues with the shutters, sent him some debug logs and he adjusted his binding in openhab, so now everything works like a charm ;)
and its even with you're first example of the shutter @crxporter ;) the rest doesn't do what expected.
afterall I'm a happy person :) thanks for all the help.
ps @crxporter could you help me with the shutters for closing and opening, that 75% is 3/4 open for the shutter, because now he counts the seconds and its not corresponding with the shutter.
you can always e-mail me ( [email protected]) to ask me for logs or something if you can help
@geani I'm glad you've got things working pretty well. I'm sure I made an error or two in the later examples, I couldn't actually test those against openhab... Glad my old post on the openhab forums is still pretty good.
I'm not sure what you're looking for with counting the seconds, the timer node in node-red should be adjusted to your shutters. If you can elaborate maybe I (or someone else) can give an idea how to make adjustments.
Probably would be good to explain where you're at, what you see, and what you expect. Thanks!
so my shutter in the kitchen is about 1 m high, if I ask the home app to put it at 50% it closes almost completely because it's not a very high shutter.
I need something to configure so it knows if the shutter closes completely in 10 seconds that it will be at 50% after 5 seconds
I completely gave up for mine to be anything except full open / full closed. My motor is 2 speeds so it runs slow then fast, thereās almost no consistent way to open partially.
That being said- in your case this seems like this would need to be handled in openhab since homekit is simply sending commands through openhab... the timer node has nothing to do with openhab, node red only sends a numerical state command.
Perhaps thereās an option in the binding to help track how much open/closed your shades are... or a way to configure how long each motor needs to run for each window so that it can track properly?
Iām guessing you donāt have stepper motors to track how many rotations each window needs. Thatās about the only other way I could see it working.
when I installed my niko installation I had to configure there the exact milliseconds the shutter rolled, so guess openhab should know that to, will try and talk to mark again if maybe he see's some clarity in this.
if this works then system is 100 % finished I guess :)
Good luck!
Best way to think of the homekit stuff is itās just another user interface.
If homekit shows the same wrong information as openhab, you have an issue with openhab.
If homekit shows different from openhab, we are happy to help make adjustments.
Thanks
@geani can it be closed?
yes