X10 Community Forum

📱🖥️PiX10Hub ( Always Evolving Open Source) => 💬General Discussion => 📝User created HG Scripts (programs/macros/widgets) => Topic started by: mike on October 28, 2020, 01:02:03 PM

Title: "EvolSmartLight.hgx" Automatic module shut off after time,motion,or light level
Post by: mike on October 28, 2020, 01:02:03 PM
This is a great program to turn off modules after they are turned on!
Title: Re: "EvolSmartLight.hgx" Automatic module shut off after time,motion,or light level
Post by: bkenobi on October 28, 2020, 03:35:40 PM
This is available via the package manager in HG.  There is no reason to share a copy here when there is source available to install easily within the interface.  Might also be nice to site the author (noliono) when posting their work so it doesn't come across as though you were taking credit.   ???
Title: Re: "EvolSmartLight.hgx" Automatic module shut off after time,motion,or light level
Post by: mike on October 29, 2020, 03:15:56 PM
Just wanted to add a small tweak I made to noliono's downloadable program.  He ended the program with:

      if (elapsed.TotalSeconds > timeout) {
        Program.Notify(mod.Instance.Address + " " + mod.Instance.Name + "<br>switched OFF.");
        mod.Off();
      }

I added a few more PLC off commands to try to be more robust:

      if (elapsed.TotalSeconds > timeout) {
        Program.Notify(mod.Instance.Address + " " + mod.Instance.Name + "<br>switched OFF.");
        mod.Off();
        Pause(1);
        mod.Off();
        Pause(1);
        mod.Off();
      }
Title: Re: "EvolSmartLight.hgx" Automatic module shut off after time,motion,or light level
Post by: bkenobi on December 25, 2020, 06:25:24 PM
If you are having reliability issues with your system, I would recommend 2 options.

1) find the noise/signal sucker and resolve it directly.  This will help your entire system not just this one module.

2) instead of modifying the code here, I'd recommend creating a new program that looks for changes on a module.  If that module has the code enabled, have it send multiple commands for that single module.

The update you suggest will work, but it's a bit of a sledge hammer to a problem needing a half twist of a screw driver.