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


HC3 QuickApps coding - tips and tricks


jgab

Recommended Posts

2 hours ago, jgab said:

The "interesting" feature is that the file formats for the files are "flat" - meaning that they can be downloaded and run in the offline IDE - no encoded json format.

Hehehe... For HC2 I wrote a "de-VFIB-rilator", it "flattens" a bit like unzip, but I never finished it due to me not spending much time with VDs. For FQA, I was thinking about JSON to YAML conversion, that would play nice (or nicer) with diff tools. Do you have a tool too flatten/deflatten FQA?

Link to comment
Share on other sites

  • Topic Author
  • 2 minutes ago, petergebruers said:

    Hehehe... For HC2 I wrote a "de-VFIB-rilator", it "flattens" a bit like unzip, but I never finished it due to me not spending much time with VDs. For FQA, I was thinking about JSON to YAML conversion, that would play nice (or nicer) with diff tools. Do you have a tool too flatten/deflatten FQA?

     

    No I don't have any tool, as I code directly in my "flat format" :-) 

    json is pretty ok as there is json.decode readily available on the HC3.

    The thing is that I want a file that looks like a Lua file so it fits in my workflow. I can run and debug the QuickApp offline and when finished push it to my repository and download it to the HC3.

    The offline environment (fibaroapiHC3.lua) can also on the fly create a proxy using the info in the file (header comments with type and UI definition)  and install it on the HC3 so I can debug interactions with buttons and fibaro.call methods.

     

    It's pretty smooth now and far from trying to develop on the HC3 alone .... ;-) 

    Link to comment
    Share on other sites

    Have tried to find away to get response from QuickApp in scene without success.

    Is anyone knows if there is away to access QuickApp variables from scene or to get any response? Without using system's global variable.

    Nothing found useful in documents

    Edited by cag014
    Link to comment
    Share on other sites

  • Topic Author
  • 24 minutes ago, cag014 said:

    Have tried to find away to get response from QuickApp in scene without success.

    Is anyone knows if there is away to access QuickApp variables from scene or to get any response? Without using system's global variable.

    Nothing found useful in documents

    api.get("/devices/"..id).properties.quickAppVariables

     

    In general it would be nice if the call fibaro.getValue(deviceID,<property>) would call the function QuickApp:getValue(<property>) .... end

    and a value could be returned...

    Link to comment
    Share on other sites

    6 minutes ago, jgab said:

    api.get("/devices/"..id).properties.quickAppVariables

    I know, but it force you to deal with jSON that includes all global variables... I thought finally fibaro did something that we can receive value and not a table.

    Edited by cag014
    Link to comment
    Share on other sites

    Here is my small contribution (compered to @jgab efforts and tremendous output)

    Attached QuickApp as a template for HTTP GET requests.

    For use in scene use follow

    Please login or register to see this code.

    Currently no response received. To get response, please define global variable and read it in your scene.

    Addition features:

    1. by pressing "Test HTTP" button you should receive HC3 service status

    2. by clicking on QD icon (like turn ON/OFF) you should receive HC3 LEDs status.

    3. Any above action will set icon to "ON" state during HTTP execution and back to "OFF" after...

     

    Since icons are not transferred here custom icons for QuickApp

    Please login or register to see this image.

    /monthly_2020_02/router_off.png.5dc06b168945350cc1984e072ca5dc51.png" />router_on.png.a50a064e4e884bd62092629e9f2fb1fe.png

     

    Currently QuickApp label is not resizable.  Should be fixed in next release

     

     

     

    Please login or register to see this attachment.

    Edited by cag014
    Link to comment
    Share on other sites

    Fibaro must to give back HTTP ability to scenes... now I have scenes in my device list... this is an absurd.

    Another disturbing issue, by creating QuickApp device you cannot press buttons in block scenes (on/off/toggle only). This is outrages....Same true for sliders.

    Now all users with no Lua knowledge, needs to learn it just to have an option to activate buttons.... very bad business wise decision.

    Edited by cag014
    Link to comment
    Share on other sites

  • Topic Author
  • 16 hours ago, cag014 said:

    Fibaro must to give back HTTP ability to scenes... now I have scenes in my device list... this is an absurd.

    Another disturbing issue, by creating QuickApp device you cannot press buttons in block scenes (on/off/toggle only). This is outrages....Same true for sliders.

    Now all users with no Lua knowledge, needs to learn it just to have an option to activate buttons.... very bad business wise decision.

    Here is a replacement.

    Make a QuickApp:

    Please login or register to see this code.

    and then from a scene (assume the previous QuickApp has deviceID 51)

    Please login or register to see this code.

     

    Maybe time to do a compatibility library for old scenes? :-) 

    • Like 1
    Link to comment
    Share on other sites

    What Fibaro didn't implement is forcing the users to reinvent the wheel.

    Thanks to @jgab and his ingenious solutions we are able to move a bit with HC3. Otherwise we woul'd suffer under the following algorithm:

     

    Please login or register to see this code.

    In fact, it's not funny at all

    • Like 2
    Link to comment
    Share on other sites

    34 minutes ago, jgab said:

    Maybe time to do a compatibility library for old scenes? :-) 

     

    please don't … i think it might be better idea to rethink how the old scenes has been used and how HC3 can be used to do the Job better.

    • Like 1
    Link to comment
    Share on other sites

    1 hour ago, jgab said:

    Maybe time to do a compatibility library for old scenes? :-) 

    As I said several time, everything could has an workaround even entire HC3 could have an workaround by other brand...?

    Edited by cag014
    Link to comment
    Share on other sites

    Jan,

    Slendid idea! I will be happy with a kind of translation HC2>>HC3.

    Laters we can smouth it out a bit but as far as I see what you are doing the smotth is already in!

    Its a pitty Fibaro didt hire you for a few months to make the HC3 more users friendly (and easier)

    Your service is excellence!!

    Perhaps some Fibaro developpers should read the forum.

    Thanks Jan

    //Sjakie 

    Link to comment
    Share on other sites

    @jgab

    Any workaround for pressing buttons and slider to support block scene? Regular users  have been abandoned.

    Currently I need your advise on how to write a scene to support fibaro key fob (CentralSceneEvent) .

    Since fibaro:getSourceTrigger() not supported in HC3 it looks like for each combination of keyId and attribute you need to write a scene !!?? This is an absurd.

    Any idea?

    I don't have Fibaro key fob, so don't have a clue if last action could be retrieved from property by api.get()

    Edited by cag014
    Link to comment
    Share on other sites

    44 minutes ago, tinman said:

    just wait till new fw

    Are you sure they will give back this function?

    May HTTP also... keep my finger crossed

    Link to comment
    Share on other sites

    2 hours ago, tinman said:

     

    please don't … i think it might be better idea to rethink how the old scenes has been used and how HC3 can be used to do the Job better.

    On second thought you're absolutely correct.

    ?

    Link to comment
    Share on other sites

  • Topic Author
  • 9 minutes ago, cag014 said:

    Are you sure they will give back this function?

    May HTTP also... keep my finger crossed

    sourceTrigger seems to be a variable in the next release - it's documented in the Lua scene docs for the HC3.

    With this condition (that matches all keypresses from key fob 53)

    Please login or register to see this code.

    Below works for me to pick up a keyfob event in a future compatible way in a scene

    Please login or register to see this code.

     

     

    Edited by jgab
    Link to comment
    Share on other sites

    2 minutes ago, jgab said:

    Below works for me to pick up a keyfob event in a future compatible way in a scene

    No, This is a guessing when it happened. You need exact number of last refreshStates otherwise  It could be an old event or few events could be in same refreshState.

     

     

    Link to comment
    Share on other sites

  • Topic Author
  • 1 minute ago, cag014 said:

    No, This is a guessing when it happened. You need exact number of last refreshStates otherwise  It could be an old event or few events could be in same refreshState.

    What is an old event? If the scene has a CentralSceneEvent trigger it will eat all centralscene events....

    I never managed to get more that one centralsceneevent in the refreshState, no matter how fast I press a button... but hey, it just a hack waiting for the real sourceTrigger to arrive.

    Link to comment
    Share on other sites

    30 minutes ago, jgab said:

    What is an old event? If the scene has a CentralSceneEvent trigger it will eat all centralscene events....

    I never managed to get more that one centralsceneevent in the refreshState, no matter how fast I press a button... but hey, it just a hack waiting for the real sourceTrigger to arrive.

    I'm curious how do you use refreshState?

    Is  it always

    Please login or register to see this code.

    You know that you need to get next correct last number?

    Link to comment
    Share on other sites

    • jgab changed the title to SDK for remote and offline HC3 development.

    Join the conversation

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

    Guest
    Reply to this topic...

    ×   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...