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

On 9/3/2020 at 6:54 PM, Rover said:

Why is the first print statement working and the second does not?

function QuickApp:onInit()

    self:debug("onInit")
    self:hello()
    self.jT = json.decode((fibaro.getGlobalVariable("HomeTable")))
    print(self.jT.TestKamer.testLicht)
end

 

function QuickApp:hello()
  print(self.jT.TestKamer.testLicht)
end

@jgab can you help me?

Link to comment
Share on other sites

  • Topic Author
  • 1 hour ago, Rover said:

    @jgab can you help me?

    Because you are calling self:hello() before you have assigned self.jT the value of your HomeTable. Thus self.jT is nil in QuickApp:hello()

    Edited by jgab
    • Thanks 1
    Link to comment
    Share on other sites

  • Topic Author
  • Refreshing an old discussion.

    If you create your own UI elements for the QA you have a bit more control of the layout.

    it's possible to squeeze in more than 5 buttons in a row (depending on how much text you want the button to have)

    The pop-up works on the phone too. There is also a multi-select version of it.

    The toggle control (switch - box that toggles between blue and white) works so-and-so. 

    I'm still playing with the image control and will come back when I figure it out...

    This is the code that I used

    Please login or register to see this code.

     

    Edited by jgab
    • Like 3
    Link to comment
    Share on other sites

    On 9/6/2020 at 5:20 PM, jgab said:

    Well, I made some tests and it seems like a two things need to fulfilled for a device to be included in an alarmzone

     

    First it seems to need to have the interface "fibaroBreach".

    Secondly, it seems to have to be a valid device type, like com.fibaro.motionSensor etc. Does anyone know the complete list? Ex. com.fibaro.binarySensor does not seem to work

     

    I have made a new version of the HC2Proxy that allows you to add a list of interfaces to the device being created.

    v1.4 

    Please login or register to see this attachment.

    You can also add "batter" and "power" and "energy".

    On the HC2 if you trigger on %% property <id> battery the HC3 proxy should be updated.

    Hi jgab


    I tested your HC2proxy quickapp

    Home Center 3 <=> Home Center 3

    Control is possible

    Below screen

    How can I synchronize?

    Please login or register to see this image.

     

    Edited by minsad79
    Link to comment
    Share on other sites

  • Topic Author
  • Just now, minsad79 said:

    Hi jgab
    I tested your HC2proxy quickapp

    Home Center 3 <=> Home Center 3

    Control is possible

    Below screen

    How can I synchronize?

     

    The current code relies on a scene running on the HC2 pushing changes back to the HC3.

    For HC3<->HC3 there need to be another type of logic. It's possible to make something similar (a QA on the HC3 that pushes values to another HC3).

    But wouldn't the HC3 be  able to use other HC3s as slave devices? (I only have one)

    Link to comment
    Share on other sites

    5 minutes ago, jgab said:

     

    The current code relies on a scene running on the HC2 pushing changes back to the HC3.

    For HC3<->HC3 there need to be another type of logic. It's possible to make something similar (a QA on the HC3 that pushes values to another HC3).

    But wouldn't the HC3 be  able to use other HC3s as slave devices? (I only have one)

    The gateway mode function is not available yet

    I don't know when fibaro will do it

    I inquired because the device of hc3 is not sync

    HC3<=>Can you develop HC3 synchronization function?

    Link to comment
    Share on other sites

    1 hour ago, jgab said:

    This is the code that I used

    attempt to call a nil value (method 'getView')

     

    unction QuickApp:onInit()
      local v = "4"
      if self:getView('lt','text') ~= v then
    Link to comment
    Share on other sites

  • Topic Author
  • 1 hour ago, Bodyart said:

    attempt to call a nil value (method 'getView')

     

    unction QuickApp:onInit()
      local v = "4"
      if self:getView('lt','text') ~= v then

    Yes, it uses my

    Please login or register to see this link.

    code (and I build and deploy it to the HC3 with the hc3 emulator). The Toolbox_ui module is a new module under development. I will upload it asap.

    Here is an assembled version 

    Please login or register to see this attachment.

     

    Please login or register to see this code.

    Edited by jgab
    • Thanks 1
    Link to comment
    Share on other sites

  • Topic Author
  • New version of the HC2Proxy that should work with sceneActivation devices like remote controls

    Please login or register to see this attachment.

    HC2 scene

    Please login or register to see this code.

     

     

    Edited by jgab
    • Like 1
    • Thanks 1
    Link to comment
    Share on other sites

    3 hours ago, jgab said:

    New version of the HC2Proxy that should work with sceneActivation devices like remote controls

    I've installed on both sides HC2 & HC3, but instead of plenty childs (+/- 15) i have only 3. Can't figure out where to search...

    Link to comment
    Share on other sites

    3 godziny temu, jgab napisał:

    New version of the HC2Proxy that should work with sceneActivation devices like remote controls

    Please login or register to see this attachment.

    HC2 scene

    Please login or register to see this code.

     

     

    Is there a way to connect with HCL? Maybe after changing the firmware -

    Please login or register to see this link.

    Link to comment
    Share on other sites

  • Topic Author
  • 13 hours ago, michal85pl said:

    Is there a way to connect with HCL? Maybe after changing the firmware -

    Please login or register to see this link.

    Yes, only if you can run the scene on the HCL.

    Link to comment
    Share on other sites

  • Topic Author
  • 14 hours ago, Bodyart said:

    I've installed on both sides HC2 & HC3, but instead of plenty childs (+/- 15) i have only 3. Can't figure out where to search...

    You need to go into the QA (main file) and edit this table

    Please login or register to see this code.

    -The number is the device number on the HC2

    -Name is the name the childDevice will get (you can change it later)

    -class is the available child device types supported. binarySwitch, binarySensor, multilevelSwitch, multilevelSensor, sceneActivationDevice,..

    -type is the fibaro type the childDevice will get. It will decide the "look" of the childDevice, however, it must be supported by the previous class. A com.fibaro.doorSensor works with binarySensor etc.

     

    Setup the HC2 credentials as quickVars. IP="192.168.x.y", User="[email protected]", Pwd="xyz"

    On the HC2 you also need too add the trigger in the header for the devices you are proxying

     

    ------------------

    20 hours ago, minsad79 said:

    The gateway mode function is not available yet

    I don't know when fibaro will do it

    I inquired because the device of hc3 is not sync

    HC3<=>Can you develop HC3 synchronization function?

    It's not a priority at the moment....

    Edited by jgab
    Link to comment
    Share on other sites

    3 hours ago, jgab said:

    You need to go into the QA (main file) and edit this table

    Thank you very much for the guidelines, but with version 1.4 I had all defined devices and with version 1.5 only 3 are left, while i copied the PROXIES array to the new QA and also copied the triggers to new HC2 scene....

    Link to comment
    Share on other sites

    11 godzin temu, jgab napisał:

    Yes, only if you can run the scene on the HCL.

    I've installed custom recovery on my HCL.

    Created Proxy Scene, edited credentials.

    I Have 3 sensors (siren, door sensor/ motion sensor). I Can see that they triggers scene...but i can't see it on the HC3.

     

    From the HC3 i can turn on/off siren, but i can't see states changes of the other sensors...

    Seems to be a problem on the HCL side? How to solve it?

    Link to comment
    Share on other sites

    Godzinę temu, michal85pl napisał:

    I've installed custom recovery on my HCL.

    Created Proxy Scene, edited credentials.

    I Have 3 sensors (siren, door sensor/ motion sensor). I Can see that they triggers scene...but i can't see it on the HC3.

     

    From the HC3 i can turn on/off siren, but i can't see states changes of the other sensors...

    Seems to be a problem on the HCL side? How to solve it?

    problem solved...some bug in HC3 credentials, password changed for the same one, and now works

    • Like 1
    Link to comment
    Share on other sites

    I added in HCL:

     

    --[[
    %% autostart
    %% properties
    14 battery
    17 battery 

    8 battery
    9 battery
    10 battery
    * value
    --]]

     

     

    HC3

    PROXIES = {

    [14] = {name='Syrena', class="binarySwitch", type="com.fibaro.binarySwitch", interfaces={"fibaroBreach","battery"}},

      [17] = {name='Drzwi', class="binarySensor", type="com.fibaro.doorSensor", interfaces={"fibaroBreach","battery"}},

      [8] = {name='Ruch', class="binarySensor", type="com.fibaro.motionSensor", interfaces={"fibaroBreach","battery"}},

      [9] = {name='Temp', class="binarySensor", type="com.fibaro.temperatureSensor", interfaces={"battery"}},

      [10] = {name='Lux', class="binarySensor", type="com.fibaro.lightSensor", interfaces={"battery"}},

    }

     

    But still got 0% batt

    Please login or register to see this image.

    /monthly_2020_09/1522058848_Adnotacja2020-09-09202149.jpg.31f74cb191f0245d52b76b8edc740296.jpg" />

     

    what I missed?

     

    Edited by michal85pl
    Link to comment
    Share on other sites

  • Topic Author
  • Sorry, the interface is named "battery", but the property is "batteryLevel"

    %% properties

    14 batteryLevel

     

    etc

    Link to comment
    Share on other sites

    4 minuty temu, jgab napisał:

    Sorry, the interface is named "battery", but the property is "batteryLevel"

    %% properties

    14 batteryLevel

     

    etc

    changed but still 0%

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