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

Basic Code Clips for LUA starters


Question

Posted

To help those that are not familiar with LUA a starter library of clips that work in Fibaro.

Please add any you find useful.

  • Answers 151
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

Posted Images

Recommended Posts

  • 0
Posted
rcanetta,

Probably you have started a few instances of the same scene. Stop the scene and Add the following code at the beginning before 'while' :

Please login or register to see this code.

I hope it helps.

Hi, thanks - I have done the change

Please login or register to see this code.

but unfortunately for some reason it only works on one window - also, strange enough it works only for sensor with id 38, even if for example sensor 46 was breached before 38.

Should I do one script per each sensor?

Thanks again!

Riccardo

  • 0
Posted

OK here is my First Lua Script that i have been struggling to get it to work..... i know its not much for the expert users but i'm so happy i could make it happen..... Because of the fact that the heating panel does not have temperatures above 33.5 degrees ( which is a shame) i have tried to use lua code to control my heat pumps in order to heat my hot water storage tanks.... sensors are placed in side pockets of the tanks and the code turns on or off the pump...

Please login or register to see this code.

Is this code ok???

i made the sleep function 15minutes right? so i do not power cycle the pump too often...

maybe there is another way to make this happen like add differential temp to the code...

on at 50 degrees and off at 60 for instance....

  • 0
Posted

Please login or register to see this code.

1000 =1s

so

15*60*1000

  • 0
Posted

Ahh ok i see....

Thank you for your reply......

and using this script the temperature is monitored every time??? or is this scene runce once????

how do i make the scene run on time intervals??

i use timer for that??

christos

  • 0
Posted

you got autostart so it works every 1s

better use "while do" with sleep option

  • 0
Posted

PERFECT!!!!!!!!

So here is the revised code

Please login or register to see this code.

Means that the scene sleeps for 2 minutes and executes the command

And with the help of the "optimise network" scene i make sure i don't have dead nodes.....

i'll leave this scene run for a couple of days and see how stable it is....

Christos

  • 0
Posted

rcanetta,

It depends what you want to achieve. If you just want to be informed every 30 minutes which windows are opened then the code is fine and you should even remove the part:

Please login or register to see this code.

If however you want to be informed immediatelly when the window is open and then every 30 minutes then the above code wouldn't work…

What do you really want to achieve ? I hope I can help you.

  • 0
Posted

Hi Richo,

thanks for helping - ideally I would like to be notified immediately when each window is open and then receive a reminder after 30 minutes - the only way I can see to achieve this is to have a script for each window (?) but if you can see a better way...

Thanks a lot

Riccardo

  • 0
Guest Kuuno
Posted

how to send push when HC2 starts.

thanks!

  • 0
Posted

rcanetta,

It should be enough to have one script for all windows to notify about opening with the list of devices triggered and one for testing if it's breached every 30 mins.

[ Dodano: 2013-06-03, 15:01 ]

Kuuno,

try this:

Please login or register to see this code.

  • 0
Guest Kuuno
Posted
rcanetta,

It should be enough to have one script for all windows to notify about opening with the list of devices triggered and one for testing if it's breached every 30 mins.

[ Dodano: 2013-06-03, 15:01 ]

Kuuno,

try this:

Please login or register to see this code.

nope. there was "end" missing but still after reboot no push

what is the meaning of fibaro:call(2 <--

  • 0
Posted

Kuuno,

2 means ID of your IOS device - replace with yours nr.

  • 0
Guest Kuuno
Posted

Any way to change scene icons when triggering them

Eg when i presss play movie scene the icon changes to soemthing that reflects started scene

Thanks

  • 0
Posted

Hello,

someone could help me for creating a LUA scene to activate / deactivate Holiday mode (and set reduced temperature) for a zone of heating panel?

For ex. Scene 1 = Zone 1 -> turn on holiday mode with temp 15°C

Scene 2 = Zone 1 -> turn off holiday mode and return to weekely program

I have already tried with the code wrote by Socha on this post, but for me it's not working...

Someone could help me?

Thanks in advance!

  • 0
Posted

Read one page back

Please login or register to see this image.

/emoticons/default_wink.png" alt=";)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

oh.. now two

Please login or register to see this image.

/emoticons/default_tongue.png" alt=":P" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

oh sorry... ehm. It should work. I have tried it. Tonight I can try to post my code... maybe I changed it a little.

  • 0
Posted

Hello Stevenvd,

I've seen it, but I can't get it working... I can't understand what I'm doing wrong...

Please, could you post your LUA scene? So I can verify with my HC2...

Thank you very much!

  • 0
Posted

mhh... that scene does not seem to be working anymore! haha. haven't used it in a while as I haven't been on holiday

Please login or register to see this image.

/emoticons/default_wink.png" alt=";)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

If you figure it out... let me know

Please login or register to see this image.

/emoticons/default_tongue.png" alt=":P" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> This is what I had in the scene:

Please login or register to see this code.

  • 0
Posted

Hello,

please could you post complete scene?

I can't get it working...

Thank you in advcance

Bye

  • 0
Posted

Please login or register to see this image.

/emoticons/default_icon_mrgreen.gif" alt=":mrgreen:"> from 3.552+

Please login or register to see this code.

  • 0
Posted

Please login or register to see this image.

/emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" /> from 3.552+

Please login or register to see this code.

Thank you so much for that

Please login or register to see this image.

/emoticons/default_icon_wink.gif" alt=";-)" />

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