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


HC3 QuickApps coding - tips and tricks


jgab

Recommended Posts

2 minutes ago, jgab said:

No the last call's argument is not a table. 

table.unpack takes a table (array) of arguments and "unpacks" them as arguments to the call. So it's still correct.

From the scene we don't send any tables.

but Skrivebord still doesn't respond?

 

 

Ohhh .... ? i am very embarrassed ? - After yesterday, testing the ZONES - i have a dublicate name for a Zone an a Bulb.

Running the test for 883 (the Bulb) - 

All test completed Successfull

[12.11.2020] [16:07:42] [DEBUG] [SCENE121]: Testing device 883
[12.11.2020] [16:07:42] [DEBUG] [SCENE121]: Turning off device
[12.11.2020] [16:07:45] [DEBUG] [SCENE121]: Toggle, should turn on
[12.11.2020] [16:07:48] [DEBUG] [SCENE121]: Setting brightness to 50%
[12.11.2020] [16:07:51] [DEBUG] [SCENE121]: Setting brightness to 100%
[12.11.2020] [16:07:54] [DEBUG] [SCENE121]: Setting brightness to 25%
[12.11.2020] [16:07:57] [DEBUG] [SCENE121]: Brightness transition to 100% for 5s

 

Please login or register to see this image.

/monthly_2020_11/image.png.a7843ab61e97f48e90a99ff076c7f4a2.png" />

 

1 minute ago, ChristianSogaard said:

 

Ohhh .... ? i am very embarrassed ? - After yesterday, testing the ZONES - i have a dublicate name for a Zone an a Bulb.

Running the test for 883 (the Bulb) - 

All test completed Successfull

[12.11.2020] [16:07:42] [DEBUG] [SCENE121]: Testing device 883
[12.11.2020] [16:07:42] [DEBUG] [SCENE121]: Turning off device
[12.11.2020] [16:07:45] [DEBUG] [SCENE121]: Toggle, should turn on
[12.11.2020] [16:07:48] [DEBUG] [SCENE121]: Setting brightness to 50%
[12.11.2020] [16:07:51] [DEBUG] [SCENE121]: Setting brightness to 100%
[12.11.2020] [16:07:54] [DEBUG] [SCENE121]: Setting brightness to 25%
[12.11.2020] [16:07:57] [DEBUG] [SCENE121]: Brightness transition to 100% for 5s

 

Please login or register to see this link.

 

So this can dimm

 fibaro.call(id,"setValue",json.encode({bri=254,transitiontime=50}))
 
But this still have an issue 

 

  if keyMap[key.keyId] and keyMap[key.keyId][key.keyAttribute] then
    local params = keyMap[key.keyId][key.keyAttribute]
    if type(params)=='function' then params = params(key.keyId,key.keyAttribute) end
    fibaro.debug(tag,"Calling ",keyMap[key.keyId].deviceID," Params:",json.encode(params))
    fibaro.call(keyMap[key.keyId].deviceID,table.unpack(params))
  end
 
 
Link to comment
Share on other sites

  • Topic Author
  • 7 minutes ago, ChristianSogaard said:

     

    Ohhh .... ? i am very embarrassed ? - After yesterday, testing the ZONES - i have a dublicate name for a Zone an a Bulb.

    Running the test for 883 (the Bulb) - 

    All test completed Successfull

    [12.11.2020] [16:07:42] [DEBUG] [SCENE121]: Testing device 883
    [12.11.2020] [16:07:42] [DEBUG] [SCENE121]: Turning off device
    [12.11.2020] [16:07:45] [DEBUG] [SCENE121]: Toggle, should turn on
    [12.11.2020] [16:07:48] [DEBUG] [SCENE121]: Setting brightness to 50%
    [12.11.2020] [16:07:51] [DEBUG] [SCENE121]: Setting brightness to 100%
    [12.11.2020] [16:07:54] [DEBUG] [SCENE121]: Setting brightness to 25%
    [12.11.2020] [16:07:57] [DEBUG] [SCENE121]: Brightness transition to 100% for 5s

     

    Please login or register to see this link.

     

    So this can dimm

     fibaro.call(id,"setValue",json.encode({bri=254,transitiontime=50}))
     
    But this still have an issue 

     

      if keyMap[key.keyId] and keyMap[key.keyId][key.keyAttribute] then
        local params = keyMap[key.keyId][key.keyAttribute]
        if type(params)=='function' then params = params(key.keyId,key.keyAttribute) end
        fibaro.debug(tag,"Calling ",keyMap[key.keyId].deviceID," Params:",json.encode(params))
        fibaro.call(keyMap[key.keyId].deviceID,table.unpack(params))
      end
     
     

    Can you post the whole scene as it looks now?

    Link to comment
    Share on other sites

  • Topic Author
  • Can you try to change the scene setting "Allow to restart a running scene" to No.

    It could be that the scene is triggered multiple times and kills the running scene that tries to make the calls?

    Please login or register to see this attachment.

    1 minute ago, jgab said:

    Can you try to change the scene setting "Allow to restart a running scene" to No.

    It could be that the scene is triggered multiple times and kills the running scene that tries to make the calls?

    Please login or register to see this attachment.

     

     

    The same scene works for me but I'm not using the Matrix but a Fibaro keyfob - but that's the only difference that I can see.

    Link to comment
    Share on other sites

    9 minutes ago, jgab said:

    Can you try to change the scene setting "Allow to restart a running scene" to No.

    It could be that the scene is triggered multiple times and kills the running scene that tries to make the calls?

    Please login or register to see this attachment.

     

    I tested that, but no success

     

    Please login or register to see this image.

    /monthly_2020_11/image.png.73eefd6c9bc91ec3d63aa01fae538793.png" />

     

    But Double Click (Set 99% )- dont work. and thats only one command

     

    Så this is not working from the scene

    [12.11.2020] [16:42:36] [DEBUG] [SCENE119]: KeyId: 4 KeyAttr: Pressed2
    [12.11.2020] [16:42:36] [DEBUG] [SCENE119]: Calling 923 Params: ["setValue",99] 

    Edited by ChristianSogaard
    Link to comment
    Share on other sites

    14 minutes ago, jgab said:

    Can you try to change the scene setting "Allow to restart a running scene" to No.

    It could be that the scene is triggered multiple times and kills the running scene that tries to make the calls?

    Please login or register to see this attachment.

     

     

    The same scene works for me but I'm not using the Matrix but a Fibaro keyfob - but that's the only difference that I can see.

    It looks like its only being triggered once.

     

    Please login or register to see this attachment.

     

    Link to comment
    Share on other sites

  • Topic Author
  • 3 minutes ago, ChristianSogaard said:

    It looks like its only being triggered once.

     

    Please login or register to see this attachment.

     

    Lamp "Sort bestlite" seems to get a "Increase level" and "Stop level change" within 4s. (33-37). 

    It does turn on? If it needs to turn on it takes a second or two and then it starts to dim up - then I wonder if 4s is enough for you to see a change.

    If you do a double click does it log a setValue and then the lamp being 100% ?

     

    I changed my scene to use the Matrix and it still works.

    Link to comment
    Share on other sites

    3 minutes ago, jgab said:

    Lamp "Sort bestlite" seems to get a "Increase level" and "Stop level change" within 4s. (33-37). 

    It does turn on? If it needs to turn on it takes a second or two and then it starts to dim up - then I wonder if 4s is enough for you to see a change.

    If you do a double click does it log a setValue and then the lamp being 100% ?

     

    I changed my scene to use the Matrix and it still works.

     

    For "Sort Best" light

    Bulb starts OFF - Press and Hold - after 2-3 sec Bulbs turns on 100% - No transision.

    Bulb starts on 1 % - Press and Hold - dimming works - transision 10 sec - very smooth

    Bulb starts on 100 % - Press and Hold - NO dimming

    Bulb starts on 99 % - Press and Hold - NO dimming

    Link to comment
    Share on other sites

  • Topic Author
  • 14 minutes ago, ChristianSogaard said:

     

    For "Sort Best" light

    Bulb starts OFF - Press and Hold - after 2-3 sec Bulbs turns on 100% - No transision.

    Bulb starts on 1 % - Press and Hold - dimming works - transision 10 sec - very smooth

    Bulb starts on 100 % - Press and Hold - NO dimming

    Bulb starts on 99 % - Press and Hold - NO dimming

     

    To dim down you need to send ''startLevelDecrease'. Have you bound that to any button?

    Ok, so if the bulb is off I turn on and then start to dim up. Just turning on will restore the old value. I will start up with bri=1 of course.

    I will release a v1.10 soon.

    Link to comment
    Share on other sites

    3 minutes ago, jgab said:

     

    To dim down you need to send ''startLevelDecrease'. Have you bound that to any button?

    Ok, so if the bulb is off I turn on and then start to dim up. Just turning on will restore the old value. I will start up with bri=1 of course.

    I will release a v1.10 soon.

     

    I assumed ??  there was a toggle function in the Dimming - so when I "Hold Stop" and again "Hold Start"  it would reverse dimming - like HUE does native

    I updated the Scene  - and now it can Dim Down as well - smooth.

     

    start up with bri=1, wouldn't that ruin the possibility to dimm from eg. 33 or 75%  =

     

     

    Please login or register to see this code.

     

     

     

     

    Link to comment
    Share on other sites

  • Topic Author
  • 2 minutes ago, ChristianSogaard said:

     

    I assumed ??  there was a toggle function in the Dimming - so when I "Hold Stop" and again "Hold Start"  it would reverse dimming - like HUE does native

    I updated the Scene  - and now it can Dim Down as well - smooth.

    start up with bri=1, wouldn't that ruin the possibility to dimm from eg. 33 or 75%  =

     

    I only turn on with bri=1 if the bulb was off. If it was on I start at the current level.

    I think that is the most intuitive approach.

    Uploaded v1.10

     

    You could implement reverse dimming but you need to keep track if the last command was a dim and in what direction

    • Like 1
    Link to comment
    Share on other sites

    6 minutes ago, jgab said:

     

    I only turn on with bri=1 if the bulb was off. If it was on I start at the current level.

    I think that is the most intuitive approach.

    Uploaded v1.10

     

    You could implement reverse dimming but you need to keep track if the last command was a dim and in what direction

    ??? I just love 1.10 - Smooth dimming, toggle, turn On/off - just works awsome.

    For reverse dimming - is the other way that with a global Variable? - to remember DIM direction?

    I like the two button system - but have learned people are different ;-) and for some situations - one button control is needed.

     

     

     

     

     

    Just now, ChristianSogaard said:

    ??? I just love 1.10 - Smooth dimming, toggle, turn On/off - just works awesome.

    For reverse dimming - is there another way besides a global Variable? - to remember DIM direction? - i should be in the QA ?

    I like the two button system - but have learned people are different ;-) and for some situations - one button control is needed.

     

    I will start test on the ZONES ;-) i never finished that ...

     

     

     

     

    Link to comment
    Share on other sites

    42 minutes ago, jgab said:

     

    I only turn on with bri=1 if the bulb was off. If it was on I start at the current level.

    I think that is the most intuitive approach.

    Uploaded v1.10

     

    A small wish - when I dimm down - it seems that the bulb ends a 1%.

    Its probably a thing for discussion. But I like it better ending a 0% - like turn off.

    And if you press "toggle" after this - what should the start value for the bulb be ? - i think it should start on 1%.

     

    another thing.

    If you Bulb is off - and "Double Click" = 'setValue',99 - it dont turn on the Bulb. 

    "Double Click" = 'setValue',99 only works if the Bulb already is turned on 

     

     

     

     

       

    Link to comment
    Share on other sites

  • Topic Author
  • 29 minutes ago, ChristianSogaard said:

    A small wish - when I dimm down - it seems that the bulb ends a 1%.

    Its probably a thing for discussion. But I like it better ending a 0% - like turn off.

    And if you press "toggle" after this - what should the start value for the bulb be ? - i think it should start on 1%.

     

    another thing.

    If you Bulb is off - and "Double Click" = 'setValue',99 - it dont turn on the Bulb. 

    "Double Click" = 'setValue',99 only works if the Bulb already is turned on 

     

     

     

     

       

    Good ideas - will fix tomorrow.

    • Like 1
    Link to comment
    Share on other sites

  • Topic Author
  • On 11/12/2020 at 7:16 PM, jgab said:

    Good ideas - will fix tomorrow.

    Ok uploaded v1.11 that turns on the light if setValue > 0

    The idea that the light should be turned-off when dimming down may work for some. The problem I see is that some lights have a lowest dim-level that is still quite high so it feels like a quite abrupt turn-off end the end of the dim. Myself I prefer to dim down to bri=1 and then press once more to turn off (toggle)

    Anyway, if you want to experiment with it set the quickAppVariable 'dim2off' to true.

     

    Link to comment
    Share on other sites

    4 minutes ago, jgab said:

    Ok uploaded v1.11 that turns on the light if setValue > 0

    The idea that the light should be turned-off when dimming down may work for some. The problem I see is that some lights have a lowest dim-level that is still quite high so it feels like a quite abrupt turn-off end the end of the dim. Myself I prefer to dim down to bri=1 and then press once more to turn off (toggle)

    Anyway, if you want to experiment with it set the quickAppVariable 'dim2off' to true.

     

    I’ll test ?

    Just now, ChristianSogaard said:

    I’ll test ?

    Would you also look into a optional one button solution ? With memory of dim direction?

    Link to comment
    Share on other sites

    1 hour ago, jgab said:

    Ok uploaded v1.11 that turns on the light if setValue > 0

    The idea that the light should be turned-off when dimming down may work for some. The problem I see is that some lights have a lowest dim-level that is still quite high so it feels like a quite abrupt turn-off end the end of the dim. Myself I prefer to dim down to bri=1 and then press once more to turn off (toggle)

    Anyway, if you want to experiment with it set the quickAppVariable 'dim2off' to true.

     

    For 1.11

    Thank you for adding these features ?

    "Double Click" to 100% af after dim down ?  works

     dim2off = true - i think it kicks in too fast, if dimtime = 10. if i press Hold for 2-3 sec starting from 100%, its ends up turning off the bulb

    dim2off = false - , if dimtime = 10 i can stop after 8-9 sec, and can still dimm a little in second time I press Hold.

    Link to comment
    Share on other sites

    @10der

    The very nice SonosHub QA is not working anymore:

    Please login or register to see this spoiler.

    I did not change anything in the QA. It was working all the time till now...

    Please help @10der ?

    Edited by Rover
    Link to comment
    Share on other sites

    2 hours ago, Rover said:

    @10der

    The very nice SonosHub QA is not working anymore:

    Please login or register to see this spoiler.

     

    dear Rover this issue I can't fix. This issues sometimes occured also for me.

    only reboot (Noooooooooooooooo) :D can solve this issue.

    do not change anything just reboot.

    another way (lol also) just copy / paste all code from my QA to a new one.

    crazy? yes.

     

     

    @petergebruers check this :) Ha ha? no. it's no ha ha :(

    Link to comment
    Share on other sites

    32 minutes ago, 10der said:

     

    I can't fix. This issues sometimes occured also for me.

    only reboot (Noooooooooooooooo) :D can solve this issue.

     

    ehm honestly, there is one thing i really hate: bad (or crashing) code and statement "can't fix, it's software, do reboot". If you know there is issue with your code, fix it or remove it or add warrning to the posting/place where the code is located/into the updated code. Just respect users, installers and support - crashing code (without any information about know bug) produce tons of frustrating support/debug hours, for everybody. It's not against you, it's against "i don't care, my crashing code must be Fibaro fault"

     

    32 minutes ago, 10der said:

    crazy? yes.

     

    not it's not, if part of the code produce kind of memory leak, overflow, process kill, only reboot will help.

     

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