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

@jgabHello Jan

Can you please put me to the right direction where can I find, how are child devices supported in ER4. I have spent 3 hours just for looking for some deeper description. I have found only your description about child devices in general wihtin Tutorial topic, but nothing about childs in ER4.

How to create them, how to assign them to a device, or how to create them from scrach, like creating a parent then creating a child, how to take care about they lifecycle / aviod incidental deletion, how to interact with them etc. in ER4

Is there any topic, or tutorial for child devices in ER4?

THanks

 
Link to comment
Share on other sites

  • Topic Author
  • 2 minutes ago, Neo Andersson said:

    @jgabHello Jan

    Can you please put me to the right direction where can I find, how are child devices supported in ER4. I have spent 3 hours just for looking for some deeper description. I have found only your description about child devices in general wihtin Tutorial topic, but nothing about childs in ER4.

    How to create them, how to assign them to a device, or how to create them from scrach, like creating a parent then creating a child, how to take care about they lifecycle / aviod incidental deletion, how to interact with them etc. in ER4

    Is there any topic, or tutorial for child devices in ER4?

    THanks

     

    There is only support to make standard types - no custom UIs.

     

    Link to comment
    Share on other sites

    12 hours ago, jgab said:

    There is only support to make standard types - no custom UIs.

     

    Thanks Jan, i have found only  few lines about childs. As i never used them before, for me it is inevitable to get into of them a bit deeper.

    Also i have tried the example code, what will it do, but i got error saying No such function child

    Should this code create a binarySwitch type child device /named Mychild ?

    What device will be this device child of?

    ID1 are supposed to be the IDs of the child device? This ID is given by the system when the child is created right? Or is this the parnets ID, tha should  be given by me? I dont get it sorry

    What is ID1_D's meaning?

    Sorry for questioning, not too much of explanation found out there, (or maybe i am blind, and could not find)

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

  • Topic Author
  • 34 minutes ago, Neo Andersson said:

    Thanks Jan, i have found only  few lines about childs. As i never used them before, for me it is inevitable to get into of them a bit deeper.

    Also i have tried the example code, what will it do, but i got error saying No such function child

    Should this code create a binarySwitch type child device /named Mychild ?

    What device will be this device child of?

    ID1 are supposed to be the IDs of the child device? This ID is given by the system when the child is created right? Or is this the parnets ID, tha should  be given by me? I dont get it sorry

    What is ID1_D's meaning?

    Sorry for questioning, not too much of explanation found out there, (or maybe i am blind, and could not find)

     

    Please login or register to see this code.

     

    What version of ER4 are you running? The child function has been there a year...

    Yes, it creates a child of type binarySwitch and maps UI events to update the value property of the device. The device is a child of the main ER4 QA.

    The "ID1" is a unique id you assign to the device (it's not the device ID, that is a number and assigned by the system).

    The unique ID is used to keep track of the children.

    If you define a child(ID...) with an ID that doesn't have a child with that ID, the child is created.

    If there exists children with IDs that are not defined by any child(ID...) command, the child will be removed.

    The initChildren() command keeps track of that housekeeping...

     

    If you have a child with ID "ID1", there will be an ER variable "ID1_D" defined for you with the deviceId of the child with that ID. That way you can call methods on the device with ID1_D:on etc.

    Otherwise it can be difficult to know what deviceId the child got from the system...

     

    So, on the HC3, child devices are just regular (QuickApp) devices that send all their events to the parent QuickApp. UI events and onAction events.

    In the parent QA you define the code for the child QA.

    In the ER4 implementation, child(...) creates a child device and it maps UI events from the child device to ER #UI{...} events.

    If you remove the first rule "child(...)", ER4 will remove the child.

    Link to comment
    Share on other sites

    6 minutes ago, jgab said:

    What version of ER4 are you running? The child function has been there a year...

    Yes, it creates a child of type binarySwitch and maps UI events to update the value property of the device. The device is a child of the main ER4 QA.

    The "ID1" is a unique id you assign to the device (it's not the device ID, that is a number and assigned by the system).

    The unique ID is used to keep track of the children.

    If you define a child(ID...) with an ID that doesn't have a child with that ID, the child is created.

    If there exists children with IDs that are not defined by any child(ID...) command, the child will be removed.

    The initChildren() command keeps track of that housekeeping...

     

    If you have a child with ID "ID1", there will be an ER variable "ID1_D" defined for you with the deviceId of the child with that ID. That way you can call methods on the device with ID1_D:on etc.

    Otherwise it can be difficult to know what deviceId the child got from the system...

     

    So, on the HC3, child devices are just regular (QuickApp) devices that send all their events to the parent QuickApp. UI events and onAction events.

    In the parent QA you define the code for the child QA.

    In the ER4 implementation, child(...) creates a child device and it maps UI events from the child device to ER #UI{...} events.

    If you remove the first rule "child(...)", ER4 will remove the child.

    I am using this

    QuickApp.E_SERIAL,QuickApp.E_VERSION,QuickApp.E_FIX = "UPD896661234567892",0.993,"N/A"
    Link to comment
    Share on other sites

  • Topic Author
  • 7 minutes ago, Neo Andersson said:

    I am using this

    QuickApp.E_SERIAL,QuickApp.E_VERSION,QuickApp.E_FIX = "UPD896661234567892",0.993,"N/A"

    Child support came in v0.994 ;-) 

    It's v0.998 these days...

    Link to comment
    Share on other sites

    22 minutes ago, jgab said:

    Child support came in v0.994 ;-) 

    It's v0.998 these days...

    Jan please, can you somehow adjust the autoupdate process that it will not delete additional files created by users?

    1 . I ran the update and all my extra functions frm other files were removed / no worries i hav made a backup this morning,so i lost just a few line of codes

     

    2. Jan here you say in the previous answer The device is a child of the main ER4 QA. So using a command like

    Please login or register to see this code.

    will just crate a child for the ER4 QA itself (with some fibaro ID given by the system) and i will refer to this child device inside ER4 using MyInternalID right?

    If so, how do a create a chlld device for some other quickapp device?

     

    Thanks

     

    Link to comment
    Share on other sites

  • Topic Author
  • 21 minutes ago, Neo Andersson said:

    Jan you stated that The device is a child of the main ER4 QA.

    So childs created with a rule 

     

    Please login or register to see this code.

    will create a child for ER4 main QA

    So how do i create a child for another QA from ER4? 

     

    You don't. You do that from the other QA. The Childs Lua code must be in the mother QA...

    Link to comment
    Share on other sites

  • Topic Author
  • 6 minutes ago, Neo Andersson said:

    Jan please, can you somehow adjust the autoupdate process that it will not delete additional files created by users?

    1 . I ran the update and all my extra functions frm other files were removed / no worries i hav made a backup this morning,so i lost just a few line of codes

     

    You use the QAUpdater ?

    If you name your QA file with a "u_" prefix, it will not be touched by QAUpdater.

    Ex. u_myFile

    8 minutes ago, Neo Andersson said:

    Jan please, can you somehow adjust the autoupdate process that it will not delete additional files created by users?

    1 . I ran the update and all my extra functions frm other files were removed / no worries i hav made a backup this morning,so i lost just a few line of codes

     

    2. Jan here you say in the previous answer The device is a child of the main ER4 QA. So using a command like

    Please login or register to see this code.

    will just crate a child for the ER4 QA itself (with some fibaro ID given by the system) and i will refer to this child device inside ER4 using MyInternalID right?

    If so, how do a create a chlld device for some other quickapp device?

     

    Thanks

     

    You refer to it with MyInternalID_D

    Link to comment
    Share on other sites

    5 minutes ago, jgab said:

    You use the QAUpdater ?

    If you name your QA file with a "u_" prefix, it will not be touched by QAUpdater.

    Ex. u_myFile

    You refer to it with MyInternalID_D

    Updated to last version still getting this

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    37 minutes ago, Neo Andersson said:

    Updated to last version still getting this

    Please login or register to see this attachment.

    Also i am getting this lines in debug window, that doesnt make sense for me..

    fibaro.call(336,"turnOn") => nil

    What is this?

    Doublechecked device 336, and there is nothing wrong with it. These kind of lines just apper for other devices too. Randomly..

     

    Link to comment
    Share on other sites

  • Topic Author
  • 4 hours ago, Neo Andersson said:

    Updated to last version still getting this

    Please login or register to see this attachment.

    The QA is not updated - what version number does it report when it starts up?

    3 hours ago, Neo Andersson said:

    Also i am getting this lines in debug window, that doesnt make sense for me..

    fibaro.call(336,"turnOn") => nil

    What is this?

    Doublechecked device 336, and there is nothing wrong with it. These kind of lines just apper for other devices too. Randomly..

     

    It's just a trace of fibaro.calls for debugging purposes.

    In the beginning of main you probably have something like

    Please login or register to see this code.

    Set it to false.

    Link to comment
    Share on other sites

    3 hours ago, jgab said:

    The QA is not updated - what version number does it report when it starts up?

     

    @jgab Jan i have created a brand new ER4 qa with the udater, so it must have the last version. And it shows that it is

    I have this 

    Please login or register to see this image.

    /monthly_2023_11/image.png.6ddbf7935765e5c974a4ab96707866fe.png" />

    image.png.17325ae0b57798255c0a1e74f5854e94.png

     

     

     

     

     

    3 hours ago, jgab said:

    It's just a trace of fibaro.calls for debugging purposes.

    In the beginning of main you probably have something like

    Please login or register to see this code.

    Set it to false.

     

    Link to comment
    Share on other sites

    8 hours ago, jgab said:

    You use the QAUpdater ?

    If you name your QA file with a "u_" prefix, it will not be touched by QAUpdater.

    Ex. u_myFile

    You refer to it with MyInternalID_D

    @jgab Okay, i got it, but what about the main file. I have there hundreds of rules, or some few extra lines that loads other functions. I supppose Main should not be renamed to u_Main, should be?

    Link to comment
    Share on other sites

  • Topic Author
  • 16 minutes ago, Neo Andersson said:

    @jgab Okay, i got it, but what about the main file. I have there hundreds of rules, or some few extra lines that loads other functions. I supppose Main should not be renamed to u_Main, should be?

    No, main for ER4 is not touched. It's part of the "known exceptions". But if you add your own files you need to rename them with a u_ prefix so I know they should be excepted.

    30 minutes ago, Neo Andersson said:

    @jgab Jan i have created a brand new ER4 qa with the udater, so it must have the last version. And it shows that it is

    I have this 

    Please login or register to see this link.

    Please login or register to see this link.

     

     

     

     

     

     

     

    Yes, but it's not 0.98, it is 0.998.

    Press "Version >>" until you get "v:0.998 fixed catchup fot @daily"

    Link to comment
    Share on other sites

    20 minutes ago, jgab said:

    No, main for ER4 is not touched. It's part of the "known exceptions". But if you add your own files you need to rename them with a u_ prefix so I know they should be excepted.

     

    Yes, but it's not 0.98, it is 0.998.

    Press "Version >>" until you get "v:0.998 fixed catchup fot @daily"

    Maybe i got you wrong..if i update ER4 from udater, it will keep untouched the Main file? so my rules will be preserved? The entire Main file will be untoeched?

    Link to comment
    Share on other sites

  • Topic Author
  • 5 minutes ago, Neo Andersson said:

    Maybe i got you wrong..if i update ER4 from udater, it will keep untouched the Main file? so my rules will be preserved? The entire Main file will be untoeched?

    Yes, main file is untouched - because your rules are expected to be there...

    Link to comment
    Share on other sites

    20 minutes ago, jgab said:

    Yes, main file is untouched - because your rules are expected to be there...

    @jgabJan this doesnt work. 

    1. My main file was touched. Some lines were deleted.

    2. Even if i used u_ prefix, my files were delted.

    Tried it 3 times

     

    UPDATE

    Okay, the updater was on an old version.

    Its working i think, thanks

    Edited by Neo Andersson
    Link to comment
    Share on other sites

    @jgab hello Jan

    What is wrong with this rule 

    Please login or register to see this code.

    I am getting this warning

    Please login or register to see this attachment.

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