HomeGenie Forum
General Category => Troubleshooting and Support => Topic started by: IanR on August 24, 2016, 04:43:46 AM
-
Hello
I have found in http://www.homegenie.it/forum/index.php?topic=1009.0 (http://www.homegenie.it/forum/index.php?topic=1009.0) a reference to a program that can make the dimmer reset to 100% when the unit is switched on.
But I cant find the program what is it called?
I have tried "level memory program" but is dose what is called and returns the dimmer to last level not 100%
Ian
-
I know I use this script in my setup, but I'm having a tough time finding it this morning. I'll look again, but when I'm remote the menus are REALLY slow to load so it takes a long time to check through each section.
-
Ok, found it!
PID: 84
Programs -> X10 -> "Set to 100% when switched on"
I thought I was using it, but it's turned off. I don't know if it's been moved since I installed HG last but you should be able to find it in that location or something similar. Worst case, you can search through the modules.xml file and locate it that way. If for some reason it's not installed with the stock build anymore, you can use the attached export. I'd recommend using the built in one if it's there.
-
Hello
If its in the x10 section will it work on Z-wave?
Ian
-
Hello
I have tried the x10 program and it dose not work on z-wave.
So I am trying to write my own program but cant find how to send the required value to the dimmer to set it to 100%.
Program.Notify("***What do I put in here***", module.Instance.Name + "<br>" + module.Instance.Address + " set to " + "99.00");
or am i total off track?
Ian
-
Yes, totally off track. That command will simply pop up a notification in the interface not do anything with zwave. You need to set the level parameter to change the dim level.
-
The reason this does not work with zwave is pretty self explanatory once you look at the code.
// We want to do further processing whenever a module changes
When.ModuleParameterIsChanging( (module, property) => {
if (module.HasFeature("X10.LevelFix") && module.IsOfDeviceType("Dimmer") && property.Name == "Status.Level")
{
var level = module.Parameter("Status.Level");
var lastlevel = module.Parameter("Status.LastLevel");
//
bool justswitchedon = (level.DecimalValue > 0 && lastlevel.DecimalValue == 0);
lastlevel.Value = level.Value;
if (justswitchedon)
{
Program.Notify("X10 Auto Bright", module.Instance.Name + "<br>" + module.Instance.Address + " set to 100%");
module.Command("Control.Bright").Set("100");
return false; // <-- prevent ModuleParameterChanged event from being fired
}
}
return true; // <-- continue routing event to other listeners
});
Program.GoBackground();
The first logic statement has
module.HasFeature("X10.LevelFix")
as one of the checks. Zwave won't have this feature, so it will not work on those modules. The command that actually sets the dim level is down further.
module.Command("Control.Bright").Set("100");
If you want to use this with zwave, you need to change the logic statement so it will also include a hasfeature for zwave (or some other way to verify that the specific module will work with your code you want to run against it). I'd recommend a review of the zwave feature set in HG and/or trial and error coding. I don't think there's any reason you couldn't get this to work with minimal effort though.
-
Hello
So I have been trying to create a program to turn all my z-wave dimmer on to full (99%) when switched on. see code below. It works. (if a bit messy)
But it cant tell if the user has switched it on using the input switch i1 or if HG has switched it on. Is there a way to tell the code the difference?
Code:
//
// When z-wave light is switched and is on then change it to 100%
//
When.ModuleParameterChanged( (module, parameter) => {
// when switched on
if (module.IsOfDeviceType("Dimmer") && parameter.Name == "Status.Level")
{
// Check if the module has just been turned on from zero and is currently on
if ( parameter.Statistics.Last.Value == 0 && module.Level != 0)
{
// setup and set historry level to 99% so it will not try and revert back.
var memory = module.Parameter("Status.MemoryLevel");
memory.Value = "0.99";
// set the current level to 99% if you change this to 100% it crashes HG so don't
module.Level = 99;
// returning false, prevent from routing event to other listeners
return false;
}
}
// returning true, will route event to other listeners
return true;
});
Program.GoBackground();
Ian