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


AutoFrank

Tutorial - Using a Hometable to store device and scene ID's

Recommended Posts

2 hours ago, robw said:

I'm sorry to hear you have issues with it. Personally, the only issue I've had was the broken motherboard. I almost always also run the beta build of the software, and that have been stable, too. All I can think of is that you have some scenes/code that makes the system unstable, or a faulty unit. I have a some simple block scenes, and then I run a lot of UHAS scenes and VD's to drive the majority. I have a mix of Hue lights, Fibaro sensors (door sensors, fire sensors, eye sensors, water sensor, power switches) and also a power switch from another brand, an outdoor type. The HC2 covers 3 stories in the house and also outdoors. It runs very good and stable for me.

 

Send as much logs as you can to Fibaro first. If that does not work, hear with them if it is a chance that the unit itself could be malfunctioning.

 

Hope it all gets resolved!

 

Perhaps I wasn't clear enough.

 

I have many scenes that rely on tables of device IDs to function.

 

The scenes loop through the tables to perform tasks e.g. change the entire heating profile to hotter or colder and then report on current temp / target temp etc of every zone in the house. 

 

I want to implement home table, however I need to be able to reference the home table descriptions in a table to replace all of the id's e.g. replacing the last 5x columns in the table below with references to home table descriptions:

 

--                                                                                            Rad1-Rad2 / Temp1-Temp2 / Zone_ID
    local Heating_Zone_Table = 
            {
            a1                =    {"TV",                            "Label43",         567,"",        488,"",          4},
            a2                =    {"Rear_Bed",                "Label12",        560,"",        640,"",           6},
            a3                =    {"Library",                     "Label44",        873,"",        492,"",           4},
            a4                 =     {"Loft_Bed",               "Label14",        557,"",        380,"",            8},
            a5                =   {"Front Bed",                 "Label13",        568,"",        579,"",          13},
            a6                =    {"Family_Bath",           "Label18",        562,"",        787,"",            7},
            a7                =    {"Loft_Bath",                "Label19",        558,"",        606,"",        670},
            a8                 =     {"Family_Bath_UF",   "Label8",         548,"",         877,876,      11},
            a9                =    {"Loft_Bath_UF",         "Label7",          404,"",        411,412,       12},
            a10             =     {"1st_Corr",                  "Label42",        561,"",        573,"",            5},
            a11             =     {"Mast_Bed",               "Label11",        870,"",        637,"",        860},
            a12             =     {"Garden_Bath",          "Label27",        563,"",        922,"",        861},
            a13             =     {"Master_Bath",          "Label17",        871,"",        637,"",        860},        
            a14             =     {"Kit_Din_UF",             "Label5",          566,"",        880,881,    858},
            a15             =     {"Kit_Din",                    "Label30",        566,"",        514,"",        858},
            a16             =     {"Kit_Liv_UF",              "Label28",        874,"",        880,881,    858},
            a17             =     {"Kit_Liv",                     "Label31",        874,"",        779,"",        858},
            a18             =     {"Garden Room",        "Label15",        563,"",        579,"",        861},
            a19             =     {"Kit_WC_UF",             "Label29",        565,"",        878,879,    858},
            a20             =     {"Kit_Corr",                  "Label26",        565,"",        767,"",            5},
            a21             =     {"Loft AV",                   "Label25",        559,"",        380,"",            9}
            }

    Heating_Zones = function (trigger) 
    local returnString = Heating_Zone_Table[trigger] 
    returnString = returnString[icolumn]
    return returnString 
    end

 

 

Edited by amilanov

Share this post


Link to post
Share on other sites

Ok, I think I understand. 

Yes, you need to use som "HT string" to store the reference to deviceIDs in other tables. 

It's doable.

 

Please login or register to see this code.

So, then you can store "tvroom.heating" in your  Heating_Zone_Table 

 

Ex.

Please login or register to see this code.

and then do

Please login or register to see this code.

I noticed that my example use tvroom.heating and not heating.tvroom as in your example... I just prefer putting things in rooms and not rooms in things ;-)

Edited by jgab

Share this post


Link to post
Share on other sites
11 hours ago, jgab said:

Ok, I think I understand. 

Yes, you need to use som "HT string" to store the reference to deviceIDs in other tables. 

It's doable.

 

Please login or register to see this code.

So, then you can store "tvroom.heating" in your  Heating_Zone_Table 

 

Ex.

Please login or register to see this code.

and then do

Please login or register to see this code.

I noticed that my example use tvroom.heating and not heating.tvroom as in your example... I just prefer putting things in rooms and not rooms in things ;-)

 

OMG!!!

 

Thank you for taking the time to explain that in such detail.

 

I tested the HTMAP option as I am calling a fair amount of devices (subjectively).. not sure what defines small/large in this case.

 

PS: I agree that you should put things in a room. The "heating" room is a plumbing room with actuators and fibaro relays for each heating zone, hence "heating.tv_room" makes sense  in this case :)

 

I owe you a beer for that!

 

Regards

Aleks

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

I've seen some automated HomeTable scenes, you could also look for them. An example here: 

Thank's to jgab for helping out!

Edited by robw
New link.

Share this post


Link to post
Share on other sites

Am I right in saying that the ID of the heating panels is not picked up automatically through the code that

Please login or register to see this link.

 

Please login or register to see this link.

 
wrote?

 

In which case I would have to hardcode the IDs into the user defined section at the top?

 

Please login or register to see this code.

 

 

 

Edited by amilanov

Share this post


Link to post
Share on other sites
6 hours ago, amilanov said:

Am I right in saying that the ID of the heating panels is not picked up automatically through the code that

Please login or register to see this link.

 

Please login or register to see this link.

 
wrote?

 

In which case I would have to hardcode the IDs into the user defined section at the top?

I'm not a big fan of autogenerating the hometable so I haven't tested the code. 

However, it should automatically find all devices that are visible and enabled. Have you hidden the devices?

VDs you need to add yourself, like the scenes in the example.

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, jgab said:

However, it should automatically find all devices that are visible and enabled. Have you hidden the devices?

 

I'm not referring to devices. I'm referring to the heating panel. 

 

Maybe someone else on the forum has used the heating panel before and knows if it is possible to auto generate the IDs?

Share this post


Link to post
Share on other sites
1 hour ago, amilanov said:

 

I'm not referring to devices. I'm referring to the heating panel. 

 

Maybe someone else on the forum has used the heating panel before and knows if it is possible to auto generate the IDs?

Sorry, I don't have any heating in HC2 so I misunderstood you.

You can access your heating info that is available under panels with Lua

Have a look at  http://<hc2-ip>/docs 

There you have all the APIs (heating is under panels).

Ex api.get("/panels/heating") 

(I'm a bit unsure exactly the syntax but it is shown in the docs)

and you get back the data as a Lua table where you should be able to pick out the IDs

 

Share this post


Link to post
Share on other sites

Thanks again.


This is how you get the id's in one go: http://IP_ADDRESS/api/panels/heating

 

I was asking about the auto generation of these ids in HomeTable.

Share this post


Link to post
Share on other sites

[SOLVED] 

Hello

 

I am a newbie with HC2 and in he process of learning LUA

Thank you for the HomeTable concept which is very usefull !

I try to get the defined users ID in the HomeTable but this "type" is not included, how shouldI do to get the iDof a restricted user (Superusere being 2) in the Home table ?

 

Thank you for your help

Edited by Manuc
SOLVED

Share this post


Link to post
Share on other sites

Hello

Can HomeTable content be used in header %%properties ? Is there a trick ?

Thank you

Edited by Manuc

Share this post


Link to post
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...