Jump to content

Simple programming help? Specific status change of node


someguy
Go to solution Solved by someguy,

Recommended Posts

here is what I'm trying to do:  I want to be notified if I'm driving away from the house and my garage door is left open.  I'm using my TeslaEV Node server (which is great by the way) to tell where my car is.  it has three results for "Homelink In Range":  "true", "false" and "unknown".  

I would like it to only check to see if the garage door is open when it changes from "true" to "false" (and not when it changes from "unknown" to "false").   this seems so simple but i can't come up with a way to make it work.  

any help would be appreciated.  

Link to comment

Two programs and a state variable should accomplish this:

(the only case I can think of for unknown is when the ISY restarts, do I have that correct?) 

If
     Homelink In Range is true
then
     sHomelink = 1
else
     sHomelink = 0

-----

If
                sHomelink = 0
       AND GarageDoor is open
then
      Notify

One difficult is that we can't test for "unknown" in an IF statement.   Unknown to False should cause the first program to run and evaluate false, or 0, which the variable should already be because the ISY is starting up (leave the INIT VALUE of the variable at 0 of course.)

Link to comment

@MrBill as i run through the logic of your answer, I'm not sure it will work.  with the way you have it set up, anytime the garage door is open, it will notify me if I am out of range of the homelink.  so if someone opens the garage door while I'm away from home, it would notify me.  (I am part of a family of 6 so the garage does get opened while I'm away fairly often.)

also:  if the homelink nearby indicator goes from "true" to "unknown" while I'm away from home, it would also notify me if the garage door happens to be open.  unfortunately, this homelink nearby indicator often goes to "unknown" for a period of time and then switches back to "false".  

am I wrong or are there other suggestions?

Link to comment
14 hours ago, someguy said:

it has three results for "Homelink In Range":  "true", "false" and "unknown".  

Are there 3 actual states that the node can be in?  In other words is "unknown" an actual state that can be tested or is unknown like blank until it gets updated the first time?  I am using another NS and "unknown" is an actual state that I am using programmatically.

If I understand you only want to be notified when you leave so program it that when true>false occurs it's locked out from further notifications until it becomes true again when you get home.

You also said:

if the homelink nearby indicator goes from "true" to "unknown" while I'm away from home.  Can it be true if you're not home? 

Edited by tmorse305
Link to comment
13 hours ago, someguy said:

am I wrong or are there other suggestions?

You're not wrong, I just didn't understand the issue fully.   One more program, but it can be done.

Program 1

If
     Homelink In Range is true
then
     sHomelink = 1
else
     sHomelink = 0

-----

Program 2

If
                sHomelink = 0
then
                Run Program 3 (if)

else
                (none)
------

Program 3 (Disabled)

If
          Garage door is open
then
           Notify

Disabled programs do run when run by another program, they won't however start based on the condition in the IF statement.  It's important that Program 3 is disabled.

The only time the variable sHomelink should become zero is when True is no longer the state, or at ISY startup.

 

 

 

Link to comment
  • 2 weeks later...
  • Solution

The problem with the above solution was that “program 2” will run every time that the device goes from “unknown” to “away” which is fairly often. 
 

I decided to abort this part, although I did work it out, and use my geofence setting from my HD mobile app to indicate when I leave the house. 

Thank you for the help and time. 

Link to comment
1 hour ago, someguy said:

The problem with the above solution was that “program 2” will run every time that the device goes from “unknown” to “away” which is fairly often. 

I didn't think that would happan but can now see that it probably would.  The problem being that he node server (which I don't have) apparently returns the value "unknown" rather the value actually being unknown, the state before the value is known. 

In any case I could make it work using a second variable but if you've done something else I won't waste any time fixing it.

Link to comment
Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Forum Statistics

    • Total Topics
      36.9k
    • Total Posts
      370.2k
×
×
  • Create New...