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


Recommended Posts

Posted

Thank you very much for help.

Posted

I left refresratesubscriber() process for over half of a hour and have error. It seems as no incoming event (fact - no events at this time) was the issue.

What's the reason to establish a timeout? Personally I prefer not to set it for long-time tests. Or maybe this is because of power saving feature in mac (can't set time after it sleeps, time only for screen saver)?

Please login or register to see this code.

 

  • Topic Author
  • Posted

    Which version of emulator do you run?

    2.0.14 is the latest and should adress the no data issue

    • Thanks 1
    Posted (edited)

    I had older one. Just upgraded, thank you.

     

    EDIT: In 2.0.14 there's no this issue.

    Edited by Łukasz997
  • Topic Author
  • Posted

    I have just uploaded the vscode extension "HC3Emu helper" (v0.4.0)  to the vscode extension market.

    If it's installed there should be api completion for fibaro.*, QuickApp.*, code snippets for all com.fibaro.* types 

    and, hopefully, it install the launch.json and tasks.json commands for hc3emu2 when you open a lua file.

  • Topic Author
  • Posted

    Ok, pushed v2.0.15 with some more fixes...
    There is a new directive

    Please login or register to see this code.

    that compacts the lua code for the QA so it's smaller (and harder to read). It's applied to QAs saved to disk with --%%save=...

    and when running the task uploadQA.

     

    • Like 1
    Posted

    I just install hc3emu2 and try may TestQA for offline test and get the following error:

    Please login or register to see this image.

    /monthly_2025_06/image.png.4f7151551e992c187b51b7dc97bfb19e.png" />

     

    I did add in the launch.json file your suggested configuration for hc3emu2 giving:

    HC3URL": "${config:hc3emu.url}"

    but I cannot find anymore a config.json file (I have only the hc3emu.json.

    Do have to create one with what is in hc3emu.json ?

    What is strange is that --%%offline=true is in the directive, so no needs of credentials.  

  • Topic Author
  • Posted (edited)

    Sorry, that example was if you are setting the credentials in your launch.json. (and using environment variables for setting the credentials)

     

    You should instead create a .hc3emu.lua file in your home directory as shown in the first post.

     

    The ${config:hc3emu.url} refers to that you have setup a entry in your vscode user settings file that says

    "hc3emu.url": "<hc3 url>". It's kind of outside the emulator, but the way to set environment variables in vscode....

     

    In your case, vscode is complaining that those settings variables are not there. Nothing to do with the emulator's offline mode.

     

     

    Edited by jgab
    Posted
    2 hours ago, jgab said:

    You should instead create a .hc3emu.lua file in your home directory

    Yes, the .hcemu.lua file exists in both my home directory and in my workspace with the correct credential data.

    hc3emu 1.1.11 is still working OK.

    Does it means that, for running QA lua file with Hc3emu2,  I need to use another workspace or directory in which I copy .hc3emu.json file?

  • Topic Author
  • Posted
    43 minutes ago, Christb said:

    Yes, the .hcemu.lua file exists in both my home directory and in my workspace with the correct credential data.

    hc3emu 1.1.11 is still working OK.

    Does it means that, for running QA lua file with Hc3emu2,  I need to use another workspace or directory in which I copy .hc3emu.json file?

    for hc3emu2 you need .hc3emu.lua.

    for the old hc3emu you use hc3emu.json

    These files can exist in the same workspace.

    Note that there is different launch.json items for hc3emu2 vs hc3emu.

    You can put the items in the same launch.json file to run either hc3mu or hc3emu2.

     

    • Like 1
    Posted (edited)
    34 minutes ago, jgab said:

    You can put the items in the same launch.json file to run either hc3mu or hc3emu2.

    Yes I did, launch.json file is in the workspace/.vscode but I have still the same hc3emu.url error

    Attached my launch.json files

    ALso I am tying to ru the QA using the following dbuf type:

    Please login or register to see this image.

    /monthly_2025_06/image.png.212a045fe2dd0e66be45283fff7cbeaa.png" />

    Is it correct?

    Please login or register to see this attachment.

    Edited by Christb
    Posted
    35 minutes ago, Christb said:

    I have still the same hc3emu.url error

    I suspect again a path issue.

    btw I have been able to run TestQA.lua with hc3emu but with a trick that I dont like: entering their values in the launch.json file instead of "${config:hc3emu.url}" ...

  • Topic Author
  • Posted (edited)
    9 hours ago, Christb said:

    Yes I did, launch.json file is in the workspace/.vscode but I have still the same hc3emu.url error

    Attached my launch.json files

    ALso I am tying to ru the QA using the following dbuf type:

    Please login or register to see this link.

    Is it correct?

    Please login or register to see this attachment.

    Yes, you need to remove 

    Please login or register to see this code.

    from the last item in the launch.json file.

     

    You have 5 items in the launch.json file.

    The first run just a lua file without the emulator.

    The next 3 runs the old hc3emu emulator. The first and the last of these you can remove, just keep the middle.

    The last runs the new hc3emu2 emulator (remove the env)

     

    So, if you have different launch items for the different emulators, give them names so you can tell them easily apart them when you choose them in the drop down menu,

    Like

    hc3emu - current file

    hc3em2 - current file

     

    Edited by jgab
    • Like 1
  • Topic Author
  • Posted (edited)
    16 hours ago, Christb said:

    I suspect again a path issue.

    btw I have been able to run TestQA.lua with hc3emu but with a trick that I dont like: entering their values in the launch.json file instead of "${config:hc3emu.url}" ...

    The test if you have the path correct is to run in the Terminal app (on windows or mac)

    Please login or register to see this code.

    If the require finds the hc3emu2 module, everything should be fine (or can be fine :-) )

     

    image.png.8c0823a611bccf2d0bc66acdabfc3836.png

     

     

    Edited by jgab
    Posted (edited)

    Good morning,

    yesterday vscode starts to warn me about "hub. ..." and RefreshStateSubscriber(), class, api are undefined (previously - not warning about it). Also several warinings in the eventLib, never seen before, I hope (__TAG, __assert_type). When I run such code, use "hub" (or "fibaro" what is not underscored) is ok. But this warning is little bit irritating - to be exact repeated 208 times, nearly all my files are "yellow".  It seems that a file was overwritten, but I don't know which one... Only thing I did yesterday is to upgrade hc3emu2, EMU helper to 0.4.0., install github files in terminal (in this order). Could you tell me what can I do about it? 

     

    Please login or register to see this image.

    /monthly_2025_06/image.png.477d4800ab030a116f360041a823726d.png" />

    Edited by Łukasz997
    Posted

    I found that fast solution is to add to settings.json:

    Please login or register to see this code.

    and it dissapears. But still something may need little correction.

  • Topic Author
  • Posted (edited)

    Yes, I used to have those globals in the settings.json that was provided with the git repo.

    However now with hc3emu2 where I don't recommend people to clone the repo for every QA they develop. Instead making a separate workspace and just use the 

    hc3emu2 launch.json command. 

    So, to install the launch.json and tasks.json (+ the globals for settings.json) in a newly opened workspace, I have developed the "Hc3Emu Helper" vscode extension

    that is now available in the vscode extension tab. (they are register in your global settings for vscode so they don't show up in the .vscode/* workspace)

    In the last version there was a bug which caused the lua globals to not be registered correctly. I have just published v0.5.0 that should correct it.

     

    Let me know if it works for you.

     

    Edited by jgab
    • Thanks 1
  • Topic Author
  • Posted (edited)

    I'm a bit unsure if you have a local "Lua.diagnostics.globals" in your .vscode/settings.json if they are merged with the extensions globals or override them.

    But you should not need to have them in your settings.json.

    There are other personal preferences, for lua, that can be good to set in the settings.json, like tab stops, coloring, etc...

    Note though, that there is a settings.json in the workspace but there is also a global user settings file for vscode.

    Sometimes it's better to put stuff there so one doesn't need to replicate them to every new workspace.

    Edited by jgab
    Posted

    I removed the section "Lua.diagnostics.globals" from local settings.json, upgrade extension - and now, everything is ok. Thank you.

  • Topic Author
  • Posted (edited)

    When I'm coding I'm quite dependent on the Lua Language Server to mark identifiers in my code that don't seem right.

    If there are warnings for undeclared globals or trying to assign undeclared fields to objects, I know that it's very likely that 
    I have done something wrong. All these warnings also show up in the bottom tab "Problems" in vscode. 

    I don't publish unless it's 0 problems reported.

    I still create bugs, but this has saved me numerous times from introducing stupid bugs .

    Edited by jgab

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