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
  • But are you running the downloadFQA  function?

    It needs to mount the filesystem first.

    Does the extension map up the QUickApps and Scenes as filesystem in the file explorer of vscode?

    Link to comment
    Share on other sites

    No - press CTRL+Shift+P then insert hc3fs: Setup Workspace + Enter

    result Error

     

     

    what is interesting that HC3 fslog is without change original time

     

    2024-02-04 12:48:37.252 [info] hc3fs says "Hello"
    2024-02-04 12:48:37.374 [info] HC3 version: 5.151.47

     

     

    Does the extension map up the QUickApps and Scenes as filesystem in the file explorer of vscode? NO

    Edited by petrkl12
    Link to comment
    Share on other sites

  • Topic Author
  • 24 minutes ago, petrkl12 said:

    No - press CTRL+Shift+P then insert hc3fs: Setup Workspace + Enter

    result Error

    what is interesting that HC3 fslog is without change original time

    2024-02-04 12:48:37.252 [info] hc3fs says "Hello"
    2024-02-04 12:48:37.374 [info] HC3 version: 5.151.47

    Does the extension map up the QUickApps and Scenes as filesystem in the file explorer of vscode? NO

     

    Well, it's persistent so it may be old logs you see

    Just now, jgab said:

     

    Well, it's persistent so it may be old logs you see

    So Team Viewer was a rat hole for me - I don't have it and trying to install on MacOS is hellish....

    Link to comment
    Share on other sites

    but this error is new every time when command> hc3fs: Setup Workspace is run

    2024-02-04 13:29:05.668 [error] TypeError: Cannot read properties of undefined (reading 'path')
    Link to comment
    Share on other sites

    ctrl+shift+p + typing hc3 showing only these commands but NOT your Setup Workspace - is it OK?

     

    Please login or register to see this image.

    /monthly_2024_02/image.png.1bf64faaff92dc37c57ecf50f3e05dc4.png" />

    I have also check you source code and it looks that I'm running Download QA - but it is not true somehow my command is changed

    Edited by petrkl12
    Link to comment
    Share on other sites

  • Topic Author
  • So, if I go to the Command Palette Ctrl-Shift-P and do hc3fs: Download .fqa,

    I get exact your error. The HC3.downloadFQA function don't get any argument (that should have a .path arg) and it complains
    However, you should not run that from the Command Palette... (will try to find a way to block it) and only run it from the file explorer context menu


    ....on the other hand you say you get the error when you run Setup WorkSpace...

    If you don't see the command open a new vscode window and open a workspace folder before trying the command

     

    2024-02-04 13:42:35.009 [error] TypeError: Cannot read properties of undefined (reading 'path')
    at HC3.downloadFQA (/Users/jangabrielsson/.vscode/extensions/[email protected]/out/hc3.js:297:43)
    at /Users/jangabrielsson/.vscode/extensions/[email protected]/out/extension.js:102:13
    4 minutes ago, petrkl12 said:

    ctrl+shift+p + typing hc3 showing only these commands but NOT your Setup Workspace - is it OK?

    Some strange state where it thinks it already setup... try open a new window and open a workspace folder.

    Link to comment
    Share on other sites

    16 minutes ago, jgab said:

    only run it from the file explorer context menu

    Some strange state where it thinks it already setup... try open a new window and open a workspace folder.

    I don't see where it should be in file explorer context menu

    Do you have any screenshot?

     

    btw. I think you could call init procedure in case that variable path is empty

    Edited by petrkl12
    Link to comment
    Share on other sites

  • Topic Author
  • 1 minute ago, petrkl12 said:

    I don't see where it should be in file explorer context menu

    Do you have any screenshot?

     

    btw. I think you could call init procedure in case that variable path is empty

    It's vscode's file explorer (tree view), and only works if you have the remote hc3 fs mounted. (Did you view the video? :-) )

    DownloadFQA only works when a QA is selected in the tree view - otherwise we don't know what to download. When called from the Command Palette it gets null. I will try to disable it from the Command Palette.

    Anyway, this version will have Setup Workspace always enabled...

     

    Please login or register to see this attachment.

     

    Link to comment
    Share on other sites

    I saw video in your first post and UI.lua example works OK :) 

    but I'm lost where it should be ...

    Please login or register to see this attachment.

     

    Please login or register to see this attachment.

    Edited by petrkl12
    Link to comment
    Share on other sites

    I have corrected myself:

    in your file extension.js

    Please login or register to see this code.

     

    Please login or register to see this image.

    /monthly_2024_02/image.png.dfebda3b4bb61a031d8f8c69770229d1.png" />

    Now you can run even via ctrl+shift+p   +  download fqa

     

    Edited by petrkl12
    Link to comment
    Share on other sites

  • Topic Author
  • 3 minutes ago, petrkl12 said:

    I have corrected myself:

    in your file extension.js

    Please login or register to see this code.

     

    But then you mount it when the extension is activated? In what workspaceFolder? The first when you start up vscode?

    The Setup WorkSpace command should add the filesystem to the workspace of your choice...

    3 minutes ago, jgab said:

    But then you mount it when the extension is activated? In what workspaceFolder? The first when you start up vscode?

    The Setup WorkSpace command should add the filesystem to the workspace of your choice...

    because you don't want it always mounted.

    Link to comment
    Share on other sites

    8 minutes ago, jgab said:

    But then you mount it when the extension is activated? In what workspaceFolder? The first when you start up vscode?

    The Setup WorkSpace command should add the filesystem to the workspace of your choice...

    it was mounted when I have first run of any command in ctrl+shift+p  from hc3fs....

    problem was with this. It has to be run earlier to get correct path

    Please login or register to see this code.

    Edited by petrkl12
    Link to comment
    Share on other sites

    OK now I have list of QA and scenes in VSCode and what I can with it in your fibemu?

     

    Link to comment
    Share on other sites

  • Topic Author
  • 1 hour ago, petrkl12 said:

    OK now I have list of QA and scenes in VSCode and what I can with it in your fibemu?

    Here is v0.0.5 that does a "double mount". It seems to be a known fact that a fsprovider extension is restarted when it mounts a filesystem/workspace.

    Not sure how to do it in a clean way....

    Please login or register to see this attachment.

    Well, hc3fs and fibemu is not aligned yet ;-) and is 2 separate use-cases as for now.

    - hc3fs you edit files residing on the HC3 but using the vscode editor...

    - fibemu, you emulate running a QA offline.

     

    The idea is that we should be able to use fibemu to run files provided by hc3fs... I haven't tested it yet and I believe that there need to be some extra hacking to be done.

    I thought maybe autogenerate a ".meta.lua" file in each hc3fs QuickApp folder and when running that file with fibemu it will load all the quickApp files and set UI and quickAppVars etc correctly... The .meta.lua file could look something like

    Please login or register to see this code.

    and it should be runnable by fibemu.

    Edited by jgab
    Link to comment
    Share on other sites

    thanks, version 0.0.5 works OK, the rest I will try to test

    Link to comment
    Share on other sites

    this in vscode return fqa nil

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

  • Topic Author
  • 20 minutes ago, petrkl12 said:

    this in vscode return fqa nil

    Please login or register to see this code.

     

    Yes, it only exports QAs running in the emulator at the moment.

    Please login or register to see this code.

    DIR is the running QAs in the emu, if not there we could look at the HC3.

     

    Btw, app api.get, api.put, api.post

    accept a last argument "hc3" and then just makes a direct call to the HC3

    Please login or register to see this code.

    • Like 1
    Link to comment
    Share on other sites

    I would like to stop lua code/program in some situation - how to do it?

    something like:

    if fibaro.fibemu then  ??? stop ??? end

     

    Link to comment
    Share on other sites

    Please login or register to see this attachment.

     

    I am in the same situation when pressing F5, I got the Pyton has not been found!

    I did change all "${file}" with "${relativeFile} but still get the python error mesage :

    (cannot find Python in French:

    Python est introuvable. Excutez sans argument pour procder l

    ).

    None of my directories had space in their name.

    What I did wrong wrong?

    >>>

    Link to comment
    Share on other sites

  • Topic Author
  • 27 minutes ago, petrkl12 said:

    I would like to stop lua code/program in some situation - how to do it?

    something like:

    if fibaro.fibemu then  ??? stop ??? end

    os.exit() was not exported to QA sandbox. I pushed a new version with os.exit available.

     

    5 minutes ago, Christb said:

    Please login or register to see this attachment.

     

    I am in the same situation when pressing F5, I got the Pyton has not been found!

    I did change all "${file}" with "${relativeFile} but still get the python error mesage :

    (cannot find Python in French:

    Python est introuvable. Excutez sans argument pour procder l

     

    ).

    None of my directories had space in their name.

    What I did wrong wrong?

    >>>

    If you can stand in vscode's terminal (at the bottom) and type 

    >python3

    and it works, the launcher would also find python.

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