Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

Converting a VD to QA, get stuck


jwi
 Share

Question

Now that I have adapted half of my scenes to the HC3, I wanted to try that with a VD.
But I totally fail.
It would be nice if someone could help me there.
This VD is very important for me because it reads the LUX value from a non-zwave sensor and writes it in a global variable.
Thank you everyone for the great support here.

Please login or register to see this attachment.

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Hey!

 

It's not a solution, but maybe it's a start!

 

Since you adapted Lua scenes from HC2 to HC3 I assume you know Lua. The missing piece here is the Quick App knowledge.

 

Here is a great article about Quick Apps in Home Center 3:

Please login or register to see this link.

 

Since you probably check your non-zwave device in the Main loop you look for a replacement of that mechanism. I think this is what you're looking for:

Please login or register to see this attachment.

Link to comment
Share on other sites

  • 0
1 hour ago, jwi said:

Now that I have adapted half of my scenes to the HC3, I wanted to try that with a VD.
But I totally fail.
It would be nice if someone could help me there.
This VD is very important for me because it reads the LUX value from a non-zwave sensor and writes it in a global variable.
Thank you everyone for the great support here.

Please login or register to see this attachment.

This is a start

Please login or register to see this attachment.

You need to set the QA variables

user e.g.  user name
password e.g. password
deviceID e.g. 12
IPAddress e.g. ip address
TCPPort e.g port
 
The idea here is that the QA becomes the Lux sensor so it doesn't store the value in a global variable. Instead it sets its value property to the lux value.
That way you can trigger scenes on the value changing or calling fibaro.getValue(id,"value") to retrieve the value.
...and the icon in the GUI shows the lux value.
 
There may be some issue with parsing the lux value retrieved from the http request. Please review it and change accordingly.
 
 
  • Thanks 1
Link to comment
Share on other sites

  • 0
  • Inquirer
  • Hi @jgabThank you very much for your help. I'm currently trying to understand the QuickApps

    but the possibilities are many.
    I think I understood the principle of this QickApp, but I still can't find the error. I created all the variables.
    Error is: line: 31 attempt to index a nil value (global 'self')
    The line reads: self: trace ("Read:", json.encode (res))
    If I comment out the line and insert a print (data) under line 32, the output comes from the server as expected.

    Please login or register to see this code.

    Can you please have a look at it.
    Thank you very much.

    Link to comment
    Share on other sites

    • 0

    My error. change

    Please login or register to see this code.

    to

    Please login or register to see this code.

    I store the "self" variable of the QuickApp in the local variables QA so we can use all the functions defined on self:*, like self:trace etc from functions that don't belong to the class Quickapp:* ...

    I.e.  the self we have in

    Please login or register to see this code.

    'self' is a variable with all the functions belonging to the class QuickApp. We just save it away to a local variable 'QA' so we can use it in "regular" function.

    So, the QA:trace logs the result from the http request. Can you post that? I think we can get rid of the string.sub etc functions.

     
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 1 hour ago, jgab said:

    So, the QA:trace logs the result from the http request. Can you post that? I think we can get rid of the string.sub etc functions.

     

    Hi @jgab

    Yes that was it. But still seems to be a problem everywhere. Here is the output:

    Please login or register to see this code.

     

     
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi@jgabjust saw that the output is different:

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

     Share

    ×
    ×
    • Create New...