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

Hey Jan,
Thanks, MQTT is back !
However {allowUnauthorized=true} and / or {rejectUnauthorized=falseTLS options ais not accepted in PLUA. the same code work in native fibaro quickapp.

Please login or register to see this code.

 

The battery only accept MQTTS connnection and is using a self-signed certificate.

 

Return the following error.

Please login or register to see this code.

 

  • Topic Author
  • Posted

    Ok. pushed a new version of plua. 
    This should work now:
     

    Please login or register to see this code.

     

    Posted

    Hmmm thanks, but not working at all ;-(

    I checked both options.

     

    ERROR:asyncio:Exception in callback AbstractEventLoop.add_reader()
    handle: <Handle AbstractEventLoop.add_reader()>
    Traceback (most recent call last):
      File "C:\Program Files\Python313\Lib\asyncio\events.py", line 89, in _run
        self._context.run(self._callback, *self._args)
        ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Program Files\Python313\Lib\asyncio\events.py", line 552, in add_reader
        raise NotImplementedError
    NotImplementedError
    ERROR:asyncio:Exception in callback AbstractEventLoop.add_writer()

     

    Downgrading to v 1.2.56 get back the connection error rejecting the certificate.

  • Topic Author
  • Posted
    14 minutes ago, ClaudeH said:

    Hmmm thanks, but not working at all ;-(

    I checked both options.

     

    ERROR:asyncio:Exception in callback AbstractEventLoop.add_reader()
    handle: <Handle AbstractEventLoop.add_reader()>
    Traceback (most recent call last):
      File "C:\Program Files\Python313\Lib\asyncio\events.py", line 89, in _run
        self._context.run(self._callback, *self._args)
        ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Program Files\Python313\Lib\asyncio\events.py", line 552, in add_reader
        raise NotImplementedError
    NotImplementedError
    ERROR:asyncio:Exception in callback AbstractEventLoop.add_writer()

     

    Downgrading to v 1.2.56 get back the connection error rejecting the certificate.


    Ok, this seems to be a Windows issue... I don't usually run/develop on Windows so I may miss stuff like this.
    I made a patch for Windows in v1.2.58, try it and see if it works better...?
     

    Posted

    Many thanks, it works on window too now! 

    • Like 1
    Posted (edited)

    Good morning,

    In one application I have the following message from plua, no idea whats wrong:
     

    Please login or register to see this code.

     

    In turn, other application after a while of working ends with:

    Please login or register to see this code.

    and with Python crash. Python is 3.12.3

     

    With hc3emu - no such problems.

    Could you try to guide me whats wrong?

     

    Update: after upgrading to PLUA .58 second app throws this and crashes:

    Please login or register to see this attachment.

    Edited by Łukasz997
  • Topic Author
  • Posted

    The first error is an error from the HC3, are you trying to create an internalStoarge variable with strange characters?

    The second  error may be that 3.12 is a bit different and the lupa (lua python lib I use) was bit old.
    Try to do
    >pip install --upgrade plua
    so it updates to the new plua and the new libraries.

    Posted

    Thank you for so quick reply.

    Actually, internal storage is used here. This is the name of internal storage variable:

    local LAST_GOOD_STATE_KEY = "__LICEMAN_LAST_STATE"
    I don't see anything wrong with it. On hc3emu and on the hub it works. However I eliminated underscores, shortened - and I saw:

    [10.03.2026][23:15:51][DEBUG ][PLUA]: Helper msg: [true,null,404]

     

    Regarding second: unfortunately, error persist after upgrade from 1.2.58 to 1.2.59

    Should I raise to the newest Python (3.14 or something)?

  • Topic Author
  • Posted (edited)

    For internalStorage you are not allowed to have a variable starting with "__"
    You get the error 
    Wrong variable name format. Accepted format: [A-Za-z][A-Za-z0-9_]*

    Testing it on the HC3 you don't get the error, but the variable is not stored (silent fail)

    I have made fixes in 1.2.62 that will make the use of restricted calls more robust - it may have fixed some of your other problems.
    Let me know. If not, try to capture as much as possible  of the error message. Also if you have a small QA example that creates the error it would be good.
    (I tried to run some complicated QAs on my Windows machine Win11,python 3.13.7, and I couldn't get an SIGSEGV error)

     

     

    Edited by jgab
    Posted (edited)

    1. Thank you for the information about the naming convention - I didn't know that.

    With PLUA *.62 and without the "_" prefix, it works.

     

    2. This is a huge application (~5000 lines), so unfortunately I can't provide a minimal sample.

    Sometimes it looks like this might be a pcall-related issue: the application has a very large RefreshState handler section. Hub internally calls the handler in protected mode. The crash always happens right after (inside?) the handler execution. The handler completes its job (at last visible part) and then it crashes (+ Python crash). However, the same code works both on the HC3 and on the older emulator.

     

    At times I also wonder whether this could be caused by some interaction between the proxy or helper components of the two emulators. I currently have both installed because I'm trying to migrate to PLUA. The reason I'm thinking about this is that occasionally - not always - PLUA prints the following message:

    WARNING: Invalid HTTP request received.

    But this application does not use any communication of that kind (no remote calls, no HTTP).

     

    Additionally, I have an error from PLUA proxy quickapp: [11.03.2026] [12:35:16] [ERROR] [QUICKAPP1270]: End of file

    I have over 80 warnings from .venv/lib/python3.12/site-packages/lua (qwikchild, json, mobdebug).

     

    Honestly, I don't know what other hint I could give you. Maybe it's best to leave it for now. I can continue working with the old emulator and try again later. One last step - I will try to reinstall PLUA.

    Edited by Łukasz997
  • Topic Author
  • Posted

    Additionally, I have an error from PLUA proxy quickapp: [11.03.2026] [12:35:16] [ERROR] [QUICKAPP1270]: End of file

    I have over 80 warnings from .venv/lib/python3.12/site-packages/lua (qwikchild, json, mobdebug).

    The proxy error, is it in Plua or on the HC3?
    How does these 80 errors manifest themselves? logs?

    Posted

    Proxy error is on HC3.

    These warnings (not errors) are listed in VSC windows PROBLEMS.

    Please login or register to see this attachment.

  • Topic Author
  • Posted

    Well, you see the whole development tree with a lot of test files... no worries for them. When I have nothing to do I may start to clean them up... I think there is a vscode setting that allow you to set directories that should be ignored for the problem report - in this case the .venv directory.

    Posted

    I said that because I thought it might point you in the right direction. 

     

    It can be excluded by adding section:

    Please login or register to see this code.

    in settings.json - for anyone user it may concern.

  • Topic Author
  • Posted

    plugin.restart()

    or

    api.post("/plugins/restart",{deviceId=self.id)

    • Like 1
    • 2 weeks later...
    Posted

    Hello @jgab,

    regarding mentioned few posts before PLUA crash: please find included the python error report and the AI analysis of it.

    The analysis points more than less the issue - maybe it can guide you to a solution.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

  • Topic Author
  • Posted

    Thanks for the report, try v1.2.63 that I uploaded and see if it fixes the problem.

    • Thanks 1
    Posted

    Indeed, the symptoms of the illness have retired - I am grateful.

  • Topic Author
  • Posted
    35 minutes ago, Łukasz997 said:

    Indeed, the symptoms of the illness have retired - I am grateful.

    Fingers crossed... 😉

    Posted

    Hello @jgab,

    unfortunately, I have another error. UpdateQA script does not work, not only generating error when uploading main file, but also deletes some files (until error) and leaves quickapp in a little "devastated" state. Additionally I would like to draw your attention to utf8 - library is present, but it name is not propagated to globals (_G). It's worth to include it there.
    Please see the picture. What could it be?

    Please login or register to see this attachment.

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