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

    That's new . what AOS version you are running?

    Posted
    On 12/12/2025 at 9:00 PM, cag014 said:

    That's new . what AOS version you are running?

    11.0

  • Topic Author
  • Posted

    Since the jM lines are part of the code I am unable to find the error

    Could you please post the error line 1807 as shown in your post?

    Posted
    18 hours ago, cag014 said:

    Since the jM lines are part of the code I am unable to find the error

    Could you please post the error line 1807 as shown in your post?

    The nearest and last backup of AOS was 2025-12-16. Because a did a number of changes after this date I have not precisely knowledge of the linenumber of the start of your system at the time of the problem. In these last backup of 2025-12-16 the linenumber of --========================== USER DEFINED FUNCTIONS =============================== is 1000.

    The change of number of linenumbers between 2025-12-11 and 2025-12-16 could be about 30 lines or more (and not less), so line --========================== USER DEFINED FUNCTIONS =============================== could be between 1010 and 1030.  I show now the lines 2798 until 2858:

     function initTable(callType)
      local cTime,dType,devNum,delSpace,i,j,jv,k=os.date("%H:%M",os_time()),"devices",0,{"property","state","timeSlot"},0,0,"",0
      getIntValue();jGps.user={};jGps.data={};jGps.ios={}; if not gpsDevice then gpsDevice={} end 
      for _,j in ipairs(fibaro:getDevicesId({roomID=0,type="iOS_device"})) do tmpStr=rF
         if tostring(api.get("/devices/"..j)["properties"]["Push"])=="true" then jv=jv..j..","; tmpStr="<font color=darkgreen>" end 
         noteList.sendPush[tostring(j)]=tmpStr..fibaro:getName(j)..eF end 
      if not pushNote[2] or not pushNote[2]:match("%d+") then pushNote[2]=","..jv end
      for _,j in ipairs(api.get("/users/")) do noteList.sendEmail[tostring(j.id)]=j.name..":"..j.email:gsub(j.name,"");jGps.user[tostring(j.id)]=j.name:match("%w+") end 
      if not eMail[2] or eMail[2]:len()==0 then eMail[2]="2" end
      if callType=="getUsers" then return end
      initMode=true;fibaro:debug(ygF.."Gathering "..wF..api.get("/settings/info/")["hcName"].." - "..api.get("/settings/info/")["serialNumber"].."</font> system information...</font>") 
      for i,j in pairs(api.get("/panels/location")) do 
        jGps[tostring(j.id)]=j; jGps[tostring(j.id)].address="address"..j.id
        if j.home==true then jGps.data={timestamp=os.time(),geofenceAction="NA",userId=2,deviceId=999,locationId=j.id} end 
      end 
      jIcons=api.get("/proxy?url=http://127.0.0.1:11111/api/icons")
      local dp=api.get("/devices/")
      for i,j in pairs(dp) do 
        j.id=tostring(j.id);jDid[j.id]={}
        jDid[j.id].name=j.name;jDid[j.id].idType="Z.Device"
        jDid[j.id].enabled=j.enabled
        if j.type=="iOS_device" then jGps.ios[tostring(j.id)]=j.name end 
        jDid[j.id].room=(j.roomID==0 and "Unassigned" or api.get("/rooms/"..j.roomID)["name"])
        if tostring(j.properties.dead)=="true" and j.enabled then 
            gData.numDeads=gData.numDeads+1
            jF[j.id]=jF[j.id] or {total=1,reason={"onInit"..os.date(" %d %b %H:%M",os_time())},enabled=true,nack=0,id=inId,dead=true} 
        end
        jDlist["cmd"..j.id]=tableSortByKey(j.actions,"primeSort")   
        if j.parentId and j.properties.nodeId and j.id~="1" then 
          if j.parentId>1 or j.remoteGatewayId>0 then jDlist["numDev"]=jDlist["numDev"]+1;jDlist[j.id]=j.properties.nodeId;jDlist["nId"..jDlist[j.id]]=os_time()
          else jDlist["pId"..j.properties.nodeId]=j.id;jDlist["mId"..j.id]=true;jDlist["phDev"]=jDlist["phDev"]+1 if j.properties.batteryLevel then jDlist["batDev"]=jDlist["batDev"]+1 end end end 
        if j.isPlugin then jDid[j.id].idType="Plugin";jDlist[j.id]="plugIn";jDlist["plugIn"]=jDlist["plugIn"]+1;jDlist.pinId=jDlist.pinId..","..j.id.."," end
        if j.type=="virtual_device" then jDid[j.id].idType="V.Device";jDlist[j.id]="vd";jDlist["vDev"]=jDlist["vDev"]+1;jDlist.vdId=jDlist.vdId..","..j.id.."," end
      end --for i,j in pairs(api.get("/devices/"))
      for i,j in pairs(api.get("/scenes")) do 
          jDid["_"..j.id]={};jDlist["scenes"]=jDlist["scenes"]+1
          jDid["_"..j.id].name=j.name; jDid["_"..j.id].room=(j.roomID==0 and "Unassigned" or api.get("/rooms/"..j.roomID)["name"]) 
          jDid["_"..j.id].idType=j.type:gsub("com.fibaro.","")
          if j.autostart==true  and j.runConfig=="TRIGGER_AND_MANUAL" then jDid["_"..j.id].idType="Auto-"..jDid["_"..j.id].idType end
      end
      prtLine(ygF.."Initializing jS2n{}, jP2n{}, global and userKeyWord{} tables...</font>") 
      if not jM or type(jM[1])~="table" then sceneAbort("(40) "..rF.."Attempt to access jM hash table (a nil value)"..eF,{"not defined"},{".jM hash table","See error below"}) end 
      if #userKeyWord[1]~= #userKeyWord[2] then sceneAbort("(41) Number of elements in array doesn't match. <br>Array 1 has '<font color=wheat>"..#userKeyWord[1].." elements</font>'<br>"..json.encode(userKeyWord[1]).."<br>Array 2 has '<font color=wheat>"..#userKeyWord[2].." elements</font>'<br>"..json.encode(userKeyWord[2]),{"not defined"},{".userKeyword table:","See error below"}) end
      for i=1,#userKeyWord[1] do if userKeyWord[1][i]:sub(1,1)~="$" then sceneAbort("(42) keyword '"..wF..userKeyWord[1][i]..eF.."' missing prefix sign'<font color=wheat>$</font>'.",{userKeyWord[1][i]},{".userKeyword table:",json.encode(userKeyWord[1])}) end end 
      parseCmd();jmNum=tostring(#jM):len()
      for j=1,#jM do         
         if type(jM[j][1])~="number" then table.insert(jM[j],1,0) end 
         if jM[j][3] then
            for i=1,#task.state do
              if jM[j][3][task.state[i]]~=nil then 
                  if type(jM[j][3][task.state[i]])~="table"  then jM[j][3][task.state[i]]={jM[j][3][task.state[i]]} end 
                  if type(jM[j][3][task.state[i]][1])~="string" then assertType("(104)",jM[j][3][task.state[i]][1],task.state[i],"string",j) end
                  if not tostring(jM[j][3][task.state[i]][1]):find("%b{}") then   
                      sceneAbort("(105) Syntax error in "..wF..task.state[i]..eF.." statement: "..wF..tostring(jM[j][3][task.state[i]][1])..eF.."<br>Please review and fix.",
                      {tostring(jM[j][3][task.state[i]][1]),task.state[i]},j) end
              end
            end 
          end --if jM[j][3] then / for i=1,#task.state do
         jM2n[j]="{"..irF..jM[j][1].."</font>, <font color=darkgrey>\""..jM[j][2].."\"</font>...}"
         jM[j][2]=jM[j][2]:gsub("[%s+]? and [%s+]?","|");jM[j][2]=jM[j][2]:gsub("[%s+]?,[%s+]?","|") 
      end -- for j=1,#jM do  
     

    I hope this information will be enough to determine the problem.

     

    Posted

    Hello everyone,
    Could I ask for help with a problem sending PUSH messages? After updating the QuickApp AOQ system to version 20.7, the sendPush field in the jM table in the user_data tab was working, but suddenly it stopped, and the system displays a message in the debugger that this function is missing. I've read that the API parameters have changed (please note that I'm not a programmer) and I don't know how to resolve this.

    I'm attaching a fragment of the jM table and a screenshot from the debugger.

    Best regards, and I'm asking for help....

    Please login or register to see this attachment.

    Please login or register to see this attachment.

  • Topic Author
  • Posted (edited)

    fibaro.alert) has been changed in a new version.

    I will release a new AOQ version today with the fix

     

    Meanwhile you can use attached version below

    Please login or register to see this attachment.

     

    Edited by cag014
    Posted (edited)

    Great - thank you very much for the quick response :), your script is great...

    Regards, Darek

    Edited by dareszek
    Posted

    Hi @cag014

    After updating to the newest version it complains about below row:

    {0, " $blank",{timeSlot="true ?$sunsetHour?, false ?$sunriseHour?",
    trueAct={"&IsDayTime", "setGlobal", "false"}, falseAct={"&IsDayTime", "setGlobal", "true"}}},
     
    [DEBUG] [AOQ3694]: Parsing jM{32} hash table data...[2025-12-24] [09:11:35] [ERROR] [AOQ3694]:  [24 Dec 09:11:30] AOQ369421.7 jM hash table:29:~: {0,' $blank', {......
    {0,"$blank",{falseAct={"&IsDayTime","setGlobal","",false,true},timeSlot="true?$sunsetHour?,false?$sunriseHour?",trueAct={"&IsDayTime","setGlobal","false"}}}

    (18) Action's 3rd field in 'setGlobal' is empty.
    Field should include action's valid data.


    [2025-12-24] [09:11:35] [WARNING] [AOQ3694]: QA is terminated. Please refer to Advanced User’s Guide for more information.... and restart AOQ
  • Topic Author
  • Posted

    It's strange that it worked before.

    What do you mean by {"&IsDayTime","setGlobal", "", false,true} - The data field is empty, which is incorrect.

    The correct format of the action should be

    {"&IsDayTime","setGlobal","false",true}

     

    Command format:

    • param1: global variable name or list of names 

    • param2: action (always setGlobal).

    • param3: value to assign.

     

    Posted

    So, instead of

    "&IsDayTime","setGlobal","false"}

    it should then be

    "&IsDayTime","setGlobal","false",true}

    ?

  • Topic Author
  • Posted

    no 

    instead of

     

    {"&IsDayTime","setGlobal", "", false,true} 

    should be

    {"&IsDayTime","setGlobal", "false"}

     

    the 4th parameter true forces the command to run on init

    By default setGlobal runs on init , so true is meaning less 

    Posted

    Thanks @cag014 (You dont need to answer today since it christmas!)

     

    The problem is that i dont have {"&IsDayTime","setGlobal", "", false,true} , even though the error message says that..

     

    This is the line i have (that doesnt work now):

    {0," $blank",{timeSlot="true ?$sunsetHour?, false ?$sunriseHour?",trueAct={"&IsDayTime","setGlobal","false"}, falseAct={"&IsDayTime","setGlobal","true"}}},
    Posted

    Please login or register to see this attachment.

  • Topic Author
  • Posted (edited)

    Thank you for finding the bug.

    Please try attached version

    Please login or register to see this attachment.

     

    Let me know if it works and I'll release it in the forum

    Edited by cag014
    • Like 1
    Posted

    Now it works!

     

    Thanks @cag014!

    • Thanks 1
    Posted

    The problem was active again 🤢

     

    [DEBUG] 12:30:50: jM{55}T  Beveiliging:449:SmartIn2[8.59>8] ➯ if lineState{&tSlotUitgeschakeld=Nee} then
    [DEBUG] 12:30:50: jM{55}T  Beveiliging:449:SmartIn2[8.59>8] ↪   setGlobal(&tSlotUitgeschakeld, Ja)
    [DEBUG] 12:30:50: 2025-12-22 12:30:50.528712 [ fatal] LUA error: /opt/fibaro/scenes/451.lua:1815: attempt to perform arithmetic on a nil value

     

    Line 1815:

    jTime[tName]={orgData,(jTime[tName] and timer:find("[+-]") and jTime[tName][2]+tonumber(timer) or os_time()+tonumber(timer)),devId..":"..tName,(jTime[tName] and jTime[tName][4] or os_time())}

     

     

     

  • Topic Author
  • Posted

    Could you please post the jM line?

    looks like the line includes timer....

     

    Posted (edited)

    ng(mStr):gsub("[%(%+%-%*/@&%$]", function (a) return a.."%" end) end
     function setTimer(actData,devId,act1,act2,act3,orgData,devStr,cmdStr)
        local dact3,tName,timer=actData[3]:match("timer%S.*,[+-x]?(%b??)"),act3:match("(timer%S+,)([%d+-x]+)")
        if dact3 and jD[devId].dbgCalc then 
            dact3=" "..doTheMath(dact3,devId,"parse"):gsub(" ",""):gsub("<[/]?mark[%d+]?>",""):gsub(".-<small>",vF.."?"):gsub("</small>","").."?"..eF
            dact3=dact3:gsub("[$&]:",function(a) return a:sub(1,-2) end)
        else dact3="" end
        tName,timer=act3:match("(timer%S+,)([%d+-x]+)")
        timer=timer:lower():sub(1,1)=="x" and "x" or timer
        act3=act3:gsub("(timer%S.-,.*)",""):gsub("^%s*(.-)%s*$", "%1")
        orgData[3]=orgData[3]:gsub("(timer%S.-,.*)",""):gsub("^%s*(.-)%s*$", "%1")
        if (act2=="setTimer" or timer:find("[+-]")) and not jTime[tName] and timer~="x" then 
            lastAct(trueFalseColor[false]..devStr..act2..qrF..(act2=="setTimer" and "" or " aborted").."{"..tName..timer.." is not active}</font></sup></font>",devId,fibaro.error)
        else 
            if timer=="x" then
                lastAct(trueFalseColor[true]..devStr..cmdStr.."{"..(jTime[tName] and ygF or lpF).."cancel "..tName:sub(1,-2)..eF.."}</sup></font>",devId)
                jTime[tName]=nil;onTimer=onTimer:gsub(tName,"") 
            else
                onTimer=onTimer..(onTimer:find(tName) and "" or tName) 
                tmpNum=timer:find("[+-]") and cF..jTime[tName][2]-os.time()..eF..timer or timer
                if act2=="setTimer" then 
                    tmpNum=(timer=="+0" and jTime[tName][2]-os.time() or tmpNum)
                    jTime[tName][2]=(timer:find("[+-]") and jTime[tName][2]+tonumber(timer) or os_time()+tonumber(timer))
                    if actData[1]:match("%b{}") then jTime[tName][1][4]=actData[1] end
                    lastAct(trueFalseColor[true]..devStr..act2.."{"..ygF..tName..tmpNum.."s"..eF..dact3..(#actData[1]>0 and " 🔛<font color=#9ACD90>"..parsDev(actData[1]):gsub(":value","")..eF or "").."</font>}</sup></font>",devId)
                else 
                    jTime[tName]={orgData,(jTime[tName] and timer:find("[+-]") and jTime[tName][2]+tonumber(timer) or os_time()+tonumber(timer)),devId..":"..tName,(jTime[tName] and jTime[tName][4] or os_time())} 
                    lastAct(trueFalseColor[true]..devStr..act2.."{"..ygF.."*"..parsDev(actData[1],act3).."*"..eF.."}</sup></font>"..vF.." by "..eF..grF..tName..tmpNum.."s "..dact3.."</font>",devId)
                end
            end 
        end
      end --==================================== setTimer 

     

    line 1815 :

    jTime[tName]={orgData,(jTime[tName] and timer:find("[+-]") and jTime[tName][2]+tonumber(timer) or os_time()+tonumber(timer)),devId..":"..tName,(jTime[tName] and jTime[tName][4] or os_time())} 

    Edited by Rover
  • Topic Author
  • Posted

    I mean jM line that has the timer command.... 

    for example:

    {,"sensor", state="true", falseAct={"light","turnOff","timerTest,30"}}},

    Posted (edited)

    After the Update, my log if flooded with these lines, can you help? 

    aoqVer=21.8

     

    [28.12.2025] [14:32:12] [ERROR] [QUICKAPP98]: QuickApp crashed

    [28.12.2025] [14:32:12] [ERROR] [QUICKAPP98]: main.lua:4769: attempt to concatenate a nil value (local 'newValue')

    Edited by PSi

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