Please login or register.

Login with username, password and session length

Author Topic: "EvolSmartLight.hgx" Automatic module shut off after time,motion,or light level  (Read 1652 times)

mike

  • Hero Member
  • *****
  • Helpful Post Rating: 14
  • Posts: 1057

This is a great program to turn off modules after they are turned on!
« Last Edit: October 28, 2020, 04:35:14 PM by mike »
Logged

bkenobi

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 24
  • Posts: 2081

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

mike

  • Hero Member
  • *****
  • Helpful Post Rating: 14
  • Posts: 1057

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();
      }
Logged

bkenobi

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 24
  • Posts: 2081

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.
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.