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


  • 0

fibaro.emitCustomEvent


10der
 Share

Question

 

1
fibaro.emitCustomEvent("TestEvent", {run: true, hello: "Have a nice day"})
 
 
{
    type = "custom-event",
    property = "TestEvent",
    operator = "==",
    isTrigger = true
}

 

[19.05.2020] [10:01:11] [DEBUG] [SCENE30]: {"property":"TestEvent","type":"custom-event", userdata: {run: true, hello: "Have a nice day"}}

 

@A.Socha

 

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0
2 hours ago, 10der said:

 

1
fibaro.emitCustomEvent("TestEvent", {run: true, hello: "Have a nice day"})
 
 
{
    type = "custom-event",
    property = "TestEvent",
    operator = "==",
    isTrigger = true
}

 

[19.05.2020] [10:01:11] [DEBUG] [SCENE30]: {"property":"TestEvent","type":"custom-event", userdata: {run: true, hello: "Have a nice day"}}

 

@A.Socha

 

 

Dang, I missed that option! customEvents will be more useful now....

Link to comment
Share on other sites

  • 0

Doc @10der ! what is going wrong ? 

Please login or register to see this code.

returns me 

Please login or register to see this code.

any idea doc please?

 

I've tried this

Please login or register to see this code.

but got this :

Please login or register to see this code.

Where is my nice day ??

Edited by Tony270570
Link to comment
Share on other sites

  • 0
1 hour ago, Tony270570 said:

Doc @10der ! what is going wrong ? 

Please login or register to see this code.

returns me 

Please login or register to see this code.

any idea doc please?

 

I've tried this

Please login or register to see this code.

but got this :

Please login or register to see this code.

Where is my nice day ??

 

@10der were joking (Or rather wishful thinking).

emitCustomEvent doesn't take a second argument :-( 

  • Thanks 1
Link to comment
Share on other sites

  • 0
  • Inquirer
  • 11 hours ago, jgab said:

    were joking (Or rather wishful thinking).

    emitCustomEvent doesn't take a second argument

    yes. i have trolled @A.Socha cuz adding "user data" it's good idea for us - developers but not Fibaro developers :) 

    Edited by 10der
    Link to comment
    Share on other sites

    • 0
    1 hour ago, jgab said:

    @10der were joking (Or rather wishful thinking).

    ok guys sorry i didn't catched the joke ! :) but yes really usefull indeed, i was looking exactly that, but nop  !

    Anyway already workarounded, not very nice ,worse it stinks but do he job.

    Thx @jgab, @10der please advise on next joke i can take it for a serious discusion ?

     
    Link to comment
    Share on other sites

    • 0
    1 hour ago, Tony270570 said:

    ok guys sorry i didn't catched the joke ! :) but yes really usefull indeed, i was looking exactly that, but nop  !

    Anyway already workarounded, not very nice ,worse it stinks but do he job.

    Thx @jgab, @10der please advise on next joke i can take it for a serious discusion ?

     

    I don't know what your workaround is but be careful

    If you change the userDescription (with api.put) and then emit the event you may have race conditions as you have more than one QA (or several threads within the same QA) that changes the userDescription and only the last change will be picked up the the scenes/QAs listening to the event.

     

    Link to comment
    Share on other sites

    • 0
    1 hour ago, jgab said:

    If you change the userDescription (with api.put) and then emit the event you may have race conditions

    You're right this is exactly what i did, and yes it's subject to race conditions but in my use case (TTS) it will not be used so often and no big deal if i'm loosing an event. 

    And thank you for pointing me out the post about events, I've already read it really appreciate all the explanations given very instructive. Thank you !

    Anyway thank you very much for your advise @jgab really appreciate ! and congrats for the workaround deduction, :) 

     

    Edited by Tony270570
    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
    Answer this question...

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

     Share

    ×
    ×
    • Create New...