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


Recommended Posts

Posted

Hi,

 

I'm new to Lua and HC3 Quickapp programming. I know i have a long way to go and maybe I've started on the wrong foot, or with a project to big. I'm not new to programming. That said i think Fibaros QA documentation is really bad, and a big mountain to climb. I've read @jgabs tutorial on QA programming, and that have helped in sove way, but it still seems that you need to have a lot basic knowledge to understand everything he is writing. You almost have to have inssider knowledge.

 

However i have a problem with the QA im looking at/learning programming at. I'm not able to update a variable in a child device. No matter what i does i cant update the variable. 

 

My QA is an app that can disable a relay after a certain time. All my relays are supposed to be created as a child when the parent is called whith that relay no. Then the relay is turned on and the disable time needs to be written to a variable in the child, but im not able to do that.. When the disable timer is reached the relay turns off.

 

The childs will not be deleted, but the next time a specific button is pressed, the relay turns on and the disable timer variable should be updated again.When the disable timer is reached the relay turns off, and so it continues

 

I've tried the following, but nothing is working

 

                    child=self.childDevices[ChildID]
                    child:setVariable("Time", "test")
                    local name = "Test"
                    local value = "test"
                    fibaro.call(ChildID,"setVariable",name,value)
                    self:debug("RelayID",child:getVariable("Relay_id"))

 

I can read the variable without any issues.

 

Please advise what to do, and maybe some literature on how to learn Fibaro HC3 LUA, especially the parameters for the different commands

 

br, Thomas

Posted (edited)

It looks like it should work...

This prints nothing?

Please login or register to see this code.

 

Edited by jgab
  • Topic Author
  • Posted
    1 hour ago, jgab said:

    It looks like it should work...

    This prints nothing?

    Please login or register to see this code.

     

    Hi jgab

     

    Strange. That seems to work. Don't know why, as i don't see any difference compaired to my code. Apparently it just needed a little @jgab dust of magic. Thank you for your help. I'll keep on learning. For now i added the variable part to the child class, and then call that routine when the button is pressed

     

    Thomas

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