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

QA design - event publish - push or pull


gurpal2000

Question

Working on my first QA design and would like to see what approach has been taken for a scenario.

 

I already have an existing framework where an IP camera will happily publish a http event when motion detected. At that point I can create scenes etc.

I am in control of the framework code so can make that payload look like whatever I want. What can't change is the push style event.

 

Approaches:

1. create a http server inside a QA myself and take it from there (push)

2. re-use something that HC3 already provides out of the box (eg. API)? (push)

3. get the QA to listen (subscribe) to a broker (say mqtt) and simply get my framework to put events there (pub/sub)

4. get QA to poll the framework. bad. (pull)

 

I'm leaning towards (3) but (1) would have less moving parts. Option (2) would be even better - is there a way to push events from outside the box...?

 

(On other automation system, there was a concept of virtual devices that did just this, but I guess in our world that's what QAs are for)

 

thanks

Edited by gurpal2000
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0
  • Inquirer
  • Looks like I may be overthinking this a bit. I managed to find the API which could trigger a Scene (option 2). That would work!

    Edited by gurpal2000
    Link to comment
    Share on other sites

    • 0
    7 hours ago, gurpal2000 said:

    Working on my first QA design and would like to see what approach has been taken for a scenario.

     

    I already have an existing framework where an IP camera will happily publish a http event when motion detected. At that point I can create scenes etc.

    I am in control of the framework code so can make that payload look like whatever I want. What can't change is the push style event.

    Is it a HTTP POST command?

    If you have complete freedom to make the url look what you want? can you add headers? then I would post a "/devices/<id>/action/<name>" with the payload structured as the argument. Then it will invoke your  QuickApp:<name>(arg) function...

    You may need to add Authorisation and X-Fibaro-Version headers.

     

     

    7 hours ago, gurpal2000 said:

     

    Approaches:

    1. create a http server inside a QA myself and take it from there (push)

    It's not possible to open server sockets and listen to them from QAs... Closest is tcp-socket or web socket for 2-way communication but the connection needs to be initiated from the QA...

     

    7 hours ago, gurpal2000 said:

    2. re-use something that HC3 already provides out of the box (eg. API)? (push)

    Yes, like the above if possible.

     

    7 hours ago, gurpal2000 said:

    3. get the QA to listen (subscribe) to a broker (say mqtt) and simply get my framework to put events there (pub/sub)

    Would work but you need an extra part as you say....

    7 hours ago, gurpal2000 said:

    4. get QA to poll the framework. bad. (pull)

    It kind of depends how often you need to poll - once every second could work.

     

    • Like 1
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • @jgab thanks for your insight! i am happy that i am on the right track so far.

    WIll have a look at your API suggestion, yes, i can add headers and other things. FYI - it's Blue Iris already doing what I need (send stuff to Telegram) but i need to activate some lights and other things. For now, I'd rather let Blue Iris carry on (I know we can add IP Cams to HC3 too, but will try that at a later time).

    Edited by gurpal2000
    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.

    ×
    ×
    • Create New...