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
Question
knuth 27
I have used a LUA script which is triggered by pushing the switch 2 on a Fibaro switch. Depending on whether the key is pushed once, twice or held, I control another device (a light) according to set rules. How the key is pushed, is found by the variable pressSource = fibaro:getSourceTrigger().event.data. This solution has been used previously by several contributors on the forum.
My current code looks like this (only first part shown):
I now want to add a second trigger, i.e. another Fibaro switch being pushed. Depending on which switch is used, I want different lights to be adjusted. Below is my first edit (still incomplete). In line 5, the new trigger 494 is added. How do I know if the scene was triggered by 394 or 494? The answer is probably in fibaro:getSourceTrigger(), but I cannot find the complete specification for this function documented anywhere. Specifically:
- How do I find whether 394 or 494 was the trigger? The syntax trigger.event.id in line 14 is my guest guess. What is correct?
- Once I have the right triggerID, I can easily make the variable ledID dependent on triggerID, by having two related lists (arrays): {394, 494} for the triggers and {306, 406} for the corresponding LED lights. This needs to be implemented in line 18.
Can anyone please provide a more complete specification for the data returned by fibaro:getSourceTrigger in HC2, and show me how I can use it to implement double triggers? Or are you all too busy converting to HC3?
PS: I have simplified this to TWO triggers. In reality I want to have several more. But if I can do two, I can do any number.
Link to comment
Share on other sites
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.