PLCHome / node-red-contrib-velux

Provides nodes to talk to Velux® KLF-200 io-homecontrol® Gateway
9 stars 2 forks source link

Velux API Node does not work #20

Closed ckohrt closed 2 years ago

ckohrt commented 2 years ago

Hi, good work!!!

I have the problem, that with the current softwae version running within a docker container the API Node cannot be used because the API cannot be chosen. This issue is already discussed in #11, but the solution doesnot work for me. I restarted Node-Red, pressed Ctrl-F5 and so on. Of course the Velux Node works expected, therefore also the configuration node should be ok. This is the connection node, right? Maybe it has something to do with the fact that I do not run it on redmatic? I could try to change the html code as described in #11 but I am not sure if this issue should also exist for other users.

What I try to reach is a reboot of the gateway every night in order to use this as workaround for connection issue (max two connections, where the KLF200 does not close connections correctly and thus no more connections possible).

I just removed the monitor, maybe then - as I have read- the connection losses should not happen....

Edit: Ok, I have two buttons and found a way to have the same interaction as with Homematic shutter (e.g. short click move up, short click during movement stops the shutter). But when I disable the monitor I can't get the movement information, thus, my implementation in Node-Red does not work. See also #18...

Thanks, Christian

ckohrt commented 2 years ago

I use a switchable plug to force restart of the KLF200. This is a workaround and it would be nice if somebodey could help me find out why the API Node does not work....

PLCHome commented 2 years ago

It is normal with this module that the two possible connections are occupied. Have you ever tried starting the KLF200 with an event via the API at night? And you can only have one access, by the way, otherwise the two connections are gone too quickly. Node likes to create a second connection when copying

ckohrt commented 2 years ago

Hm... my first post described that I tried to use the API Node but it didn't work ("...the API Node cannot be used because the API cannot be chosen..."). Solution in #11 didn't work for me (reload etc. - the API cannot be chosen also after reloading the web page). Therefore I switched to the "hard" method, just keeping my wife happy.

PLCHome commented 2 years ago

You can use F12 in your browser to view the network communication between nodered and the browser. Something has to be different than with a normal nodered. I am interested in why the combo boxes cannot be filled. Apparently the URL for /velux/req and /velux/ntf is wrong for you. This put nodered on whatever is seemingly not true.

ckohrt commented 2 years ago

Did it...

I tracked it down to:

oneditprepare: function() {
          var node = this;
          $.get( '/velux/req')
          .done( function(data) {
            var api = JSON.parse(data);
            api.forEach(function(api){
              $('#node-input-api').append("<option value='"+api.id+"'>"+api.name+"</option>");
            })
            $("#node-input-api").val(node.api); 
          })
          $.get( '/velux/ntf')
          .done( function(data) {
            var api = JSON.parse(data);
            api.forEach(function(api){
              $('#node-input-ntf').append("<option value='"+api.id+"'>"+api.name+"</option>");
            })
            $('#node-input-ntf').val(node.ntf);
          })
          //$('#node-input-ntf option').filter(function() {
           // return (node.ntf||[]).indexOf($(this).val()) > -1; //Options text exists in array
          //((}).prop('selected', true);
          //$.each(this.ntf, function(i,v){
          //  $("#node-input-ntf option[value='" + v + "']").prop("selected", true);
          //});
        },

Indeed it is /velux/req

I am running node-red inside a docker container. Might this be a problem?

I could do a fresh installation with the official node-red container again, shouldn't be much work so I'll give it a try..

BR

ckohrt commented 2 years ago

Ok, I created a new container, placed the Velux API Node in it and voilà it worked.... so I am looking for my issue on my side.... and will report it here.

ckohrt commented 2 years ago

Found out that node-red version 2.1.4 didn't work. I have updated to version 2.2.2 now and with it I have no problems.. Thanks!

Update: I have just seen that docker-compose didn't take the new node-red image but it worked... so the issue may have been either

  1. a complete restart (what I have done before multiple times) OR
  2. resetting the password of the Velux Konfiguration node. But I am "sure" that the password was set correctly before... OR
  3. I have removed one Velux node (max 2 connection issue).

Sorry for not finding the reason why it works now.