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

keyfob and dimmer switch


SveinW

Question

Hi  I have a fibaro keyfob an a Fibaro Dimmer 2 250W FGD-212

I want to make a scene so that when I press the + button, at the keyfob the light will dim up depending on how long I hold the button and then oposite way.

 

Is there anyone who has a for a solution for this issue?

 

Thank you

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

hi

Pressing and holding the keyfob button cannot dim/brighten the bulb however pressing and letting go can brighten/dim at a set level.

 

 local bright = tonumber(fibaro:getValue(ID,'value'))
  newbright = bright + 5
  fibaro:call(ID,'setValue',newbright)

 

assign the above to the '+' button single press command

so everytime you press the '+' button the brightness of your dimmer increases by 5 in my example.

of course substitute the ID with your device ID

 

you can do the reverse by assigning '-' button and changing the + 5 to -5 for dimming.

 

below is a video to show how to programme in LUA (just in case)

 

(Let me know how it goes i'm not at home to test it)

 

 *** EDIT - it works perfectly fine!  ***

 

 

 

 

 

 

 

Edited by morpheus75
update
Link to comment
Share on other sites

  • 0

Please login or register to see this code.

 

Edited by jgab
missed fibaro:call(id,'setValue',value)
Link to comment
Share on other sites

  • 0
On 10/20/2018 at 5:48 AM, petrkl12 said:

@jgab Is it possible to do it also in your EventRunner scene?

Thanks for asking, found a bug in scripts using table references trying to code it :-) pushed a new version to github for this example to work.

It strikes me as not as "elegant" as the pure Lua version, maybe possible to capture these kind of use cases in a better syntax.

Please login or register to see this code.

However, it is easy to generalize to many keys dimming many different lights, something that one have to solve with multiple version of the Lua script above.

Please login or register to see this code.

or without the scripts and only the Lua event handlers. Then it looks bit more like the original script... but still supporting many keys and many lights.

Please login or register to see this code.

 

Edited by jgab
Link to comment
Share on other sites

  • 0

Thanks for sharing.

It could be perfect to come with special syntax in your framework to solve it. I think it’s a very useful pattern. Thanks!

Link to comment
Share on other sites

  • 0

 

@jgabCould you please add support for following syntax:

 

define('Switches', {101, 102, 103})
rule("#CentralSceneEvent{data={deviceId=Switches}} => d=env.event.deviceID; log('Switch id=%s',d)")

 

now it's with error in function _match

 

Thanks

 

(btw. sorry - it should be in your topic EventRunner - I will add there)

Edited by petrkl12
Link to comment
Share on other sites

  • 0
On 10/18/2018 at 5:13 PM, morpheus75 said:

hi

Pressing and holding the keyfob button cannot dim/brighten the bulb however pressing and letting go can brighten/dim at a set level.

 

 local bright = tonumber(fibaro:getValue(ID,'value'))
  newbright = bright + 5
  fibaro:call(ID,'setValue',newbright)

 

assign the above to the '+' button single press command

so everytime you press the '+' button the brightness of your dimmer increases by 5 in my example.

of course substitute the ID with your device ID

 

you can do the reverse by assigning '-' button and changing the + 5 to -5 for dimming.

 

below is a video to show how to programme in LUA (just in case)

 

(Let me know how it goes i'm not at home to test it)

 

 *** EDIT - it works perfectly fine!  ***

 

 

 

 

 

 

 

How can i do in Fibaro HC Lite?

Link to comment
Share on other sites

  • 0
38 minutes ago, Ananta Creation said:

How can i do in Fibaro HC Lite?

 

hi

unfortunately you cannot code a calculation using blocks and therefore you can allocate a button that sets your light to a specific level only.

eg key 1 presss set the light to 50

key 1 2x press set light to 75

etc

Link to comment
Share on other sites

  • 0

Hi, i thik there is a simpler way, there is a command to stop the in or decrease... (once you start the increase, it increses till the max, so you have to stop it.)

here is a piece of the sample code i use for my smart button on the wall to turn on/of and dim my lights.

........
--start of code
if value.keyId == 1 then -- knop 1 rechts onder is aan: 
    print( "Key1: "..value.keyId, "; Attribute: "..value.keyAttribute )
    if trigger.value.keyAttribute == 'Pressed' then
        fibaro.call(lightidw, 'turnOn')
    end
    if trigger.value.keyAttribute== 'HeldDown' then
        fibaro.call(lightidw, 'startLevelIncrease')--start dimmen
    end
    if trigger.value.keyAttribute== 'Released' then --stop dimmen
        fibaro.call(lightidw, 'stopLevelChange')
    end
.......
Edited by okidoki
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.

×
×
  • Create New...