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


fibaroExtra


jgab

Recommended Posts

Thenks Jgab, was understandable now :D but still got problems 😅

 

But now I think I need a loop to refresh the quickvars after a button events:

 

I got 2 buttons that sets:

 

Self:setvariable (Var1, 1)

and

self:setvvariable(var2,1)

 

but when I use my debug button at the end of the script I always get the results that the Quickvar had when the QA started. 

function QuickApp:Debug()
self:debug("var1", var1)
self:debug("var2", var2)
end

 

is it a easy fix with the refreshstates? 

 

 

Link to comment
Share on other sites

On 7/16/2023 at 5:24 AM, jgab said:

Please login or register to see this code.

 

Here we trigger on one variable and check the other... 

 

 

May I ask if it is possible to check serval things? like trigger on var A and check Var B, C and D?   
tried the "and" command but didnt work. if I have the syntax i think it is called right tho 😅

 

 

Link to comment
Share on other sites

  • 6 months later...

@jgab

Jan, as i moved all my stuff to ER5, there are only a few things that i cant move, becuase they all need their own UI. They all use fibaroExtra.

The crucial thing is the subscribe functionality in fibaroExtra.

I am using it like this

Please login or register to see this code.

 

What is the most convinient way to get similar approach without fibaroExtra?

Is there any way to pull out only this functionality from fibaroExtra and use it independenlty?

Or any other approach?

The new refreshState subscription kinda doesnt work for me../it doesn't work for custom events i think

Maybe you can assist a bit, how to transform the above example into the new refreshState subscription method if there is no way to cut out this funcionality from fibaroExtra?

 

UPDATE:

Maybe i would go for creating the Subscriber part in my ER5 QA, and there remains the publisher QA, that still requires fibaroExtra for publishing right?

 

 

 

Edited by Neo Andersson
Link to comment
Share on other sites

  • Topic Author
  • 14 hours ago, Neo Andersson said:

    @jgab

    Jan, as i moved all my stuff to ER5, there are only a few things that i cant move, becuase they all need their own UI. They all use fibaroExtra.

    The crucial thing is the subscribe functionality in fibaroExtra.

    I am using it like this

    Please login or register to see this code.

     

    What is the most convinient way to get similar approach without fibaroExtra?

    Is there any way to pull out only this functionality from fibaroExtra and use it independenlty?

    Or any other approach?

    The new refreshState subscription kinda doesnt work for me../it doesn't work for custom events i think

    Maybe you can assist a bit, how to transform the above example into the new refreshState subscription method if there is no way to cut out this funcionality from fibaroExtra?

     

    UPDATE:

    Maybe i would go for creating the Subscriber part in my ER5 QA, and there remains the publisher QA, that still requires fibaroExtra for publishing right?

     

    In ER5 there is fibaro.publish and fibaro.subscribe and there is also ER functions for them

    Please login or register to see this code.

    It should be compatible with fibaroExtra.

    Let me know if you have some problem with it.

    Link to comment
    Share on other sites

    1 hour ago, jgab said:

     

    In ER5 there is fibaro.publish and fibaro.subscribe and there is also ER functions for them

    Please login or register to see this code.

    It should be compatible with fibaroExtra.

    Let me know if you have some problem with it.

    Okay, before i event start to test it...If i get it correctly this approach still requires the other QA to have fibaroextra right? How else would it be able to publish?

     

    Link to comment
    Share on other sites

  • Topic Author
  • 41 minutes ago, Neo Andersson said:

    Okay, before i event start to test it...If i get it correctly this approach still requires the other QA to have fibaroextra right? How else would it be able to publish?

     

    Yes

    • Thanks 1
    Link to comment
    Share on other sites

    3 hours ago, jgab said:

    Yes

    @jgab Jan i got error

     

     

    Please login or register to see this attachment.

     

     

    This is how i set up the rule

    Please login or register to see this code.

     

    Edited by Neo Andersson
    Link to comment
    Share on other sites

  • Topic Author
  • 20 minutes ago, Neo Andersson said:

    @jgab Jan i got error

     

     

    Please login or register to see this attachment.

     

     

    This is how i set up the rule

    Please login or register to see this code.

     

    Yes, there were a couple of bugs after I moved the code to ER5. Pushed v1.04 with some fixes.

    Link to comment
    Share on other sites

    • 1 month later...

    @jgab - how does one use fibaroExtra.lua in a QA? I pasted the latest code into a file in a new QA. Log immediately shows

     

    fibaroExtra.lua:2654: attempt to index a nil value (global 'debug')

     

    If i use the 'installer' method, I don't see this error. I'm trying to work out the difference me downloading the raw file from github vs your installer?

     

    Edited by gurpal2000
    Link to comment
    Share on other sites

    @jgab Hello Jan, i am pretty sure we discussed it somewhere, but i canmt find the toopic.

     

    I have a table ROOMBLINDDATA

     

    I want to create event listeners dynamically for all the luxdevice ids held in that table and when that lux value changes, react with some action.

    I alos need to carry the room object itself to the handler so i can get all the info i need about the room. Can i pass the roomdata into event handler like in the example? Can i just use roomdata = room so it will carra the corresponding roomdata that i can use whe the event is triggered?

     

    Please login or register to see this code.

     

    Edited by Neo Andersson
    Link to comment
    Share on other sites

  • Topic Author
  • 15 minutes ago, Neo Andersson said:

    @jgab Hello Jan, i am pretty sure we discussed it somewhere, but i canmt find the toopic.

     

    I have a table ROOMBLINDDATA

     

    I want to create event listeners dynamically for all the luxdevice ids held in that table and when that lux value changes, react with some action.

    I alos need to carry the room object itself to the handler so i can get all the info i need about the room. Can i pass the roomdata into event handler like in the example? Can i just use roomdata = room so it will carra the corresponding roomdata that i can use whe the event is triggered?

     

    Please login or register to see this code.

     

    You can't add (roomdata = room) to the event. The device event will not have that key and the match will fail.

     

    You can use the roomdata inside the function but there is a Lua issue...  the key and room loop variables will change for every loop so your functions will be left referring to the last room in the loop...

    What you do is that you assign room to a local variable inside the loop. That way every loop a new local variable will be created so that the functions get their own local variable.

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    3 minutes ago, jgab said:

    You can't add (roomdata = room) to the event. The device event will not have that key and the match will fail.

     

    You can use the roomdata inside the function but there is a Lua issue...  the key and room loop variables will change for every loop so your functions will be left referring to the last room in the loop...

    What you do is that you assign room to a local variable inside the loop. That way every loop a new local variable will be created so that the functions get their own local variable.

     

    Please login or register to see this code.

     

    Jan this is not really clear...How to access then the room object data inside the handler? There is nothing that carries room object into the handler..

    Or did i get you wrong?

    Like every room object has several other data, forexample room.luxtreshold, how to access it?

     

    Link to comment
    Share on other sites

  • Topic Author
  • Please login or register to see this code.

    That variable 'room' is a local declared variable inside the loop and will be referenced by the handler function.

    The function creates a "closure" with existing local variables.

    Please login or register to see this link.

     

     

    Link to comment
    Share on other sites

  • Topic Author
  • 1 hour ago, Neo Andersson said:

    @jgab Jan is there a way to use fibaro.cron() for sunrise/sunset ? maybe with help of fibaroExtra?

    Yes, the cron field for minutes and hour can be replaced with sunset/sunrise and minute offset.

    Ex.

    Please login or register to see this code.

     

     

    • Thanks 1
    Link to comment
    Share on other sites

    23 hours ago, jgab said:

    Yes, the cron field for minutes and hour can be replaced with sunset/sunrise and minute offset.

    Ex.

    Please login or register to see this code.

     

     

    Jan it is complaining about sunrise and sunset

     

    Please login or register to see this code.

     

    using it like

     

    Please login or register to see this code.

    fibaroextra version  

     fibaro.FIBARO_EXTRA = "v0.964"
    Edited by Neo Andersson
    Link to comment
    Share on other sites

  • Topic Author
  • 36 minutes ago, Neo Andersson said:

    Jan it is complaining about sunrise and sunset

     

    Please login or register to see this code.

     

    using it like

     

    Please login or register to see this code.

    fibaroextra version  

     fibaro.FIBARO_EXTRA = "v0.964"

    If you use sunset/sunrise the second field must be an offset, not *

    Please login or register to see this code.

    otherwise it would mean something like every possible offset to sunrise, which doesn't make sense...

    • Like 1
    Link to comment
    Share on other sites

    13 minutes ago, jgab said:

    If you use sunset/sunrise the second field must be an offset, not *

    Please login or register to see this code.

    otherwise it would mean something like every possible offset to sunrise, which doesn't make sense...

    ahh okay thanks

    Link to comment
    Share on other sites

    @jgab Jan i am creating event dynamically, on user button press. So if user chages something, the QA should recretae the events. I have noticed, that after recreating the events it triggers one more time on each recreation. Probably i need to cancel, or reset something behind the scenes i suppose. I assigned REF to the event, like ref = fibaro.event..etc and later used fibaro.cancel(ref) before recreating it, but seems that it doesnt help

     

    Please login or register to see this code.

     

    I have tried by referencing the event

     

     

     

    I have installed it from github link

     

    Please login or register to see this code.

     

    Still the same..doesnt help. It triggers as much times as the  createEvent function runs.

     

    I have tried using fibaro.removeEvent

    Please login or register to see this code.

     

    Reproduction:

    1. first run without button press and turning on 3038

    Please login or register to see this image.

    /monthly_2024_03/image.png.c3a946d5b253651ed2473f837d88a079.png" />

    2. after button press and turning on device 3039

    image.png.d6d9c3a58bf699408fbf012f02752b0e.png

    3. After button press and turning on 3038

    [QUICKAPP2772]: Device 3038 triggered

    [QUICKAPP2772]: Device 3038 triggered

     

     

    UPDATE:

    I have managed to get rid of increiasing triggers after dynamically recreating an event using this function

    Please login or register to see this code.

     

    Is this the right apporach, or is there any more trivial one?

     

    OTHER NOTICE

    Also noticed that fibaro extra is loaded twice for some reason

    image.png.25089afa955de2a558a2831ec3d58c48.png

     

    Can this be somethiing similar to ghosts in ER5?

    Edited by Neo Andersson
    Link to comment
    Share on other sites

    @jgab Jan is there a way to retrive all the existing cronJobs ?

    I see in fibaroExtra that they are stored in a local jobs table. Can we somehow get them? 

    Link to comment
    Share on other sites

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