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

    I was thinking. It seems like the emulator thinks the rsrcs directory is the one in your local workspace.

    Are you developing in a cloned repo of hc3emu where there is a /rsrcs directory ?

    It could be that the emulator finds that instead of the luarocks directory.

    Is it so that you have a /rsrcs directory in your workspace (where you run your QA) that is a bit old and

    have a /rsrcs/stdStructs.json

    but not a /rsrcs/hc3emuHelper.fqa

    ??

    Then it could would work if you just rename the rsrcs directory to something like rsrcs_old.

     

    Posted (edited)
    32 minutes ago, jgab said:

    Are you developing in a cloned repo of hc3emu where there is a /rsrcs directory ?

    Answer is almost:

    I am developing in a directory named hc3emu-main and yes a RSrcs directory exists in it.

    Do you recommend to suppress all files except examples and my lua files under development?

    I will rename the rsrcs directory and rinstall latest version to test. I will let you know the result.

     

    Just test new version 1.1.13-1 and it is working now...

    So I will suppress all files not needed for my developments.
    Thanks

    Edited by Christb
    giving positive result of my test
    Posted
    16 minutes ago, Christb said:

    So I will suppress all files not needed for my developments.

    I have suppressed all directories except ;/emu and ./examples and kept only my xxxx.lua files and all OK

  • Topic Author
  • Posted (edited)

    Ok, I'm pushing 1.1.4 that will fix this.

    I'm using a 3rd party library to find the luarocks rsrcrs directory, and it behaves a bit weird on Windows.

    1.1.4 has a fix so it will avoid the local rsrcs directory for Windows machines if not _DEVELOP is set

     

    Edited by jgab
    Posted (edited)
    42 minutes ago, jgab said:

    Ok, I'm pushing 1.1.4 that will fix this.

     have now a lot of errors which are in the top --[]-- comments; it seems that I cannot use the "°" caracters, even in comment lines SyntaxError: invalid character '°' (U+00B0);

    An other error in terminal view:

     version = 3.4 -- When "Auto" plus slash minus 5C buttons now displayed; When climate zone
    is in "Off" then buttons "b10, b11, b14, b15, b18, b19" are not displayed; "minus 1C & plus 1C" no more showing "info2" in mode "Vacancy"

    SyntaxError: invalid decimal literal

     

    for the above I am not understanding what means 'invalid decimal literal'...

     

    I dont think that the Python Debugger has to take care of comment lines...and I did not have all these errors in version 1.1.3

     

    Even: --version=7.2 is not accepted or --[[version = 7.2]] is not accepted

     

    So I suppressed all the comments but now I have a new fatal error:

      File "C:\Users\ASUS\Documents\hc3emu-main\Manual_Climate_zone_v7.x.lua", line 1
        if require and not QuickApp then require("hc3emu") end
    IndentationError: unexpected indent

     

    I am going back to 1.1.3

    Edited by Christb
    Posted
    37 minutes ago, Christb said:

     

    I am going back to 1.1.3

    Done but now I have the following errot in the TERMINAL View:

    FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\ASUS\\Documents\\fibemu\\tasks'cd

    Changing the terminal to c:Users/ASUS/hc3-=emu-main, I am getting also now the bove version = 3.4... error

     

  • Topic Author
  • Posted

    Seems like you are trying to run using something else then "Lua Mobdebug - Current file" 

    (We are still talking about hc3emu?)

    Posted (edited)

    Good evening,

    it seems that

    Please login or register to see this code.

    does not work in emulator 1.1.3

    No error, but also no push on the phone. On HC3 this parameters works. Working online.

     

    PS: I have this small helper QA from previous version of hc3emu. Tomorrow I check if this is a source of problem - maybe...

     

    Edited by Łukasz997
  • Topic Author
  • Posted
    6 hours ago, Łukasz997 said:

    Good evening,

    it seems that

    Please login or register to see this code.

    does not work in emulator 1.1.3

    No error, but also no push on the phone. On HC3 this parameters works. Working online.

     

    PS: I have this small helper QA from previous version of hc3emu. Tomorrow I check if this is a source of problem - maybe...

     

    The helper QA hc3emuHelper that's installed is automatically upgraded if a new version is available.

    The helper QA is not involved in this call.

     

    So, it's nothing strange with this call, it's passed on to the HC3 with the official API.

    However, for me it doesn't work on the HC3 either at the moment, neither QA nor Scene.

    Seems to be the day form for push messages and the yubii app...

     

     

     

     

  • Topic Author
  • Posted

    So after a reboot of the HC3 push works both from the emulator and the HC3...

    Posted (edited)
    19 hours ago, Christb said:
    19 hours ago, Christb said:

    So I will suppress all files not needed for my developments.

    I have suppressed all directories except ;/emu and ./examples and kept only my xxxx.lua files and all OK

    I fact I did suppress also *.json files in the hc3emu-main directory; I restaured all of them and now your last version 1.1.5 accepts to start the QA but with a new error during initialisation as below (the HC3 proxy QA seems to work any way):

    HC3Emu - Tiny QuickApp emulator for the Fibaro Home Center 3, v1.1.5
    [13.05.2025][14:56:25][SYS] Proxy found: 686 SelectTest

    [error] json.decode error: Nil value, bad argument #1 to '?' (string expected, got nil)
    [13.05.2025][14:56:57][SYS] Starting QuickApp 'SelectTest'
    [13.05.2025][14:56:57][DEBUG ][SELECTTEST686]: QA  SelectTest  id: 686 , version: 1.4  started
    [13.05.2025][14:56:57][DEBUG ][SELECTTEST686]: --onInit() end ----
    [13.05.2025][15:07:51][DEBUG ][SELECTTEST686]: ----- fClimZoneChoice() end -----
    [13.05.2025][15:07:51][DEBUG ][SELECTTEST686]: ClimZoneChoice; ClimZoneChoice:  14
    [13.05.2025][15:07:51][SYS] API not implemented: GET /panels/climate/14 - trying HC3

    The last warning message must be related to your last post Tip an Tricks about not implemented api calls; am I right?

    I like the fact that automaticcaly you send the call directly to the HC3.

    I didn't have this warning message with version 1.1.0.80-1 and the api call seemed to work. 

     

    About the json.decode error, is it an issue in my QA or something wrong in the directives? 

    it is comming from the emu.lua file function Emulator:HC3Call(method,path,data,silent) line 617.

    What is strange is that the 'data' is not empty and corresponding to the HC3 list of detailed Climate Zone tables

    Edited by Christb
  • Topic Author
  • Posted (edited)

    Yes,

    [13.05.2025][15:07:51][SYS] API not implemented: GET /panels/climate/14 - trying HC3

    is just a warning that the emulator don't know the call and passes it on to the HC3. I will make it possible to turn off the warning with a debug flag.

    The json.decode error is not good though - do you get it every time you start the QA?

    If so, can you PM me code (again)?

    Even if it's your code, the error message should be better...

     

    Edited by jgab
  • Topic Author
  • Posted

    [13.05.2025][14:56:25][SYS] Proxy found: 686 SelectTest

    [error] json.decode error: Nil value, bad argument #1 to '?' (string expected, got nil)
    [13.05.2025][14:56:57][SYS] Starting QuickApp 'SelectTest'

     

    There is a 32s delay between Proxy Found and Starting QuickApp... is the emulator hanging doing it? 

  • Topic Author
  • Posted (edited)

    So, emu.lua:617 should not log an error message as it is protected by a pcall... this is very strange.

    Have you edited the log output? I can't find any place where it would start the error log message with "[error] json.decode error: Nil value, ..."

    It could happen that the HC3 don't respond on a call (timeout or something else...) and the data received is garbage,

    but the code handles this, so I'm a bit lost...

    Edited by jgab
    Posted
    4 hours ago, jgab said:

    The json.decode error is not good though - do you get it every time you start the QA?

    If so, can you PM me code (again)?

    Yes I get it at the start of the 2 QA I have under development.

    My HC3 is running firmware 5.180 (latest)

    Below a full screen view just after the error, on the left side, the code is runing if I press the start icon of the first thread

    Please login or register to see this attachment.

     

     

    I just discover that leaving the Manual_Climate_Zone_v7.X QA without any action for around 15mn I have this error:


    [13.05.2025][15:58:57][SYSERR]    ...coop\apps\luarocks\current\rocks\share\lua\5.4\copas.lua:87: ....local-lua-debugger-vscode-0.3.3\debugger\lldebugger.lua:1797: Copas 'try' error intermediate table: 'timeout'
    193
    [13.05.2025][15:58:57][SYSERR]    ...pps\luarocks\current\rocks\share\lua\5.4\hc3emu\util.lua:404: attempt to index a nil value (local 'tb')
    [13.05.2025][15:58:57][SYSERR]    C stack overflow
    18
    [13.05.2025][15:58:57][SYSERR]    ...pps\luarocks\current\rocks\share\lua\5.4\hc3emu\util.lua:404: attempt to index a nil value (local 'tb')

     

    Attached the 2 lua files.

    Manual_Climate_Zone_v7.x QA is still working when I valid the continue icon for the top thread but it is not the case of Select_Button8Test QA no more. No idea why.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

  • Topic Author
  • Posted (edited)

    So, it seems like you are running with the wrong Lua launcher, and thus the wrong lua debugger.

    You need to run Lua Mobdebug, ex, using the predefined launch.json I have with "Lua Mobdebug: Current file"

    If I try to run it with "Debug Local-Lua", or some of the launch task for fibemu that used Local Lua Debugger from Tom Blind I get your error...

    Please login or register to see this attachment.

     

    Switch to Lua Mobdebug: Current File, that uses the Lua Mobdebug adapter that hc3emu is designed for...

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

    Switch to Lua Mobdebug: Current File, that uses the Lua Mobdebug adapter that hc3emu is designed for...

    Thanks it is working perfectly now without any error; now with 1.1.6-1

    May I know why there are so many Debug modes ?

    Edited by Christb
  • Topic Author
  • Posted (edited)

    Well, you have the ones you define in launch.json.

    Depending on type of vscode project you may have several ways of running the code.

    For my own Lua project I now have Local-lua for non-hc3emu code, and two mobdebug launchers (one experimental named "QA") for hc3emu projects

    When I was running fibemu, there was a need for starting the debugger differently, as the fibemu codebase was in Python....

    If you only run hc3emu, there is only need to have the "Lua MobDebug: Current File" request defined in launch.json

     

    A "problem" is that if you experiment with different launch requests, they hang around in the drop-down menu even if deleted from the launch.json file, which is a bit annoying and can populate it with a lot of junk....

    There are posts on vscode forums how to clean it up but it's quite involved...

     

     

     

    Edited by jgab
    • Like 1
    • 2 weeks later...
    Posted

    I have made good progress developping my QA (thanks to the proxy feature).

    2 questions:

    1. is it possible to write something like that:  if [--%%offline=true] then ..lines of code.. end
    2. How I can read a json or text file located on my PC when running a QA offline?

     

  • Topic Author
  • Posted (edited)

    When you run the emulator, the table fibaro.hc3emu is available and there are extra functions available in fibaro.hc3emu.*

    so you can use that as a test if you run in the emulator.

    There are also some of the lua missing standard lua functions available in fibaro.hc3emu.lua.*

     

    So to read in a json file from the pc when you run in the emulator you can do

     

    Please login or register to see this code.

    The path to the file is relative to the workspace you are in.

    Edited by jgab
    • Like 1

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