Jump to content
Guides for the Forum Read more... ×
Poradniki na Forum Read more... ×
FIBARO Home Center App 1.0.0 - release Read more... ×
FIBARO Home Center App 1.0.0 - wydanie Read more... ×

Question

Can someone help me. I have been thinking about how the logic would work and cannot come up with the correct Lua code to make this work correctly.

 

Goal: want the door to unlock when I arrive at home and lock when I leave and send a message (push, email etc..) every time. but if I am home/not home I don't want it to keep locking/unlocking and sending me a message

 

*I already have fibaro looking for my phone to see if I'm present. a global variable keeps a number count present =1 not present = 0

 

 

 

so the logic I came up with is like this:

 

Check

 

Present=0 then lock door and send message

 

check 

 

present =0 (still not at home) do nothing

 

check

 

present = 1 unlock door and send message

 

check

 

present = 1 (still at home) do nothing

 

etc...

 

 

let me know if you have questions or suggestions. 

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hi, 

 

I use a mechanism in my LAN monitor VD (see link in my signature to find VD) to send just one message when a device goes offline and another one when it comes back online.

 

It uses a table/array (stored in a global variable ) to track both offline and online state of the device but another table element to track if the message was sent when the state changed ( I think it is called alerttrack in my code)

When the device changes state, it sends message and sets alerttrack=1. This then prevents it from sending message again.

When the device changes state again it sets alerttrack =0, sends message, sets alerttrack=1 again.

 

It would seem similar to what you're looking to do.

 

Take a look at the code and it should be obvious how it works ...

Share this post


Link to post
Share on other sites
  • 0
  • Inquirer
  • @AutoFrank
     

    I will give this a try. is there anyway that you can have it send a push notification to your phone instead of an email?

    Share this post


    Link to post
    Share on other sites
    • 0

    I'm sure there is. I'm not at home at the moment but if you search the forum you should find that code ..

    The code i referenced should be broken down for the parts you need to send the 'alert once. After that, if it's a viable solution, you'll need to build out your own solution ....

    Share this post


    Link to post
    Share on other sites
    • 0
    On 8/21/2018 at 10:10 PM, amatt said:

    I will give this a try. is there anyway that you can have it send a push notification to your phone instead of an email?

    1

     

    For push notifications have you tried 

    Please login or register to see this link.

     

    Share this post


    Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

    ×