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


Visual Studio Code (vscode) for QuickApp development


jgab

Recommended Posts

  • Topic Author
  • New feature: zombie

     

    Please login or register to see this code.

    Will instruct the QA on the HC3 with the deviceId 786 to send all its onAction and UIEvents to the QA running in the emulator - when the emulator is running.

    The emulator will ping the HC3 QA every 5s and if the HC3 QA don't get a ping it will revert to it's normal behaviour.

     

    The emulated QA in the emulator and the "zombified" QA on the HC3 may have different IDs.

    The emulator will make sure that when the emulated QA updates properties and UI views it will also update the HC3 QA.

     

    The advantage is that we have a QA on the HC3 that other QAs can interact with but we get all events to the emulator and can debug the code there.

     

    It also works with QuickAppChildren "automatically". Emulator created QuickAppChildren will be reflected on the HC3, and when the emulated QA starts up it will create copies of the existing children on the HC3 for the zombie, if any.

     

     

    Link to comment
    Share on other sites

  • Topic Author
  • Implemented the new switch button. Declaration looks like

    Please login or register to see this code.

    It gets "true" and "false" in event.values[1] and can be set by self:updateView(id,"value","true") or  self:updateView(id,"value","false") 

    Link to comment
    Share on other sites

    On 1/25/2024 at 5:36 PM, jgab said:

    New feature: zombie

     

    Please login or register to see this code.

    Will instruct the QA on the HC3 with the deviceId 786 to send all its onAction and UIEvents to the QA running in the emulator - when the emulator is running.

    The emulator will ping the HC3 QA every 5s and if the HC3 QA don't get a ping it will revert to it's normal behaviour.

     

    The emulated QA in the emulator and the "zombified" QA on the HC3 may have different IDs.

    The emulator will make sure that when the emulated QA updates properties and UI views it will also update the HC3 QA.

     

    The advantage is that we have a QA on the HC3 that other QAs can interact with but we get all events to the emulator and can debug the code there.

     

    It also works with QuickAppChildren "automatically". Emulator created QuickAppChildren will be reflected on the HC3, and when the emulated QA starts up it will create copies of the existing children on the HC3 for the zombie, if any.

     

     

    @jgab

    I'm trying to migrate to VSCode as there is zombie function now 👍

    How to translate this original setting to your new setup in VSCode:

    (ID 1008 is real QA in HC3 and I want to have everything to call to (or from) HC3 incl. global vars, QA vars, other QAs, children QAs, ...)

    Please login or register to see this code.

     

    Edited by petrkl12
    Link to comment
    Share on other sites

  • Topic Author
  • 13 hours ago, petrkl12 said:

    @jgab

    I'm trying to migrate to VSCode as there is zombie function now 👍

    How to translate this original setting to your new setup in VSCode:

    (ID 1008 is real QA in HC3 and I want to have everything to call to (or from) HC3 incl. global vars, QA vars, other QAs, children QAs, ...)

    Please login or register to see this code.

     

    Zombie is not really there yet.

    It's missing the concept of 

    Please login or register to see this code.

    Need to think about how to do that - and not sure if the old way is the way to go.

    For the TQAE proxy concept, the proxy was autogenerated by TQAE and the master code was always the code in TQAE.

    For zombie model kind of creates a hybrid as we debug the "real" QA running on the HC3 using a copy running in fibemu/TQAE.

     

    My thinking was the following workflow

    1. We have the real version of the QA on HC3,
    2. using a vscode command to download the QA code from the HC3
    3. debug version in vscode by temporarily making HC3 QA a zombie
    4. when done, use a vscommand to update the HC3 QA with the new code

    For this to be really smooth, I'm not sure all pieces are in place yet...

     

    For the UI we have kind of 2 situations.

    We would like to use the Web QA UI editor for complex UIs...

    We would like to use fibemu/TQAEs UI declarations for creating layouts that are not possible in the UI builder (and it's difficult for getting a feeling for the layout - however, the fibemu QA UI we interface is getting quite ok)

     

    Link to comment
    Share on other sites

    1 hour ago, jgab said:

    Zombie is not really there yet.

    It's missing the concept of 

    Please login or register to see this code.

    Need to think about how to do that - and not sure if the old way is the way to go.

    For the TQAE proxy concept, the proxy was autogenerated by TQAE and the master code was always the code in TQAE.

    For zombie model kind of creates a hybrid as we debug the "real" QA running on the HC3 using a copy running in fibemu/TQAE.

     

    My thinking was the following workflow

    1. We have the real version of the QA on HC3,
    2. using a vscode command to download the QA code from the HC3
    3. debug version in vscode by temporarily making HC3 QA a zombie
    4. when done, use a vscommand to update the HC3 QA with the new code

    For this to be really smooth, I'm not sure all pieces are in place yet...

     

    For the UI we have kind of 2 situations.

    We would like to use the Web QA UI editor for complex UIs...

    We would like to use fibemu/TQAEs UI declarations for creating layouts that are not possible in the UI builder (and it's difficult for getting a feeling for the layout - however, the fibemu QA UI we interface is getting quite ok)

     

    Yes, it could work

    For me the old concept of proxy was also OK :) and I was able to debug the complex QAs ie. for Philips Hue with a lot of separate QAs and also childern QAs with complex UI works without any issues ...

     

     

    Edited by petrkl12
    Link to comment
    Share on other sites

  • Topic Author
  • On 2/3/2024 at 11:51 AM, petrkl12 said:

    Yes, it could work

    For me the old concept of proxy was also OK :) and I was able to debug the complex QAs ie. for Philips Hue with a lot of separate QAs and also childern QAs with complex UI works without any issues ...

     

    vscode gives a lot of new possibilities that I'm exploring.

    Just did a first version of an vscode extension that "mounts" QAs and Scenes as a filesystem in vscode's file explorer.

    Try it by installing this extension in the extension view context menu

     

    Please login or register to see this attachment.

    Run hc3fs.workspaceInit in the command palette.

    Autosave is turned off by default and file are synched to the HC3 when explicitly saved.

    Here is a video of some of the features...

     

     

    An idea is to combine it with the emulator to run the files...

     

    Edited by jgab
    • Thanks 1
    Link to comment
    Share on other sites

    OK, thanks

    but some errors with path. What I should change?

     

    Please login or register to see this image.

    /monthly_2024_02/image.png.fba1ff4b5e6681555447778d14b1c184.png" />

    Link to comment
    Share on other sites

  • Topic Author
  • Ok, it seems like the extension behaves differently outside the extension development environment.

    Go to extension settings or go to settings and search for 'hc3fs'

    Set the dir to a place where you have a .vscode, typically a workspace folder.

    I have set it to "hc3fs.dir": "/Users/jangabrielsson/Documents/dev/HC3fs/hc3fs",

    Please login or register to see this attachment.

     

    Anyway, I expect to come out with a 0.0.2 tomorrow as I found some issues when I packaged it.

    Link to comment
    Share on other sites

    @jgab

    in this

     

    Please login or register to see this code.

    you should add this step

     

    del launch.json

    before mklink /H launch.json ..\..\fibemu\.vscode\launch.json

     

     

    Link to comment
    Share on other sites

     

    what should be in local setting in items user and pwd? (for HC3 is clear)

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    9 hours ago, jgab said:

    Ok, it seems like the extension behaves differently outside the extension development environment.

    Go to extension settings or go to settings and search for 'hc3fs'

    Set the dir to a place where you have a .vscode, typically a workspace folder.

    I have set it to "hc3fs.dir": "/Users/jangabrielsson/Documents/dev/HC3fs/hc3fs",

    Please login or register to see this attachment.

     

    Anyway, I expect to come out with a 0.0.2 tomorrow as I found some issues when I packaged it.

    I have tried these paths - but no success - still same error - maybe I dont know how to correctly write absolute path in vscode 

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

  • Topic Author
  • 2 hours ago, petrkl12 said:

    I have tried these paths - but no success - still same error - maybe I dont know how to correctly write absolute path in vscode 

    Please login or register to see this code.

     

    Ok, I removed the dir setting - I don't think it was the right option.

    I've linked v0.0.2 in post

    Please login or register to see this link.

     

     

    Link to comment
    Share on other sites

    @jgab

    still same error even with version 0.0.2

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

  • Topic Author
  • 37 minutes ago, petrkl12 said:

    @jgab

    still same error even with version 0.0.2

    Please login or register to see this attachment.

     

    You need to run the command "hc3fs: Setup Workspace" first, to mount stuff.

    If I don't and just run Download fqa I get your error.

    Download fqa should be run from the menu in the file explorer.

    Link to comment
    Share on other sites

    yes - I run: 

    hc3fs: Setup Workspace

    first error - fetch failed

    and then error with path

     

    Next run of hc3fs: Setup Workspace - only error with path

     

    Could you add more debug mesages?

     

    Please login or register to see this attachment.

    Edited by petrkl12
    Link to comment
    Share on other sites

  • Topic Author
  • I linked v0.0.3

    You can look in output->HC3 fslog

    and you have done the settings for the extension?

    Please login or register to see this image.

    /monthly_2024_02/image.png.d25db3f53e9b3b005eb62bc1de77267e.png" />

    Link to comment
    Share on other sites

    still same error

    sorry, I'm new in VSC where is: output->HC3 fslog

     

    Edited by petrkl12
    Link to comment
    Share on other sites

  • Topic Author
  • 1 minute ago, petrkl12 said:

    still same error

    sorry, I'm new in VSC where is: output->HC3 fslog

     

    Look at the video in my first post how I show the output (in terminal OUTPUT->and then the pop-up that is set on Tasks as defaults

    Just now, jgab said:

    Look at the video in my first post how I show the output (in terminal OUTPUT->and then the pop-up that is set on Tasks as defaults

    So I tried it in WIn11 and it worked. Sometimes Win11 can be tricky with url access rights...

    Link to comment
    Share on other sites

    output - HC3 fslog

    Please login or register to see this code.

    output - Extension host> error

    2024-02-04 12:48:38.257 [error] TypeError: Cannot read properties of undefined (reading 'path')
        at HC3.downloadFQA (c:\Users\xxxx\.vscode\extensions\[email protected]\out\hc3.js:297:43)
        at c:\Users\xxxx\.vscode\extensions\[email protected]\out\extension.js:102:13
        at s.h (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:150:175243)
        at s.$executeContributedCommand (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:150:176103)
        at d.S (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:147:5520)
        at d.Q (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:147:5286)
        at d.M (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:147:4376)
        at d.L (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:147:3455)
        at g.value (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:147:2242)
        at r.y (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:80:1902)
        at r.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:80:2119)
        at n.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:105:14073)
        at g.value (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:173:8051)
        at r.y (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:80:1902)
        at r.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:80:2119)
        at n.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:105:14073)
        at MessagePortMain.<anonymous> (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:173:6331)
        at MessagePortMain.emit (node:events:514:28)
        at Object.emit (node:electron/js2c/utility_init:2:2285)

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