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

CentralSceneEvent / getSourceTrigger


JWoofer

Question

I had a scene for turning on the lights by using GetSourceTrigger (Pressed, Pressed2, Pressed3 etc.) on the FGS-223.  This is offcourse not working anymore in HC3. I'm not so good with using LUA so I can't figure out how this work in HC3 LUA. Is there anyone that can give me a help by reating one example for LUA HC3? I have added the LUA script from HC2 as how it used to work. 

Please login or register to see this attachment.

Link to comment
Share on other sites

Recommended Posts

  • 0
ZRC-90
 

Please login or register to see this code.

 

 

Please login or register to see this code.

 

Edited by 10der
  • Like 1
Link to comment
Share on other sites

  • 0

I have tried this code to fit my remote but cant figure out why it doesn't work. The ID of my remote is 599.

 

The conditions used are:

 

{
  conditions = { {
        type = "device",
        id = 599,
        property = "centralSceneEvent",
        operator = "!=",
        value = {},
        isTrigger = true,
    } },
  operator = "all"
}
 
The main commands:
 
jT = json.decode((fibaro.getGlobalVariable("HomeTable")))
 
function toggleDevice(item)
    local id = jT[item]
    local value = fibaro.getValue(id, "value")
    print(value)
    if value then
        fibaro.call(id, "turnOff")
    else
        fibaro.call(id, "turnOn")
    end
end
 
function OffDevice(item)
    local id = jT[item]
    local value = fibaro.getValue(id, "value")
    print(value)
    if value then
        fibaro.call(id, "turnOff")
    end
end
 
-- {"type":"device","id":599,"value":{"keyId":1,"keyAttribute":"Pressed"},"property":"centralSceneEvent"}
 
local value = sourceTrigger.value
if value.keyId == 1 then
    fibaro.debug("MINIMOTE""1")
elseif value.keyId == 2 then
    fibaro.debug("MINIMOTE""2")
elseif value.keyId == 3 then
    fibaro.debug("MINIMOTE""3")
elseif value.keyId == 4 then
    fibaro.debug("MINIMOTE""4")
elseif value.keyId == 5 then
    fibaro.debug("MINIMOTE""5")
elseif value.keyId == 6 then
    fibaro.debug("MINIMOTE""6")
elseif value.keyId == 7 then
    fibaro.debug("MINIMOTE""7")
elseif value.keyId == 8 then
    fibaro.debug("MINIMOTE""8")
 
else
    fibaro.debug("MINIMOTE""ERROR")
end
 
--  {"property":"centralSceneEvent","id":599,"type":"device","value":{"keyId":1,"keyAttribute":"Pressed"}}
 
I get a run error - do I need to create a variable called HomeTable to make this work? - I did try this but then received the error message 
[18.05.2020] [07:05:37 pm] [ERROR] [SCENE33]: (load):26: attempt to index a nil value (local 'value') 
 
I think I have missed something with this scene? - could you help?
 
Thank you :)
 
Link to comment
Share on other sites

  • 0

please remove ALL code

and key only one line:

 

1
print(json.encode(sourceTrigger))
Link to comment
Share on other sites

  • 0

hello...

Please login or register to see this link.

@10der what do you write in your GlobalVariable "HomeTable"?

Link to comment
Share on other sites

  • 0
7 hours ago, SvenG. said:

hello...

Please login or register to see this link.

@10der what do you write in your GlobalVariable "HomeTable"?

nothing ? remove it

Link to comment
Share on other sites

  • 0

Hi,

 

I have tried removing code. Adding parts, and trying everything I can work out how to make this work.

 

@10der @ - thank you for your help so far! - could you help again and clarify what the actual code you would use.

 

Where I'm lost - I remoted the code you suggested. I removed all - then some of the code but now I get errors when running the scene:

 

[SCENE33]: (load):26: attempt to index a nil value (local 'value')

 

Would you be able to give an explain again how you would make a remote work as I've followed the ZRC-90 example and I must be missing something.

 

Thank you :) 

Link to comment
Share on other sites

  • 0

DECLARATIONS (Conditions/Triggers)

 

{
  conditions = { {
        type = "device",
        id = 1030,
        property = "centralSceneEvent",
        operator = "!=",
        value = {},
        isTrigger = true,
    } },
  ope
rator = "all"
}
 
 
ACTIONS
print(json.encode(sourceTrigger))
 
 
pay attention
sometimes copy/paste from forum posts to :HC(x) LUA editor wrong.
 
Link to comment
Share on other sites

  • 0
On 5/17/2020 at 9:13 PM, 10der said:
ZRC-90
 

Please login or register to see this code.

 

 

Please login or register to see this code.

 

 

To 10der@>
I appreciate your work. For the rest of us, you have a lot of beneficial contributions. It's amazing to follow your discussions with other experienced users and read multi-page topics. I can learn a lot.
But DonCW is new and certainly has no idea about HomeTable.
Therefore (even other inexperienced ones) may not understand the context.

I'm just getting ready to use a home table, but I can't find the courage. For example, Fibaro will leave the ID by then, or introduce a name structure for working with scenes.
For example, I work with automation systems on BACnet, where the editor automatically converts, for example: "NumberDevice.DeviceID.AnalogInputX" to NumberDevice.Namedevice.NameAnalogInputX. This makes the code more readable. When you move the cursor, the original "NumberDevice.DeviceID.AnalogInputX" is displayed.

 

  • Thanks 1
Link to comment
Share on other sites

  • 0
  • Inquirer
  • I'm sorry @10der  and @DonCW but I still don't have a clue how to solve this. I can not figure out how to make this to work. The Declarations part is not so difficult but what to put on the Actions side. I got the same error as @DonCW[SCENE18]: (load):28: attempt to index a nil value (local 'value')       but I don't understand the explanation what to do to fix this. Can you give me more clues ;-) Help is much appriciated. 

     

    Please login or register to see this attachment.

    Edited by JWoofer
    Link to comment
    Share on other sites

    • 0

    @JWoofer nothing 

    are you asking how trigger - yes use condition 

    so about action - anything you want 

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • @10der thanks for the quick response. If I understand correct the conditon part is to detemine the parent ID off the FGS-223 device in my case 738. In the actions I only need to define then what the action is when the button is pressed ones. So in my case switch On ID 385. And switch 385 Off when the button is pressed twice. 

    Conditions:
     

    {
      conditions = { {
          type = "device",
          id = 742,
          property = "centralSceneEvent",
          operator = "!=",
          value = {},
          isTrigger = true,
       } },
      operator = "all"
    }
     
    ACTIONS
     
    --jT = json.decode((fibaro.getGlobalVariable("HomeTable")))
    print(json.encode(sourceTrigger)) 
     
    local value = sourceTrigger.value
    if value.keyId == 1 then
        fibaro.debug("|Pressed""1")
        fibaro:call(385"turnOn")
    elseif value.keyId == 2 then
        fibaro.debug("Pressed""2")
        fibaro:call(385"turnOff")
    else
        fibaro.debug("Pressed""ERROR")
    end
     
     
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi @10der, @Martin_N, @DonCW,

    My last desperate request because I can't get this to work. Call me stupid but I have tried all kind of things with the information above but it doesn't work. 

    Maybe I didn't explained myself right. I have in my living room build in the wall a double two-side puls switch with two FGS-223 modules connected to it. That give me multiple options for scene activations

    - Press upper left button ones for switch light on

    - Press upper left button twice for switchin another light on

    - Press lower button ones for switching light off

    - ect 

    To try to get this to work I made a test script. I have used the following script on the Conditions/trigger side where ID 742 is one of the FGS-223 module:
     

    {
      conditions = { {
          type = "device",
          id = 742,
          property = "centralSceneEvent",
          operator = "!=",
          value = {},
          isTrigger = true,
       } },
      operator = "all"
    }

     

    and I have the following script on the actions side:

     

    print(json.encode(sourceTrigger)) 

     

    local value = sourceTrigger.value
    if value.keyId == 1 then
        fibaro.debug("Pressed""1")
        fibaro:call(385"turnOn")
    elseif value.keyId == 2 then
        fibaro.debug("Pressed""2")
        fibaro:call(385"turnOff")
    else
        fibaro.debug("Pressed""ERROR")
    end
     
    Nothing happens. No debug messages , nothing. Is it possible that anyone can give me the exact script text that I can use or at least give me a clue on which side (conditions or Actions) I need to make adjustments to get this to work. Help is much appreciated and I hope to hear from one of you guys soon. Thanks in advance. 
    Link to comment
    Share on other sites

    • 0

    Hi @

    Please login or register to see this link.

     ,

     

    I've also been completely stuck with this and no help up to now has got my issue to work either.

    I'm a novice to the HC3. I could program the HC2 fine but this has completely confused me. I don't use a Hometable or the home table variables. I used to call the triggers from the ID of the device rather than name.

     

    I know its no comfort but I just couldn't figure it all out so I sent a helpdesk response to Fibaro. [email protected] were no help and directed me to [email protected].

     

    [email protected] just didnt respond at all and this was a few weeks ago now. 

     

    I've decided to give up for now and wait and see if anyone else works this out...

    Link to comment
    Share on other sites

    • 0

    ... interesting how many times @fibaro.com helps you.... really helps you instead of suggestion to remove / add device.. for example.

    @DonCW but it's up to you.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • @DonCW @10der I honestly have the same experience with support. After sending an e-mail with this issue I got a mail back with only a link to the online manual. Nothing more. I'm expecting they don't have the time at this moment to solve all issues but at least update the manuals with enough information to get it up and running again. I've this solution in my kitchen and living room so now I can only switch on lights with the app. I'm confined with this but my wife can't appreciate it. :-)

    Link to comment
    Share on other sites

    • 0
    11 hours ago, JWoofer said:

    I have in my living room build in the wall a double two-side puls switch with two FGS-223 modules connected to it.

     

    FGS-223.... did you adjust the parameters of the device to actually do scene activation ?

    Link to comment
    Share on other sites

    • 0

    I use the following for my Dimmer 2:

     

    Triggers:

    Please login or register to see this code.

    Actions:

    Please login or register to see this code.

    Hope someone finds a use for it.

     

    Jim

    • Like 2
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 2 hours ago, Momos said:

     

    FGS-223.... did you adjust the parameters of the device to actually do scene activation ?

    Yes, parameter 28 and 29 are activated.

    Link to comment
    Share on other sites

    • 0

    My triiger is like this:

     

    Please login or register to see this code.

    Granted this is for a Remotec Remote.  Maybe try change operator to anyValue ?

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