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

Need help converting VD to QA


Question

Posted

Hello

 

I need help to convert two VD´s that I had working on my HC2 but can´t solve the conversion to HC3 QA.

 

1:

Please login or register to see this code.

 

2:

Please login or register to see this code.

 

8 answers to this question

Recommended Posts

  • 0
Posted
1 hour ago, storskogen said:

Hello

I need help to convert two VD´s that I had working on my HC2 but can´t solve the conversion to HC3 QA.

 

Here is an example of the first one. It does not update the fibaro global 'doorbell'. Instead it is a device (QA) of type com.fibaro.binarySensor that is true when the axis is active and false when not.

It means that you can use the device as a trigger in a block scene or query it with fibaro.getValue(<id>,"value"). So, you could create a block scene that sets the doorbell global when the camera changes state. 

You can of course modify it to also set the global. The second VD->QA would have a similar structure.

Please login or register to see this attachment.

Please login or register to see this code.

 

  • 0
  • Inquirer
  • Posted
    On 10/24/2020 at 4:38 PM, jgab said:

     

    Here is an example of the first one. It does not update the fibaro global 'doorbell'. Instead it is a device (QA) of type com.fibaro.binarySensor that is true when the axis is active and false when not.

    It means that you can use the device as a trigger in a block scene or query it with fibaro.getValue(<id>,"value"). So, you could create a block scene that sets the doorbell global when the camera changes state. 

    You can of course modify it to also set the global. The second VD->QA would have a similar structure.

    Please login or register to see this attachment.

    Please login or register to see this code.

     

     

    On 10/24/2020 at 4:38 PM, jgab said:

     

    Here is an example of the first one. It does not update the fibaro global 'doorbell'. Instead it is a device (QA) of type com.fibaro.binarySensor that is true when the axis is active and false when not.

    It means that you can use the device as a trigger in a block scene or query it with fibaro.getValue(<id>,"value"). So, you could create a block scene that sets the doorbell global when the camera changes state. 

    You can of course modify it to also set the global. The second VD->QA would have a similar structure.

    Please login or register to see this attachment.

    Please login or register to see this code.

     

    Thank you!

    I added the IP address to line 16 but doesn´t seem to get any response on my scene?

    Please login or register to see this code.

    The response from the camera when using http://192.168.1.37/axis-cgi/io/port.cgi?checkactive=1 in Chrome is

    Please login or register to see this code.

    OR

    Please login or register to see this code.

     

    • 0
    Posted
    3 hours ago, storskogen said:

     

    Thank you!

    I added the IP address to line 16 but doesn´t seem to get any response on my scene?

    Please login or register to see this code.

    The response from the camera when using http://192.168.1.37/axis-cgi/io/port.cgi?checkactive=1 in Chrome is

    Please login or register to see this code.

    OR

    Please login or register to see this code.

     

    scene... but you wanted a QA?

    If you add a log message to the success handler - do you get any log messages from the QA? (I also added some time to the polling so that the log isn't flooded with messages...

    Please login or register to see this code.

    • 0
  • Inquirer
  • Posted

    Sorry for late response, I haven´t had time to do any testing since your last post.

     

    I used the QA in a Scene to turn on a light when "motion" is sensed on the QA but the QA never change status

     

    I used this code that runs but no change on the icon for the QA when i change the config of Axis input (I can see the change if I browse to the address.).

    I don´t understand where in the code the response is compared to port1=inactive or port1=active? I tried to change match("active") to inactive but not change on the icon?

    Please login or register to see this code.

    I get this in the log, nothing else:

    [03.11.2020] [21:20:48] [DEBUG] [QUICKAPP179]: HWSResponse 179[03.11.2020] [21:20:48] [DEBUG] [QUICKAPP179]: HWSResponse 179

     

    I also tested the alternative code but there are some errors so it won´t run. Seems that there is a some ")" missing?

    • 0
  • Inquirer
  • Posted (edited)

    Sorry, I must be tired. The compare-line is:  self:updateProperty("value"not(resp.data:match("inactive")~=nil)) right?

    After a little more testing I found that the response is 200 and changed the code to this and now I get status updates but the it changes status even if the input doesn´t change ?

    EDIT: It seems like the camera has a hard time to respond to my QA and stream the picture to the recorded at the same time...

    Please login or register to see this code.

     

    Edited by storskogen
    More info
    • 0
    Posted
    19 hours ago, storskogen said:

    Sorry, I must be tired. The compare-line is:  self:updateProperty("value"not(resp.data:match("inactive")~=nil)) right?

    After a little more testing I found that the response is 200 and changed the code to this and now I get status updates but the it changes status even if the input doesn´t change ?

    EDIT: It seems like the camera has a hard time to respond to my QA and stream the picture to the recorded at the same time...

    Please login or register to see this code.

     

     

    You could try to increase the INTERVAL to 1000.

    Have you made the QA a com.fibaro.binarySensor ?

    • 0
  • Inquirer
  • Posted
    On 11/4/2020 at 5:51 PM, jgab said:

     

    You could try to increase the INTERVAL to 1000.

    Have you made the QA a com.fibaro.binarySensor ?

    Yes, I even tried 2000 as interval but it still didn't work.

    But im sure it has to do with the camera, or network, is the problem. When the QA can't connect to the camera it goes "alarm".

    It will try to use local recording and local motion detection instead of my Milestone server.

     

    One way to get an alert when someone push the doorbell (the input in my camera) is to have the camera send an email when the input changes.

    • 0
    Posted

    Revisiting the code there are some bugs related to setTimeout and setInterval

    Change to

    Please login or register to see this code.

    The bug causes unnecessary calls to the camera and can have caused delays...

    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.

    ×
    ×
    • Create New...