Jump to content

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. 

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

Link to post
Share on other sites
  • 0

@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?

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

Link to post
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...