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
    44 minutes ago, Christb said:

    Unfortunatly, the function I have added is no more making the change, {} are still {} after running the function.

    What I am using is:

         local function emptyArray(t)
              if type(t) == 'table' then
                if next(t)==nil then json.util.InitArray(t)
                else
                  for _,v in pairs(t) do emptyArray(v) end
                end
              end
         end --emptyArray()

     

        emptyArray(climZTable) -- needed for changing {} to []; lauched after all new values control in climZTable table
     
    I tried also 
    json.util.InitArray(climZTable.properties.incompatibleDevices)

    with no success

    This function was working with fibemu and hc3emu...

    Sorry, InitArray was lost. Added json.util.InitArray in v1.2.43

    • Like 1
    Posted
    4 hours ago, jgab said:

    Added json.util.InitArray in v1.2.43

    Now my Qa is updating  H3 Climate Zone 🙂 Thanks

     

    Posted

    Hi Jan,
    Moving even further with the PLUA, have you implemented the com.fibaro.multiPositionSwitch device type already?

    I'm trying to try a very simple QA based on the below.

     

    It works perfectly locally on hc3, but not with PLUA Proxy nor Desktop UI.
    The issues are:

    • The proxy gets the "multiswitch" buttons, created, but not the desktop UI.
    • When click on a button the "setPosition(value)" function get a nil value.

    Here is the code:

    Please login or register to see this code.

     

    Thanks.

    Posted
    On 9/13/2025 at 7:57 PM, petrkl12 said:

    @jgab

    how to do it same function (UI, Variables, Proxy and Files) in Plua for this:

     

    Please login or register to see this code.

     

    @jgab Any idea how to do it in Plua?

  • Topic Author
  • Posted
    2 hours ago, petrkl12 said:

    @jgab Any idea how to do it in Plua?

    Plua don't support to connect to an existing QA.
    The model I to let Plua autogenerate a proxy and when the code work do 
    update to update the existing QA.

    Posted

    OK, Is it possible to do copy of current QA (varaibles, UI) including childs (also vars,UI)?

     

  • Topic Author
  • Posted (edited)

    The way to start is to do a 

    Please login or register to see this code.


    It downloads the existing QA and unpacks it into lua files and adds the header to the main file.

    Then you can add 

    --%%proxy:true

    and 

    --%%logui:true

    to get it to use a proxy and log the proxy's ui settings on each start.

    Edited by jgab
    • 2 weeks later...
    Posted

    @jgab

    it could be still perfect to have possibilty to do debugging as in previos version. Do you thing that you could do it?  Thanks

     

    hc3_emulator.resources = {UI = 1212, quickVars = 1212}
    hc3_emulator.proxy = 1212

  • Topic Author
  • Posted
    4 hours ago, petrkl12 said:

    @jgab

    it could be still perfect to have possibilty to do debugging as in previos version. Do you thing that you could do it?  Thanks

     

    hc3_emulator.resources = {UI = 1212, quickVars = 1212}
    hc3_emulator.proxy = 1212

     

    Any specific reasons you don't want to create proxy on the HC3 to debug?
    The way to hijack an existing QA to insert a proxy handler was not fool proof...

    Posted

    it's about speed. I don't need to do any action just to start debugging in ZB (perfect solution for me)

    Posted

    Hi @jgab,

    Using the desktop view, is it normal that for a switch button it is not possible to change the switch button text  inside the "onToggled" function (except at start, inside onInit()) ?

    The code below does not make any change of the switch button label

    if event.values[1] == true then
            self:updateView("autoSwitch", "text", "Auto Mode activated")
        else
            self:updateView("autoSwitch", "text", "Auto Mode desactivated")
        end

    The above code is working for another normal button.

     

    I have also tested your QA example described in your documentation (

    Please login or register to see this link.

    )

    I have the same issue, cannot update the "text" value of the switch button.

     

    BTW; it seems that lineself.autoMode = event.values[1] == "true" is incorrect and needs to be changed to self.autoMode = event.values[1]

    Please login or register to see this code.

     

  • Topic Author
  • Posted
    13 hours ago, Christb said:

    Hi @jgab,

    Using the desktop view, is it normal that for a switch button it is not possible to change the switch button text  inside the "onToggled" function (except at start, inside onInit()) ?

    The code below does not make any change of the switch button label

    if event.values[1] == true then
            self:updateView("autoSwitch", "text", "Auto Mode activated")
        else
            self:updateView("autoSwitch", "text", "Auto Mode desactivated")
        end

    The above code is working for another normal button.

     

    I have also tested your QA example described in your documentation (

    Please login or register to see this link.

    )

    I have the same issue, cannot update the "text" value of the switch button.

     

    BTW; it seems that lineself.autoMode = event.values[1] == "true" is incorrect and needs to be changed to self.autoMode = event.values[1]

    Yes, it was a miss, fixed in v1.2.48

    • Like 1
    • 2 weeks later...
  • Topic Author
  • Posted

    If you need a way to keep an eye on the HC3 system events while developing, I recommend the EventLogger app.

     

    • Like 4
    • 5 weeks later...
    Posted

    Dear @jgab,

     

    I reopen in vscode lua file that was working Offline few weeks ago but now I am getting this error just after the onInit() has been terminated and I can see for 2 seconds the correct QA desktop view: 

    WARNING:plua.fastapi_process:FastAPI process not running

    => process stopped

     

    May I have changed something in the plua settings which causes this error?

     

     

    Posted
    1 hour ago, Christb said:

    May I have changed something in the plua settings which causes this error?

    Fixed Sorry, I was not lauching the QA with the right launch.json....

    Posted (edited)

    Dear @jgab, is the call     fibaro.getFile(id,"fileName")   is existing in Plua?

    I want to know if a File is existing in a QA

    I am getting this type of error:

    attempt to call a nil value (field 'getFile')

     

    Edited by Christb
  • Topic Author
  • Posted
    4 hours ago, Christb said:

    Dear @jgab, is the call     fibaro.getFile(id,"fileName")   is existing in Plua?

    I want to know if a File is existing in a QA

    I am getting this type of error:

    attempt to call a nil value (field 'getFile')

     

    No, it’s not. You need to use the rest api to get the files.

    Posted
    21 hours ago, jgab said:

    No, it’s not. You need to use the rest api to get the files.

    Ok I have found in your fibaroExtra.lua all needed functions to play with QA Files 😀 

    • Like 1
    • 1 month later...
    Posted (edited)

    I am working on a HomeTable creation and averything were OK, homeTable json was registered in my global variable as a string.

    I am also able to display in an HTML table all items of the table(aR') constructed by the QA but when I am trying a tableString=json.encode(aR) I am getting this error:

    HOMETABLE5555]: ...scoop\apps\python\current\Lib\site-packages\lua\init.lua:'utf-8' codec can't decode byte 0xc3 in position 3887: invalid continuation byte

    I looked in the table aR and no special characters is included in (I did previously suppressed all special characters).

    How I can diagnose where is the problem?

    Edited by Christb
  • Topic Author
  • Posted
    On 1/8/2026 at 8:52 PM, Christb said:

    I am working on a HomeTable creation and averything were OK, homeTable json was registered in my global variable as a string.

    I am also able to display in an HTML table all items of the table(aR') constructed by the QA but when I am trying a tableString=json.encode(aR) I am getting this error:

    HOMETABLE5555]: ...scoop\apps\python\current\Lib\site-packages\lua\init.lua:'utf-8' codec can't decode byte 0xc3 in position 3887: invalid continuation byte

    I looked in the table aR and no special characters is included in (I did previously suppressed all special characters).

    How I can diagnose where is the problem?

    Byte 0xc3 together with the following byte in a string is used to signal utf-8 encoding of a character in a string.

    Typically "foreign language" characters...

    json.encode in plua don't have a problem with ute-8 if they are valid utf-8 codes.

    In your case it sees 0xc3 but the byte following is not valid. 

     

    You say that "homeTable json was registered in my global variable as a string."

    -That means that you managed to encode the string?

    You can try this function to find the string that don't want to be encoded:

    Please login or register to see this code.

     

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