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

  • Topic Author
  • Posted
    4 minutes ago, FredrikKarlsson said:

    Another small note which relate to international characters in device and scene names. 

    For sure, you can remove them all, but the names will then be a bit hard to remember. I prefer a solution like this for example:

    Please login or register to see this code.

     

    Of course the 'replacementTab' needs to be populated with what is appropriate for the language. The above example is what I use for Swedish.

    I prefer using "Rorelsetvattstugan" rather than "Rrelsetvttstugan" which I will never get right.

     

     

     

    Thanks @FredrikKarlsson

     

    It looks like lots of people have switched to using HomeTable solutions...

    Guest FredrikKarlsson
    Posted
    3 minutes ago, AutoFrank said:

     

    Thanks @FredrikKarlsson

     

    It looks like lots of people have switched to using HomeTable solutions...

    Yes, I have certainly seen the light. Many thanks to you for making this tutorial available. 

     

    I could also share a function I use for loading the HomeTable. Loading is not to complicated, but I often don't bother with all the checks in a scene if I set it up from scratch. 

     

    Please login or register to see this code.

    Maybe it may be of use to someone out there.

    • T.Konopka featured this topic
    • 3 weeks later...
    Posted (edited)

    I have added function for replacing the diacritic in devices and rooms.

    You can also add some other special characters via changing variable Diacritic.

    It could be helpful for some users ...

     

    Please login or register to see this code.

     

    Edited by petr23
  • Topic Author
  • Posted
    2 hours ago, petr23 said:

    I have added function for replacing the diacritic in devices and rooms.

    You can also add some other special characters via changing variable Diacritic.

    It could be helpful for some users ...

     

    Please login or register to see this code.

     

    thanks @petr23

    • 4 weeks later...
    Posted

    How do I check if the scene I created is creating the home table please?

     

    When I run a device that references the table, I press button and I get an error.  Debug is showing 

     

    [ERROR] 16:42:43: line getGlobalValu..."]:2

     
    Any ideas what I'm doing wrong please?
  • Topic Author
  • Posted
    3 hours ago, CelticWebs said:

    How do I check if the scene I created is creating the home table please?

     

    When I run a device that references the table, I press button and I get an error.  Debug is showing 

     

    [ERROR] 16:42:43: line getGlobalValu..."]:2

     
    Any ideas what I'm doing wrong please?

     

    Hi @CelticWebs

    Could you post the hometable scene and the code you are using to reference the table ?

     

    Posted
    Just now, AutoFrank said:

     

    Hi @CelticWebs

    Could you post the hometable scene and the code you are using to reference the table ?

     

     

    I used your code for the HomeTable

    Please login or register to see this code.

    In the VD I was starting off simple.

     

    Please login or register to see this code.

    I also created a single Pre Defined variable called HomeTable with one item in it called Value 1

     

    I'm probably missing something stupidly obvious!

  • Topic Author
  • Posted

    @CelticWebs

    Thanks

    I actually create my table manually as I wanted a bit more control over the structure

    As a result I am not 100% of the structure of the table that is created (can you see after you run the scene that the table was created

    The table reference is probably incorrect (I see VD in your table creation and vd in your reference but it would be useful to see the whole table

     

    Try the following in a blank scene, it will print out the Home Table that was created.

     

    Please login or register to see this code.

     

     

    Posted

    Please login or register to see this code.

     

  • Topic Author
  • Posted

    @CelticWebs

    Two issues here I think 

     

    You need to match the case exactly so the VD should be upper case, you had lower case in your code above

     

    I also think that the hyphens are creating an issue in the call

     

    Try this in a blank scene

    Please login or register to see this code.

    and then try this

    Please login or register to see this code.

    what you should see is in the code

     

    If this is correct then you need to either remove the - in the device name or I think if you uncomment the following in your table creation it should remove your non-alphanumeric chars

     

    Please login or register to see this code.

    BTW - when you reply to the post if you put @AutoFrank in the post I'll see that you have replied... :-)

     

     

     

     

    Posted

    Hi @AutoFrank you are correct that it's something to do with the hyphen.  Though uncommenting that code doesn't fix it because the hyphens are in the rooms not the devices.  Can I get it to remove the hyphens from rooms as well?

    @AutoFrank I just realised it was already in the code!  I've just removed the hyphens from room names as well and the scene we tried earlier is working now.

  • Topic Author
  • Posted
    Just now, CelticWebs said:

    Hi @AutoFrank you are correct that it's something to do with the hyphen.  Though uncommenting that code doesn't fix it because the hyphens are in the rooms not the devices.  Can I get it to remove the hyphens from rooms as well?

     

    @CelticWebs

    I'm not sure as I didn't write that code :-(

     

    What about if you replaced the hyphens in the room names with an underscore

    I think that will work with the home table reference

     

    If you replaced them with spaces then the hometable creation will just remove them and you could solve it that way

     

    personally I have something like Living Room in my HC2 but LivingRoom in my home table and this is what I reference and is easy to remember. If you go with option 2 above you'll can use that approach...

    Posted

    @AutoFrank it was already in the code Frank :)  it strips hyphens out of the room names now :)

     

    I'm just working on the virtual device again now.  Now I have to work out how to get it to do something based on the result of an url, url will show a page with a 1 or a 0 on it and I need it to do something different depending on what the result is!  

     

    Getting there slowly but it's a bit of a learning curve!

  • Topic Author
  • Posted
    2 minutes ago, CelticWebs said:

    @AutoFrank it was already in the code Frank :)  it strips hyphens out of the room names now :)

     

    I'm just working on the virtual device again now.  Now I have to work out how to get it to do something based on the result of an url, url will show a page with a 1 or a 0 on it and I need it to do something different depending on what the result is!  

     

    Getting there slowly but it's a bit of a learning curve!

     

    @CelticWebs, glad you got it working.. for the url query, it might be good to start a new post and add a bit more content if you need help and that way other users can chime in based on the topic heading.. 

    Posted
    Just now, AutoFrank said:

     

    @CelticWebs, glad you got it working.. for the url query, it might be good to start a new post and add a bit more content if you need help and that way other users can chime in based on the topic heading.. 

     

    @AutoFrank Going to have a go myself first and hopefully get that sorted without having to bother people.  I am intending on keeping a record of stuff I learn as I go that I can't find directly on the forum and later I'll put it up for others to find, if I'm looking for something, chances are somebody else is too.  Just like you posting the garage VD for me :)

     

  • Topic Author
  • Posted
    17 minutes ago, CelticWebs said:

     

    @AutoFrank Going to have a go myself first and hopefully get that sorted without having to bother people.  I am intending on keeping a record of stuff I learn as I go that I can't find directly on the forum and later I'll put it up for others to find, if I'm looking for something, chances are somebody else is too.  Just like you posting the garage VD for me :)

     

    @CelticWebs

    I think that's a great strategy and other forum users will appreciate it. It's also the way I learned and I've managed to contribute a bit back as well. I have found that if a user is willing to have a go and make an effort they will gets lot of help 

    Good luck with it and no doubt our paths will cross again :D

     

    _f

    Posted

    Hi,

    I also have a "HomeTable" type of structure for (all) my scene configuration data. Here are two tricks that I have found useful.

    Assume you read in the table the standard way

    Please login or register to see this code.

    then one can make a "reverse lookup table" for the deviceID data because typically there are no  two identical deviceIDs. Care have to be taken if you have numerical data in the structure that are identical. Then only apply it to the branch with the deviceID data.

    Please login or register to see this code.

    Callling reverseMapDefs(jT) once after reading in the json data allows you later in the code, for debugging purposes, efficiently find the "name" of a deviceID.

    Ex. assume we have jT.house.bedroom.lamp == 56. In my code I have wrappers for many fibaro functions so

    Please login or register to see this code.

    will print in the debug window

    Please login or register to see this code.

    which says me more than 56...

     

    The other trick, a little tricker and not always applicable, is that my scenes that depends on the data automatically restarts when the global "HomeTable" variable changes. In principle they could just read in the data and try to reconfigure but usually so many pieces of the scene depends on the data so that is difficult. So in my case, the scene that constructs /configures the "HomeTable" has an additional functionality. First the scenes that depends on the data has the following code. (I'm coding this in my "event model" but it shouldn't be difficult to understand and translate to standard lua scene code...)

    Please login or register to see this code.

    The Event:remote is just a Fibaro:startScene(id, data) where the id is the id of my "HomeTable" configuration scene and the data is a message to restart the scene. In this particular case we check if the part of the "HomeTable" that we depend on has changed (dev.places) and not the whole structure. If it has changed we ask the configuration scene to start us up and then we terminate the scene (fibaro:abort()).

    The Configuration scene when receiving the message just looks at the return address (that Event:remote conveniently puts in the message) and waits a second or two and issues a Fibaro:startScene(message._from) that restarts the scene. 

    I have a scene that gets away with just re-reading the data and not having to restart but in general I found it to be pretty convenient when updating the data to have scenes restart and reconfigure themselves.

  • Topic Author
  • Posted

    USING HOMETABLE TO STORE ICON ID's

     

    Hi,

     

    I had a couple of recovery events and lost my custom icons. I also started to use dynamic icons for my VD so I can use the icon to display state. This would be Garage Open/Garage Closed.

     

    Please login or register to see this code.

     

    As a result, i'm going to expand out my HomeTable to also cover icons so I can have a hometable reference in my code and if I loose or what to change an icon I can just update the hometable

     

    I added an extra entry to my hometable

    Please login or register to see this code.

    so the code above becomes 

    Please login or register to see this code.

     

    I manually create my hometable but perhaps some user that dynamically creates their table may be able to provide code to include icon references

     

    -_f

     

    • 4 weeks later...
    Guest ErnstH
    Posted

    Hi, new question (or I overlooked a previous one),

    I installed the HomeTable which in general works fine (tanks!).

    However, when replacing device ID's by hometable references I sometimes get messages like this:
    [DEBUG] 17:21:45: line 334: attempt to concatenate local 'deviceID' (a nil value)

    There ar only less than 50 lines in the scene, so I suppose it is refererring to another scene. But it's not in the HomeTable, which has no 334 lines either.

    How do I find out where this bug arises from?

    Or what do I do wrong?

    Posted

    Not 100% if it's the same issue for you but thats usually the error I get when I type in the wrong reference to a HomeTable ID.  usually from a capital letter or something similar.

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