Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rain state #12

Closed
pergolafabio opened this issue Jun 11, 2021 · 24 comments
Closed

rain state #12

pergolafabio opened this issue Jun 11, 2021 · 24 comments

Comments

@pergolafabio
Copy link

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
Copy link
Owner

PLCHome commented Jun 11, 2021

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

@pergolafabio
Copy link
Author

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
Copy link
Owner

PLCHome commented Jun 11, 2021

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

@pergolafabio
Copy link
Author

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
Copy link
Owner

PLCHome commented Jun 11, 2021

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
Copy link
Author

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
Copy link
Author

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
Copy link
Owner

PLCHome commented Jun 11, 2021

I dont know.

@pergolafabio
Copy link
Author

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
Copy link

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

@pergolafabio
Copy link
Author

pergolafabio commented Jul 3, 2021

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

@bergstermann
Copy link

I´m using it in node red.

@pergolafabio
Copy link
Author

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

@bergstermann
Copy link

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

PLCHome added a commit that referenced this issue Jul 3, 2021
@PLCHome
Copy link
Owner

PLCHome commented Jul 3, 2021

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

Fixed

@pergolafabio
Copy link
Author

Ok, thnx for this, gonna try this later

@pergolafabio
Copy link
Author

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
Copy link

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

@pergolafabio
Copy link
Author

Cool, do you also use Home Assistant?

@bergstermann
Copy link

No Redmatic on Homematic CCU3

@pergolafabio
Copy link
Author

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
Copy link

Yes, 7% ist the ventilation mode. LimitationType 0

@pergolafabio
Copy link
Author

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

@pergolafabio
Copy link
Author

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

@PLCHome PLCHome closed this as completed Feb 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants