PLCHome / velux-klf200-api

Provide node to Veluxl® KLF-200 io-homecontrol® Gateway API
42 stars 7 forks source link

send an non documented API call #13

Closed s0nik42 closed 2 years ago

s0nik42 commented 2 years ago

Hi,

I would like to verify if the following call stated in the previous documentation and lately removed has really been removed or just undocumented : GW_SET_NODE_VELOCITY_REQ

Is there a simple way to check that with all the great work you have done ?

PLCHome commented 2 years ago

The documentation says:

3.17 GW_SET_NODE_VELOCITY_REQ/CFM command set removed from Appendix 3: List of Gateway commands. AliasArray size is corrected for GW_GET_NODE_INFORMATION_NTF and GW_GET_ALL_NODES_INFORMATION_NTF. AHM 05-11-2018

Since Velux does not seem to have a developer who can correct the API, velux removes the entries that do not work. I think the function doesn't work.

But it's easy to add in lib/klf.js: You need to know the hex number of the command and add an entry in const API json. Then add an function like:

/*
    Command                  |Data 
    GW_SET_NODE_VELOCITY_REQ|what
    -in
    json data
    {
      ????
    }
    - out
    buffer
  */
  GW_SET_NODE_VELOCITY_REQ:  function (data) {
    var buf = new Buffer(13)
    //write something in Buffer

    return buf
  },

That's it

s0nik42 commented 2 years ago

Well seems like you were right, I was not expecting much, but still worth trying.

{
  id: 0,
  api: 0,
  apiText: 'GW_ERROR_NTF',
  errorNumber: 1,
  error: 'Unknown Command or command is not accepted at this state.'
}
Error: timeout GW_SET_NODE_VELOCITY_CFM
    at Object.<anonymous> (/home/s0nik42/dev/test/velux-klf200-api/lib/net.js:190:19)
    at listOnTimeout (internal/timers.js:554:17)
    at processTimers (internal/timers.js:497:7)

So the only solution that we have to control the blind speed, is to create 2 scenes for each blind one at 0 and one at 100 :/ That's really not optimal, but I guess that the only way to do :( especially that doing so, we are loosing the ability to manage the position...

PLCHome commented 2 years ago

It should also go through groups. Check if the KLF has defined groups for you. I have one for each shutter, possibly through the relay assignment.

s0nik42 commented 2 years ago

So I tried to create groups from API but I get timeout.

I also tried to get the full list of created groups seems like, I've got 5 groups created, but I don't receive any NTF for them, just the FINISH one :/ :


'use strict'
const velux = require('./velux-klf200-api')

velux.on('NTF',(data)=>{
  console.log(data)
})

velux.connect('192.168.XX.XX',{})
.then(()=>{
  return velux.login('XXX')
})
.then((data)=>{
  return velux.sendCommand({ api: velux.API.GW_GET_ALL_GROUPS_INFORMATION_REQ,
          useFilter: 0,
          groupType: 0
}) })
.then((data)=>{
  console.log(data)
})
.catch((err)=>{
  console.log(err)
  return velux.end()
})

RESULTS

{
  id: 0,
  api: 554,
  apiText: 'GW_GET_ALL_GROUPS_INFORMATION_CFM',
  status: 0,
  statusText: 'OK - Request accepted',
  totalNumberOfGroups: 5
}
{
  id: 0,
  api: 556,
  apiText: 'GW_GET_ALL_GROUPS_INFORMATION_FINISHED_NTF'
}
s0nik42 commented 2 years ago

Do you see the same behavior on your side ?

PLCHome commented 2 years ago

Unfortunately, I no longer use this implementation.

The problem is that the KLF only allows two connections and does not always release the connection when the home monitor is switched on. As a result, it can happen that I could no longer access it. I am currently using the ioBroker adapter for the KLF. I was looking for a conbutor who would like to continue the project. As a result, many have reported to host, but I can also do that myself.

s0nik42 commented 2 years ago

Open source project is hard, I face the same on my project :(

Good luck and thank you for the job you have done