more G-Labs products

Author Topic: Really slow response with zwave and occasional flashing lights  (Read 1237 times)

March 07, 2016, 01:36:53 AM
Read 1237 times

vortmax

  • *
  • Information
  • Newbie
  • Posts: 8
I have a somewhat new problem that is baffling me.

First of all, when I trigger any program that turns multiple lights on or off,  I'm getting a 10 to 20 second delay between them. This happens if I manually trigger the program or have it trigger automatically.   Also, occasionally one light will start to slowly cycle on and off after the program triggers, as if it's being repeatedly commanded on, off, on, off, etc....

The only thing I've added were three programs.  One that lungs my wife's and my phones and sets a "isHome" parameter (but doesn't actually do anything zwavey), and two more that turn off lights when "isHome" goes to false and turns them on if "isHome" becomes true.   Both of the last two scripts are wizard scripts and I've debugged the first to make sure it wasn't glitching and spamming a bunch of commands.

The only other oddity I've seen are time out errors that are new since I updated a while back,  some reoccurring error with the sql database (that I think broke energy monitoring).

Anyone have an idea of what could be happening or how to figure it out?

March 07, 2016, 08:54:42 PM
Reply #1

nolio

  • *****
  • Information
  • Global Moderator
  • Posts: 544
Hi,
First of all, when I trigger any program that turns multiple lights on or off,  I'm getting a 10 to 20 second delay between them. This happens if I manually trigger the program or have it trigger automatically.
On my side, this kind of stuff come when i start the whole system, but i use raspbian jessie which is not re commended for now ;)
Also, occasionally one light will start to slowly cycle on and off after the program triggers, as if it's being repeatedly commanded on, off, on, off, etc....
My familly tell me that kind of things on my side too, but i didn't see ... Not often, perhaps one time ...
Anyone have an idea of what could be happening or how to figure it out?
Activate the log and take a look when something like that append ... But perhaps you already did ...

March 07, 2016, 09:23:00 PM
Reply #2

kevinvinv

  • ****
  • Information
  • Sr. Member
  • Posts: 196
This is no help to you but I'd love to see the code that detects when your phone is in the house!!  That sounds pretty cool!!

March 07, 2016, 09:46:29 PM
Reply #3

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
That's a built-in APP.  I think it's the "Ping Me At Home" code, but I could be wrong.  I believe it looks for when your phone returns a ping at it's assigned IP address.

EDIT: Here's an updated version that knows multiple people.
http://www.homegenie.it/forum/index.php?topic=1174
« Last Edit: March 07, 2016, 09:48:05 PM by bkenobi »

March 08, 2016, 04:35:20 AM
Reply #4

vortmax

  • *
  • Information
  • Newbie
  • Posts: 8
This is no help to you but I'd love to see the code that detects when your phone is in the house!!  That sounds pretty cool!!

Here's the code.  I roughly based it on the included "pingme" code.  It doesn't work with the alarm system...it just always pings and raises "home" or "notHome" events.  I also made it able to discern my wife and my phones, so it knows who's home.  I have a range extender that mangles MAC addresses, so each person has 2 possible IP's, which is why the check looks funny.  I'm working now on making it more generic....I think I can pull it off with a virtual module. 

Program Code:
Code: [Select]
  int missed_ping_matt  = 0;
    int missed_ping_laura = 0;
 
  bool[] isAlive = new bool[4]{ false, false, false, false };
 
    int loop_count = 0;

bool first_run = true;

while (Program.IsEnabled)
{
   
  isAlive[0] = false;
    isAlive[1] = false;
    isAlive[2] = false;
    isAlive[3] = false;

    int max_missed = 0;
    Int32.TryParse(Program.InputField("PhoneScan.MissedAttempts").Value, out max_missed );
 
    //Ping all the addresses
    if (Program.InputField("PhoneScan.Address1").Value != "")
    {
    isAlive[0] = Net.Ping(Program.InputField("PhoneScan.Address1").Value);
    }
       
    if (Program.InputField("PhoneScan.Address2").Value != "")
    {
    isAlive[1] = Net.Ping(Program.InputField("PhoneScan.Address2").Value);
    }
     
    if (Program.InputField("PhoneScan.Address3").Value != "")
    {
    isAlive[2] = Net.Ping(Program.InputField("PhoneScan.Address3").Value);
    }
       
    if (Program.InputField("PhoneScan.Address4").Value != "")
    {
    isAlive[3] = Net.Ping(Program.InputField("PhoneScan.Address4").Value);
    }
       
   
    //----------------------------------------------------------------------------
    // Check for missed pings
       
 
 
    //if both addresses are down, the phone is not in the house 
    if (isAlive[0] == false && isAlive[1] == false)
    {
        //if we think the phone is alive
        if( Program.Parameter("PhoneScan.MattHome").Value == "true" )
        {
          //increment the ping counter
          missed_ping_matt++;
         
          //if we exceed the missed ping threshold
          if ( missed_ping_matt > max_missed )
          {
            //we are no longer home so set/alert the parameter
            if( !first_run ) Program.RaiseEvent("PhoneScan.MattHome", "false", "Matt is not home"); else Program.Parameter("PhoneScan.MattHome").Value = "false";
           
            //see if we need to raise the "empty house" event
            if( Program.Parameter("PhoneScan.LauraHome").Value == "false" )
            {
                //Both people are gone, so raise/set house empty
                if( !first_run ) Program.RaiseEvent("PhoneScan.HouseEmpty", "true", "The house is empty"); else Program.Parameter("PhoneScan.HouseEmpty").Value = "true";
            }
          }
         
        }else{
          //the phone is still not home, like we thought
          missed_ping_matt = 0;
        }
     
    //Else a phone has been detected 
    }else{
        missed_ping_matt = 0;
     
        //if we think the phone isn't home
        if( Program.Parameter("PhoneScan.MattHome").Value == "false" )
        {
            //The phone was detected, so update the parameter
            if( !first_run ) Program.RaiseEvent("PhoneScan.MattHome", "true", "Matt is home"); else Program.Parameter("PhoneScan.MattHome").Value = "true";
         
            //see if we need to raise the "someone home" event
            if( Program.Parameter("PhoneScan.HouseEmpty").Value == "true" )
            {
                //If the house was empty, it isn't now
                if( !first_run ) Program.RaiseEvent("PhoneScan.HouseEmpty", "false", "Someone is home"); else  Program.Parameter("PhoneScan.HouseEmpty").Value = "false";
            }
        }
    }
       
 
    //--------------------------------------------------------------------------------------------------
    // Laura's phone
    //if both addresses are down, the phone is not in the house 
    if (isAlive[2] == false && isAlive[3] == false)
    {
        //if we think the phone is alive
        if( Program.Parameter("PhoneScan.LauraHome").Value == "true" )
        {
          missed_ping_laura++;
         
          //if we exceed the missed ping threshold
          if ( missed_ping_laura > max_missed )
          {
   
            if( !first_run ) Program.RaiseEvent("PhoneScan.LauraHome", "false", "Laura is not home"); else  Program.Parameter("PhoneScan.LauraHome").Value = "false";
           
            //see if we need to raise the "empty house" event
            if( Program.Parameter("PhoneScan.MattHome").Value == "false" )
            {
                //we are no longer home
                if( !first_run ) Program.RaiseEvent("PhoneScan.HouseEmpty", "true", "The house is empty"); else Program.Parameter("PhoneScan.HouseEmpty").Value = "true";
            }
          }
         
        }else{
          //the phone is still not home, like we thought
          missed_ping_laura = 0;
         
        }
     
    //Else a phone has been detected 
    }else{
        missed_ping_laura = 0;
     
        //if we think the phone isn't home
        if( Program.Parameter("PhoneScan.LauraHome").Value == "false" )
        {
            if( !first_run ) Program.RaiseEvent("PhoneScan.LauraHome", "true", "Laura is home"); else  Program.Parameter("PhoneScan.LauraHome").Value = "true";   
         
            //see if we need to raise the "someone home" event
            if( Program.Parameter("PhoneScan.HouseEmpty").Value == "true" )
            {
                if( !first_run ) Program.RaiseEvent("PhoneScan.HouseEmpty", "false", "Someone is home"); else Program.Parameter("PhoneScan.HouseEmpty").Value = "false";
            }
        }
    }       
 
  if( first_run ) first_run = false;
 
  // Pause for PollRate seconds
  int pause_int = 10;
  Int32.TryParse(Program.InputField("PhoneScan.PollRate").Value, out pause_int );
  Pause( pause_int );
 
}


Trigger Code:
Code: [Select]
Program.Setup( () => {
 
    Program.AddInputField("PhoneScan.Address1", "", "IP address to ping #1");
    Program.AddInputField("PhoneScan.Address2", "", "IP address to ping #2");
    Program.AddInputField("PhoneScan.Address3", "", "IP address to ping #3");
  Program.AddInputField("PhoneScan.Address4", "", "IP address to ping #4");
 
 
    Program.AddInputField("PhoneScan.MissedAttempts", "", "Number of missed attempts to allow");
    Program.AddInputField("PhoneScan.PollRate", "", "Interval to poll devices");

  Program.Parameter("PhoneScan.MattHome").Value   = "false";
    Program.Parameter("PhoneScan.LauraHome").Value  = "false";
    Program.Parameter("PhoneScan.HouseEmpty").Value = "true";
 
});

return true;

March 08, 2016, 04:41:29 AM
Reply #5

vortmax

  • *
  • Information
  • Newbie
  • Posts: 8
Hi,
First of all, when I trigger any program that turns multiple lights on or off,  I'm getting a 10 to 20 second delay between them. This happens if I manually trigger the program or have it trigger automatically.
On my side, this kind of stuff come when i start the whole system, but i use raspbian jessie which is not re commended for now ;)
Also, occasionally one light will start to slowly cycle on and off after the program triggers, as if it's being repeatedly commanded on, off, on, off, etc....
My familly tell me that kind of things on my side too, but i didn't see ... Not often, perhaps one time ...
Anyone have an idea of what could be happening or how to figure it out?
Activate the log and take a look when something like that append ... But perhaps you already did ...

I'm running this on an older PC running windows 7.  I thought it was plenty powerful, but it might be underpowered.

I'm going to try the logging, but I haven't found a good, reliable way to reproduce the issue...which makes it huge pain to sort through logs and find the issue.  Has anyone written a logfile parser to translate the zwave packets into a human readable format?

March 08, 2016, 10:38:22 AM
Reply #6

emerich

  • ***
  • Information
  • Full Member
  • Posts: 73
Hi,

I have the same problem with my installation on a RPI2. I have some z-wave radiator valves which I send the SetTemperature command after they wake up. I sent about six commands down to the valve and it took about 30 seconds to send all commands. After a reboot it lasts about 1,5 seconds. So as longer the Pi is up as longer it takes to send the commands. Also the duration between motion detection and turning on a light increases over the time.

My solution is to restart the application each day at midnight.

If there is a solution I would also be interested in.

br. Christian