PLCHome / velux-klf200-api

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

rain state #12

Closed pergolafabio closed 2 years ago

pergolafabio commented 3 years ago

Hi @PLCHome

can you help me out with a sample script to retrieve the rain sensor state? it should be available in the

image Seems if the Minvalue !=0 , then its raining

thnx , appreciated!!

PLCHome commented 3 years ago

Sorry, I don't have a rain sensor. Therefore I do not know how this is queried.

pergolafabio commented 3 years ago

np, i can try out , but i think i need to send this command? GW_GET_LIMITATION_STATUS_REQ

tried script below, but it gives an error

any idea? not sure how i need to send that command, quite new to this ...

image

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

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

velux.connect('192.168.0.18',{})
.then(()=>{
  return velux.login('xxx')
})
.then((data)=>{
  return velux.sendCommand({ api: velux.API.GW_GET_LIMITATION_STATUS_REQ  })
})
.then((data)=>{
  console.log(data)
})
.catch((err)=>{
  console.log(err)
  return velux.end()
})
PLCHome commented 3 years ago

To query the position of a window, the home monitor must be started. Maybe that's the problem here too.

pergolafabio commented 3 years ago

the home monitor is started,if i send other commands like this : GW_GET_VERSION_REQ , i get valid output its because i am also running Home Assistant, that enables the home monitor

i am just not sure how to send those limitation commands

PLCHome commented 3 years ago

GW_GET_LIMITATION_STATUS_REQ has parameter, the call is: return velux.sendCommand({ api: velux.API.GW_GET_LIMITATION_STATUS_REQ , commandOriginator: [int], priorityLevel: [int], indexArrayCount: [int], indexArray: [array of int], parameterID: [int], limitationType: [int] }

pergolafabio commented 3 years ago

was trying this command :

return velux.sendCommand({ api: velux.API.GW_GET_LIMITATION_STATUS_REQ , commandOriginator: 1, priorityLevel: 2, indexArrayCount: 1, indexArray: 1, parameterID: 0, limitationType: 0 })

but gives me : image

any idea? probably something wrong with the command array maybe? sorry , quite new to this

pergolafabio commented 3 years ago

also, if i look in manual, you are talking about a commandoriginator and prioritylevel? i dont see that? is it possible that your parameters were wrong?

image

PLCHome commented 3 years ago

I dont know.

pergolafabio commented 3 years ago

ok, last question then

how do i need to write this?

indexArrayCount: [int], indexArray: [array of int],

for example :

indexArrayCount: 2, indexArray: [1,2]

is that a valid syntax?

bergstermann commented 3 years ago

There is an issue in the file klf.js: In line 2002 "27" have to replace with "25"

pergolafabio commented 3 years ago

@bergstermann Ah, do you have it working? Can you show your code?

bergstermann commented 3 years ago

I´m using it in node red.

pergolafabio commented 3 years ago

But you have to send the command right? How is your command?

bergstermann commented 3 years ago

The parameter in node red: {"sessionID":1,"indexArrayCount":1,"indexArray":[0],"parameterID":0,"limitationType":1}

PLCHome commented 3 years ago

There is an issue in the file klf.js: In line 2002 "27" have to replace with "25"

Fixed

pergolafabio commented 3 years ago

Ok, thnx for this, gonna try this later

pergolafabio commented 3 years ago

Hey @bergstermann , i was not able to test yet... Have you been able too? What are the values when it's raining/ not raining? Did it also update when the windows was in a closed state?

bergstermann commented 3 years ago

It works. 7 percent ist the limitation of window opening by rain. When the window is closed, the limitation is also sent.

pergolafabio commented 3 years ago

Cool, do you also use Home Assistant?

bergstermann commented 3 years ago

No Redmatic on Homematic CCU3

pergolafabio commented 3 years ago

Is 7, is that the value of the ventilation mode? So it only opens to 7% ?

In my case , when it's raining and the windows are closed, then I can't open them, also not in ventilation mode

Do you read out the minvalue ?

bergstermann commented 3 years ago

Yes, 7% ist the ventilation mode. LimitationType 0

pergolafabio commented 3 years ago

And what is the limitationtype when it's raining? I have heard , if it's NOT 0 , then it means it's raining

pergolafabio commented 3 years ago

i have found another github, with python programming, so i am using that one now :)