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

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

    The issue is that the emulator is never running as, soon as I am pressing F5, I am getting the error and emulator stops even if directive '--%%offline=true' is included as below using New_QA.lua:

    if require and not QuickApp then require("hc3emu") end

    -- A basic QuickApp example
    -- This QuickApp demonstrates basic structure and functionality
    --%%speed=72
    --%%silent=true
    --%%offline=true

    local version = "0.1"

    ...

    the error is :

    Process started
    [04.04.2025][20:44:42][SYSERR]    Missing hc3emu.URL - Please set url to HC3 in config file
    Process exit with code: 1 signal: null
    Process on close code: 1 args: null

     

    Don't set

    --%%speed=72
    --%%silent=true

    I can't see what version you run

    Are you running the latest v1.0.75?

    if not, do again

    Please login or register to see this code.

     

  • Topic Author
  • Posted

    With the latest version, settimg

    Please login or register to see this code.


    it will not complain about HC3 credentials as they are never used.

    This means that the emulator should start without a config file.

    When the emulator runs it's possible to use the _setup.html interface to do configuration, including creating configuration files.

    Please login or register to see this code.

    However, it is possible to create the config file with commands too

    Please login or register to see this code.

     

    The create commands are actually a bit friendly  - if the config file already exists it will only add fields to the config file that is missing, thus not overwrite existing entries in the config file.

    These are the exact lua functions the _setup.html page is calling in the emulator when the create config buttons are pressed...

     

    I was thinking to maybe run these commands every time the emulator was started, but I would like to keep the startup time as short as possible and also not write file outside the workspace (in the user's home directory), unless he has asked about it...

    • Like 1
    Posted
    11 hours ago, jgab said:

    Are you running the latest v1.0.75?

    Yes, see below:

    PS C:\WINDOWS\system32> luarocks install hc3emu --force
    Installing

    Please login or register to see this link.

    hc3emu 1.0.75-1 depends on lua >= 5.3, <= 5.4 (5.4-1 provided by VM: success)
    hc3emu 1.0.75-1 depends on copas >= 4.7.1-1 (4.8.0-1 installed: success)
    hc3emu 1.0.75-1 depends on luamqttt >= 1.0.2-1 (1.0.2-1 installed: success)
    hc3emu 1.0.75-1 depends on lua-json >= 1.0.0-1 (1.0.0-1 installed: success)
    hc3emu 1.0.75-1 depends on bit32 >= 5.3.5.1-1 (5.3.5.1-1 installed: success)
    hc3emu 1.0.75-1 depends on lua-websockets-bit32 >= 2.0.1-7 (2.0.1-8 installed: success)
    hc3emu 1.0.75-1 depends on luafilesystem >= 1.8.0-1 (1.8.0-1 installed: success)
    hc3emu 1.0.75-1 depends on argparse >= 0.7.1-1 (0.7.1-1 installed: success)
    hc3emu 1.0.75-1 depends on datafile >= 0.10-1 (0.10-1 installed: success)
    hc3emu 1.0.75-1 depends on mobdebug >= 0.80-1 (0.80-1 installed: success)
    hc3emu 1.0.75-1 is now installed in C:/Users/ASUS/scoop/apps/luarocks/current/rocks (license: MIT/X11)

    6 hours ago, jgab said:

    With the latest version, settimg

    Please login or register to see this code.


    it will not complain about HC3 credentials as they are never used.

    For my case,above seems to be not true -

     

    see below with My_Test_QA.lua just created for:

    if require and not QuickApp then require('hc3emu') end
    --%%offline=true
    --%%webui=true
    function QuickApp:onInit()
      self:debug("welcome")
    end

    I am still getting the error [05.04.2025][09:00:03][SYSERR] Missing hc3emu.URL - Please set url to HC3 in config file

     

    6 hours ago, jgab said:

    The create commands are actually a bit friendly  - if the config file already exists it will only add fields to the config file that is missing, thus not overwrite existing entries in the config file.

    I have created a QA with the commands but again the same error which stops the emulator and the commands are not processed.

    Again any way to get the structure of the json config file?

    Posted
    2 hours ago, Christb said:

    Again any way to get the structure of the json config file?

    I Think that there is something wrong that occurs during my installation.

    Do you think that desinstalling all scoop and luarocks installation including vscode may solve this situation?

  • Topic Author
  • Posted (edited)

    Can you show the whole log when you run

    Please login or register to see this code.

    In your workspace, if there already is an emu/ directory created. Remove it so we get a clean run.

    If I do it I get a log that looks like this

    Please login or register to see this attachment.

     

    The small QA is in a file named "TestQA.lua"

    There is no emu.json anywhere, so there is no config.

    It creates the emu/ directory with some files

     

    Because if you have --%%offline=true it will not complain about not having URL set...

    If it logs 1.0.75 with --%%offline=true I will eat my virtual hat ;-)

     

    Anyway, the config file is in the rock library installed. It requires some digging, but should be in

    Please login or register to see this code.

    Need to rename it to hc3emu.json in your workspace, or .hc3emu.json in your home directory.

    However, I think this is just fixing the symptom, not curing the disease....

    Edited by jgab
    • Like 1
    Posted (edited)
    6 hours ago, jgab said:

    If it logs 1.0.75 with --%%offline=true I will eat my virtual hat ;-)

    I hope your virtual hat is made of chocolate..

    I have run your file TesQA.lua and here is the full log:

    Please login or register to see this attachment.

     

    I will try to create the json file but you are right, this may hide the issue; I will let you know.

    note: if I suppres the emu directory and launch Test_QA.lua, this directory is recreated with html files.

    Edited by Christb
    Add a note
    Posted
    50 minutes ago, Christb said:

    I will try to create the json file but you are right, this may hide the issue; I will let you know.

    I have done it but this is not curring at all the problem, still the same message.

     

    If you agree, I will save all my developments using fibemu and uninstall all modules installed by luarocks and scoop and try to get a clean situation. Do I need also to uninstall vscode and reinstall it using scoop?

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

    I have done it but this is not curring at all the problem, still the same message.

     

    If you agree, I will save all my developments using fibemu and uninstall all modules installed by luarocks and scoop and try to get a clean situation. Do I need also to uninstall vscode and reinstall it using scoop?

    So, the log you get is bonkers...

    You get an error about missing hc3emu.URL which is happening after a lot of other log outputs should have been printed...

    Ex. after the "HC3Emu - Tiny QuickApp emulator for the Fibaro Home Center 3 vx.x.z" message is logged.

    ...and I'm kind of running out of ideas what's going on here...

    Could you set an breakpoint on line 1 (the require hc3emu line)

    and step into it? See what files it opens? and continue to step through that file...
    At the end of hc3emu.lua (that it should open) it will require "hc3emu.emu" that will open

    the emu.lua file that if you step through it should log  "HC3Emu - Tiny QuickApp emulator for the Fibaro Home Center 3 vx.x.z"

    before doing the URL check...  

    See what code you get? Something is very fishy here...

     

  • Topic Author
  • Posted

    So, thinking about this a bit...

    Looking at your screen shot, the vscode state looks a bit strange...

    You have an "untitled (workspace)" open containing both fibemu and hc3emu, ... which is strange. I'm not sure how you end up with that because I always have a folder as my workspace... Do you do "Add folder to workspace" and end up with some kind of virtual workspace?

    That makes me worry that your launch.json, that usually refers to the current workspace, is malfunctioning somehow...

     

    Secondly, you are running your TestQA.lua file inside something that looks like a repo clone of the hc3emu git repo...

    (actually, you seem to have saved it in examples/TestQA.lua ?)

     

    This makes me think that your LUA_PATH variable is setup so it first searches your current directory and secondly the luarocks library tree... so the require will find the hc3emu.lua file in your "workspace" directory, which is the repo clone file and not the hc3emu.lua from the luarocks library. The one in the cloned repo is older than v1.0.75. and that's why you get missing URL error even when you have --%%offline=true

     

    Normally, you would not end up with a LUA_PATH that priorities local directory files in this way.

    However, depending on what Lua you run it may append it's own directories to the existing LUA_PATH when it runs.

    So, how does your launch.json look like? Because you have this "untitled (workspace)" that contains both fibemu and hc3emu, both which have their own .vscode/launch.json, I'm unsure which you run. If you run the one in fibemu it's going to go wrong for sure...

     

    So, I'm not eating my hat until I see it logs that you run v1.0.75 :-) 

     

    The definition of insanity is doing the same thing over and over again and hoping for a different outcome... So just reinstalling everything may not be the best approach, without knowing what to do different this time... :-) 

    • Like 1
  • Topic Author
  • Posted

    @Christb this print statement at the first line so we see what search path you have

    Please login or register to see this code.

     

    Posted
    7 hours ago, jgab said:

    You have an "untitled (workspace)" open containing both fibemu and hc3emu,

    When I have installed fibemu a long time ago, the untitled workspace appeared but not by my willingness; but as fibemu was working, I did not change anything.

     

    8 hours ago, jgab said:

    Secondly, you are running your TestQA.lua file inside something that looks like a repo clone of the hc3emu git repo...

    (actually, you seem to have saved it in examples/TestQA.lua ?)

     

    Yes, it is a clone of your repo: do I have to delete it?

    Is there a way to supress the UNTITLED(WORKSPACE) without suppressing fibemu?

    If not, I will save my 'test' and 'dev' folders elsewhere.

    Also, I just discovered that my eventRuner5 directory disapeared; it was at the same level than fibemu ; even it is not a big deal as eventRunner5 is installed in my HC3 and working very well, I will have to reinstall it.

     

     

    3 hours ago, jgab said:

    Please login or register to see this code.

    Same error without any additional print...

    So for sure the structure of my vscode workspace is wrong.

    Posted (edited)
    On 4/6/2025 at 4:34 AM, jgab said:

    Secondly, you are running your TestQA.lua file inside something that looks like a repo clone of the hc3emu git repo...

    😁I have made good progress : deletting all files in my folder hc3emu-lmain

    Downloading fro github your last c3emu-main and copy its files in my folder and now I have the following log with TESTQA.lua with a connection issue:

    Could not connect to 127.0.0.1:8818: timeout
    [07.04.2025][13:14:15][SYS]    Parsing TestQA.lua directives...
    [07.04.2025][13:14:16][SYS]    Starting webserver at 0.0.0.0:8265
    [07.04.2025][13:14:16][SYS]    Main QA file TestQA.lua
    HC3Emu - Tiny QuickApp emulator for the Fibaro Home Center 3, v1.0.75
    [07.04.2025][13:14:16][SYS]    Starting QuickApp 'MyQA'
    [07.04.2025][13:14:16][DEBUG ][MYQA5001]: welcome

    I also can preview _setup.html so I update its data with corect data but this is not suppressing the connect error

     

    But when I try your example QA_offline_UI.lua I have 2 errors in the log:

    Could not connect to 127.0.0.1:8818: timeout
    [07.04.2025][13:04:38][SYS]    Parsing examples\QA_offline_UI.lua directives...
    [07.04.2025][13:04:38][SYS]    emu/_setup.html installed
    [07.04.2025][13:04:38][SYS]    emu/_emu.html installed
    [07.04.2025][13:04:38][SYS]    emu/pages/editSettings.html installed
    [07.04.2025][13:04:39][SYS]    emu/pages/quickapps.html installed
    [07.04.2025][13:04:39][SYS]    emu/pages/style.css installed
    [07.04.2025][13:04:39][SYS]    emu/pages/devices.html installed
    [07.04.2025][13:04:39][SYS]    emu/pages/script.js installed
    [07.04.2025][13:04:40][SYS]    Starting webserver at 0.0.0.0:8265
    [07.04.2025][13:04:40][SYS]    Main QA file examples\QA_offline_UI.lua
    HC3Emu - Tiny QuickApp emulator for the Fibaro Home Center 3, v1.0.76
    [07.04.2025][13:04:40][SYSERR]    Missing hc3emu.URL - Please set url to HC3 in config file

    Then I discovered that in QA_offline_UI.lua the directive was --% %offline= true, chage for correct directive and getting thes log messages:

    Could not connect to 127.0.0.1:8818: timeout
    [07.04.2025][13:32:03][SYS]    Parsing examples\QA_offline_UI.lua directives...
    [07.04.2025][13:32:03][SYS]    emu/_emu.html installed
    [07.04.2025][13:32:03][SYS]    emu/pages/devices.html installed
    [07.04.2025][13:32:03][SYS]    emu/_setup.html installed
    [07.04.2025][13:32:03][SYS]    emu/pages/script.js installed
    [07.04.2025][13:32:03][SYS]    emu/pages/editSettings.html installed
    [07.04.2025][13:32:03][SYS]    emu/pages/quickapps.html installed
    [07.04.2025][13:32:03][SYS]    emu/pages/style.css installed
    [07.04.2025][13:32:04][SYS]    Starting webserver at 0.0.0.0:8265
    [07.04.2025][13:32:04][SYS]    Main QA file examples\QA_offline_UI.lua
    HC3Emu - Tiny QuickApp emulator for the Fibaro Home Center 3, v1.0.76
    [31.12.2025][10:00:13][SYS]    Time set to Wed Dec 31 10:00:13 2025
    [31.12.2025][10:00:13][SYS]    Starting QuickApp 'Offline2QA'
    [31.12.2025][10:00:13][DEBUG ][OFFLINE2QA5001]: Offline2 QA started Offline2QA 5001

    _emu.html is giving:

    Please login or register to see this image.

    /monthly_2025_04/image.png.33d4723a8f42497d0414844a4b6e5540.png" />

    And Offline2QA.html

    image.png.d0c3853c3de271d400b8cff177d6f086.png

     

    I can see that all QA buttons are working with no error.

    New Questions:

    1. Why I cannot connect to 127.0.0.1:8818? Is it a port authorisation?
    2. Do you have a detailled user manual for using _setup.html page:
      • in the field IP can I use access hc3_ name instead of 192.168.1.xxx?
      • I have only authorized https access: is it the the reason why I have the error?
      • Making a test with QA_test/lua, I have a more comprehensive error message: [07.04.2025][14:04:32][SYSERR] Invalid format, hc3emu.URL - Must be http(s)://<ip>/ but I have not find where this field is located
         
    3. How I can run 2 different versions of emulator?
    • TestQA.lua is located in c:\Users\ASUS\hc3emu-main (v1.0.75)
    • QA_offline_UI.lua is located in c:\Users\ASUS\hc3emu-main\examples (v1.0.76)

     

     

    Edited by Christb
    • Like 1
  • Topic Author
  • Posted (edited)

    Ok! Excellent!

     

    1. 127.0.0.1:8818 is the debugger. If you get a connection error it usually means that you are running 2 sessions, and it can't open the same port twice.

    In the next release the default is changed to 8172.

    and it's possible to set it to another value with 

    --%%dport=xxx

    This means that you can run 2 QAs in different vscode windows. 

    You also need to set the web port to something else

    --%%port=yyyy.  

    The default here is 8265 (and it also uses port+1 for another service port)

     

    You can't open 2 vscode windows to the same workspace, so you need different directories (workspaces) for each.

     

    In theory, you shouldn't need to download the hc3emu repo. It should be enough to do

    Please login or register to see this code.

    and rerun it when updating

     

    Yes, you should be able to have an https address to the HC3.

    However, at the moment it requires the address to be on the format

    http(s)://x.y.z.w/

    so if your domain name don't have 4 parts it will complain - I may change this.

     

    Yes, the example QA_Offline_UI.lua had the offline commented out so it tried to connect to the HC3 and that's why you got the error.

    Edited by jgab
    • Like 1
    Posted
    5 hours ago, jgab said:

    Yes, you should be able to have an https address to the HC3.

    However, at the moment it requires the address to be on the format

    http(s)://x.y.z.w/

    It is now working with the

    Please login or register to see this link.

    5 hours ago, jgab said:

    127.0.0.1:8818 is the debugger.

    With all QA stopped and close, the closing vscode I always have the connect time out; it may be that with all my previous tests I have locked the port:  I used .\kill-port.ps1 8818 but witjout any succes

     

    New: testing QA_UI_test.lua, my HC3 had created a proxi QA(Id 672) which seems to work correctly but at QA launch I did get a json.decode error;  need to press again F5 to have the QA to start:

    [07.04.2025][17:59:35][SYS]    Proxy installed: 672 UItestProxy

    [error] json.decode error: bad argument #1 to '?' (string expected, got nil)
    [07.04.2025][18:00:23][SYS]    Starting server at 192.168.1.29:8264
    [07.04.2025][18:00:23][SYS]    Starting QuickApp 'UItestProxy'
    [07.04.2025][18:00:23][DEBUG ][UITESTPROXY672]: onInit UItestProxy 672

  • Topic Author
  • Posted (edited)

    So, looking at your previous previous post I see that you run

    Please login or register to see this code.

    but I haven't "released" 1.0.76 as a luarock yet. It's just my working gitrepo copy.

    The version I release are through luarocks install.

    Stuff that I have in my repo can have bugs (usually have). 

    It's ok to download the repo and test the examples etc. But be aware also the examples can be buggy. I use them for testing and frequently change stuff.

    One thing I do is that when I'm developing in my repo I set

    _DEVELOP=true

    At the top of the file. What that cause is that the emulator loads the files from the repo (local directory) instead of from the luarocks directory.

    That is so that I can debug the code without having to make a rock every time...

    If you run an example QA in the directory, it's good to check if _DEVELOP is true and in that case comment it out, to be sure that you run

    an "official" release of hce3emu from the installed rock. Of course that can still have bugs :-)

    When the code matures a bit more I will move over to "stable" and "develop" branches in my repo - like the big boys do...

     

    Btw, now I have packaged and uploaded v1.0.76

     

     

    Edited by jgab
  • Topic Author
  • Posted

    Pushed v1.0.77-1

    Please login or register to see this code.

    • Made some changes for debugger

    mobdebug is now set to use it's default port 8172.

    It also register on 'localhost' instead of 127.0.0.1, there seems to be a subtle difference sometimes...

     

    The port can be changed but the directive

    Please login or register to see this code.

    'd' as in debugger port.

    If you want to run 2 Vscode windows with QAs at the same time you can chose another port for one of the QAs so they don't clash when trying to open the same port.

    You also need to set the web interface port. It's default to 8265 and can be changed with

    Please login or register to see this code.

    Note that both abc and abc+1 will be used. So you can't set the other QA to 8266...


     

    • Like 1
    Posted
    4 hours ago, jgab said:

    It's ok to download the repo and test the examples etc. But be aware also the examples can be buggy

    Understood. Wich folder from your repo I can keep in my hc3emu-main workspace to prevent conflict of version or I can delete all and only keep in my own QA?

     

    Now fibemu is no more working, running a QA give error as it does not recognize api.get QuickApps:function(). 

    Do I have to modify something in QA header to have back fibemu?

    4 hours ago, jgab said:

    Pushed v1.0.77-1

    When I just run luarocks install hc3emu, it is still installing version hc3emu-1.0.76.1.src.rock (already install for me)

    Posted
    On 4/8/2025 at 8:35 PM, Christb said:
    On 4/8/2025 at 4:18 PM, jgab said:

    Pushed v1.0.77-1

    When I just run luarocks install hc3emu, it is still installing version hc3emu-1.0.76.1.src.rock (already install for me)

    OK I have been able to install 1.0.77-1 😁 which also curred an issue of missing folder after a Windows update🥶...

     

    I am now continuing the development of a QA about Cimate Zones Override which I started using ZeroBrane, then fibemu and now hc3emu (in fact my training QA).

    • New directives are slightly different : ' ' or " ' are no more needed for text directive except in buttons and labels; also 'f=' is replaced by 'onReleased='.
      Good as more compliant to the HC3 QA editor.
      Now all buttons are activating its function but they are not yet working as before: Log of the function in the DEBUG CONSOLE seems to be OK but buttons or Labels are not updated correctly: shown data are those displayed at the end of the onInit(); I suspect a format error in my self:updateView(...) even they were working in fibemu; I know it is some time difficult to find the problem as no error message, just the command is ignored (like in fibemu).
       
    • Do you have a list of all changes you made from fibemu to hc3emu?
       
    • Are these drectives still neededor valid?

    --%%debug=permissions:false,refresh_quickAppVariables:false,refresh:false
    --%%debug=autoui:true
    --%%remote=devices:*

    • Do you know a way to have the html Device View in my usual web browser? I will be easier for me to use the web view on another screen and look at the DEBUG CONSOLE or make change to the code?

     

     

     

    Posted (edited)
    12 minutes ago, Christb said:

    Do you know a way to have the html Device View in my usual web browser? I will be easier for me to use the web view on another screen and look at the DEBUG CONSOLE or make change to the code?

    I have found that copying the link at the top of the inbedded web server I can get the same in Firefox😏.

    Edited by Christb
    Posted
    54 minutes ago, Christb said:

    I suspect a format error in my self:updateView(...) even they were working in fibemu; I know it is some time difficult to find the problem as no error message, just the command is ignored (like in fibemu).

    In fact this not an updateView issue but the refresh of the html view (my code is in fact OK).

    As in fibemu, is it possible to add a directive to refresh automatically the html view? or inside a setting file?

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