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


Question

Posted

Hi

Im Serching for a simple Lua Script that sends me a Message when the outdoor temperature is under the indoor temperature.

My Outdoor temp Sensor is ID: 263 and indoor temp Sensor ID is 258.

 

Can me anybody help Please?

Thanks a Lot!

15 answers to this question

Recommended Posts

  • 0
Posted

Hi @FabianM,

Maybe this can help.

 

 

  • 0
  • Inquirer
  • Posted

    Thank You. Yes this helps me a lot.

    I now have make my own Lua Script but have one Problem. I Have to Trigger the scene manualy but i want to trigger the scene every time when the Temperature changes and pause after a post was sent.

     

    What is wrong in My Script?

     

    (Sorry some of the debug messages are in German, but that should not be the problem i think)

     

    Please login or register to see this code.

    Thanks!

    • 0
    Posted

    I think (I don’t use the HC2 any more) you need

     

    %% autostart

     

     

    • 0
  • Inquirer
  • Posted
    32 minutes ago, SmartHomeEddy said:

    I think (I don’t use the HC2 any more) you need

     

    %% autostart

     

     

     
    Unfortunately i already tried this, but it dont works though.
    • 0
    Posted

    Hi @FabianM.

     

    I'm not an expert in LUA and never had an HC2. But some forum members advice an infinty loop for checking the value's.

    Or maybe you could trigger the scene every minute or so with a time trigger, if the HC2 is capable of doing so.

    • 0
  • Inquirer
  • Posted
    25 minutes ago, Flash said:

    Hi @FabianM.

     

    I'm not an expert in LUA and never had an HC2. But some forum members advice an infinty loop for checking the value's.

    Or maybe you could trigger the scene every minute or so with a time trigger, if the HC2 is capable of doing so.

     

    OK, but how i make souch a Loop? (Or Trigger Time)

    • 0
    Posted

    @FabianM

    I don't own a hc2 either but perhaps:

    if outside temp or inside temp changes run that scene

    • 0
    Posted (edited)
    17 minutes ago, akatar said:

    if outside temp or inside temp changes run that scene

    Hi @akatar,

    Do you have a nice solutions how to detect the temperature changed? Without a infinty "While Do "loop or a time triggering.

     

    I found i HC3 LUA script from @10der.

    But I don't know how to convert it to HC2 LUA

     

    Device 490 is a lux sensor.

    conditions = {
            { type = "device",
            id = 490,
            property = "value",
            operator = "!=",

            value = -1
            isTrigger = true
            }},
        operator = "all"

     

     

     

    Edited by Flash
    • 0
    Posted

    @Flash

    I am sorry, perhaps a search on this forum will bring something up.

    • 0
    Posted
    2 minutes ago, akatar said:

    I am sorry, perhaps a search on this forum will bring something up

    No problem,  still learning and every input is always'welcome.

    • 0
    Posted

    @FabianM Well!

     

    HC2 can't have a crontab.

    so for periodicaly running you should use scene.

    my fav scene for it WAS (sorry i am on hc3 now) scene by @jgab - Timer

    Please login or register to see this attachment.

    just create scene with this body. thats all.

    the next step scheduling

    so we are need peridicaly checking,

    just create new empty script 

    with this content

     

    Please login or register to see this code.

     

    • 0
  • Inquirer
  • Posted

    @10der  Thank You. Looks realy dificult. I am still testing on it.

    But it is much different than my starting position. Is there no simpler way with just one Lua Scene like my scene? Where can i define the timeout time of the Message? How can i define only send the Push to my ids 99 and 1500?

     

    Is it not possible to change my existing Script to a Working one which triggers every time the temperature of my outdoor device is changing?

     

    Or do i make a mistake in thinking?

     

    Thanks for Answers and ideas! :-)

    • 0
    Posted (edited)

    Hi fabian,

     

    The problem with using a temperature as trigger is that it won't trigger with small changes and temperature changes aren't very big usually. I found this out recently. You can use the following script which will run every 5 minutes. With changed ID numbers it works here.

     

    PS: here it is also very hot right now and every evening I am happy to open all the windows ? (actually I open them early and all my shutters open automatically when the temp is low enough

    Please login or register to see this code.

     

     

    Edited by Jeroen_
    • Like 1
    • 0
  • Inquirer
  • Posted

    @Jeroen_  Thank You. Exactli what i think about it. I only was searching for the "while thrue do"

     

    - Now i add a "delete duplicate scene" Line and some indivitual sleep Times and my Lua Works like i want. Here is my Full Code. Anybody finds a error please let me know - but for now it is running like i want.

     

    Please login or register to see this code.

     

    • 0
    Posted

    Happy to help. In this case you don't need to delete duplicate scene's while there is no trigger for this scene. It will run directly after booting your system. The only way to create a duplicate is to start it manually. But of course it won't harm your code having it in there ?

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