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


  • 0

How to make a scene to centralize a function


robmac

Question

This technique can be used for a lot more but this simple case illustrates it in a very simple way.

 

I am not seeing a lot of example of using this feature posted so I thought this might give  a few who do not know some ideas. The technique is based around that second parameter of the fibaro:startScene method fibaro:startScene(sceneID,args).

 

args is a LUA table so you can pass pretty much anything to a scene via the API or from another piece of LUA. In this example only a table with one text element is passed.

 

Create a scene myDebugIllustration

Please login or register to see this code.

You may need to set the number of instances to a larger number wen you use this properly.

 

Now create another scene myTestScene

Please login or register to see this code.

Now remember that as I said earlier "a lua table can hold pretty much anything"

 

Enjoy

 

  • Like 1
Link to comment
Share on other sites

Recommended Posts

  • 0
23 minutes ago, szmyk said:

Is it possible to pass to a scene special characters like ä,ö,ü, ł, ó, ą ?

Actually I get different chararacters: ÄÅÄÅÅ

 

Hi @szmyk,

 

I tested with @AutoFrank SMsgH scene and find out that it is not possible to pass special characters to scene. That is big disadvantage for this feature.

Link to comment
Share on other sites

  • 0

I need it to SMsgH, too :(

 

Maybe base64 would help but there is no native base64 function in fibaro api.

I was trying urlencode function, but there is no native urldecode function.

Link to comment
Share on other sites

  • 0
22 hours ago, szmyk said:

I need it to SMsgH, too :(

 

@szmyk, @Sankotronic

Maybe its time to bring back the SMsgH v 1.0

It was invoked with a global variable change and not startScene and hence didn't suffer from the international characters issue 

There were other change with 1.1 but perhaps we could have 2 versions available

 

it's not ideal but perhaps its the best solution for now....

Link to comment
Share on other sites

  • 0

@AutoFrank

Have you tested parallel invocation of SMsgH with global variable? Are there any problems?

StartScene can be run parallel 10 times (after setting scene parameter).

Link to comment
Share on other sites

  • 0
11 minutes ago, szmyk said:

Have you tested parallel invocation of SMsgH with global variable? Are there any problems?

 

@szmyk, I wouldn't think so as only one global is used and that needs to be overwritten so I would assume it's serial flow...I haven't come across a situation where I need to send message that rapidly. If I have parallel requirements, I usually try and space them out by 500ms

Link to comment
Share on other sites

  • 0

@AutoFrank

I have not many scenes and VDs so it's not a big problem for me. But for person who have huge installation like you or @Sankotronic it could be a problem. Two or more scenes or VDs may want to send message at the same time. It's not possible ro run them sequentially because they are independent.

Edited by szmyk
Link to comment
Share on other sites

  • 0
On 18.06.2017 at 3:55 PM, szmyk said:

Is it possible to pass to a scene special characters like ä,ö,ü, ł, ó, ą ?

Actually I get different chararacters: ÄÅÄÅÅ

 

I've found a workaround and described in this post:

 

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
Answer this question...

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