Help with turning off dimmer when light hits 1%

It does have a LoadLevelStatus. This variable shows the percentage of dim that is is currently on. So yes. I have that ability to see where it is at. What I do not know how to do is write code that says

If LoadLevelStatus <= 4 then Set LoadLevelStatus = 0 AND Set LoadlevelLast = xx

Right now I’m trying to use PLEG. In Pleg I can create the Device Property LoadLevelStatus (P1). And then I can create the IF P1 <= 4 then (and this is where it gets funky because when I go to the action part of PLEG It does not have any of the same variables that the switch has but it does have LastLevelTarget) So I finish my PLEG with IF P1 <=4 then ACTION LoadLevelTarget = 0. This turns the switch off when the dimmer is set to 4% or below. I just need to figure out how to get the AND part of that to set the LoadLevelLast to a desired number. And LoadLevelLast is not part of the Action options even though it’s a device variable.

In the action, you can add another instance of device so it appears twice. Here is an example of my thermostat.

You should be able to set LoadLastLevel to XX and in the second instance, LoadLevelStatus to 0.

[quote=“Greybeardvacationrental, post:21, topic:196577”]It does have a LoadLevelStatus. This variable shows the percentage of dim that is is currently on. So yes. I have that ability to see where it is at. What I do not know how to do is write code that says

If LoadLevelStatus <= 4 then Set LoadLevelStatus = 0 AND Set LoadlevelLast = xx

Right now I’m trying to use PLEG. In Pleg I can create the Device Property LoadLevelStatus (P1). And then I can create the IF P1 <= 4 then (and this is where it gets funky because when I go to the action part of PLEG It does not have any of the same variables that the switch has but it does have LastLevelTarget) So I finish my PLEG with IF P1 <=4 then ACTION LoadLevelTarget = 0. This turns the switch off when the dimmer is set to 4% or below. I just need to figure out how to get the AND part of that to set the LoadLevelLast to a desired number. And LoadLevelLast is not part of the Action options even though it’s a device variable.[/quote]

I think you have to make a choice here… either work with PLEG and the ease of use combined with the lack of deep flexibility (like this - combining variable settings with simple controls), or learn how to write code for programming to generate your own controls and events.

If you were to drop the PLEG routine you have all together, you could replace it with a single scene in VERA that would detect that the switch had been turned “way down” (less than 5%) and then turn it off AND change the settings. Otherwise, someone turning the switch off correctly would allow it to come back on at that level. This is a MUCH more elegant solution overall (IMHO) because the scene can be set with the trigger point literally being “less than 5%” and the action being the LUA code. A normal “OFF” event is ignored.

Or, how about this… does your dimmer have a configurable parameter for minimum and maximum brightness levels like Fibaro devices?

If so, set the minimum brightness to say 10%.

Then it won’t even be possible for someone to dim it to the point where they “think” it is off, the lights will still be on at a very obvious level and then they still have to turn it off.

[quote=“Don Phillips, post:22, topic:196577”]In the action, you can add another instance of device so it appears twice. Here is an example of my thermostat.

You should be able to set LoadLastLevel to XX and in the second instance, LoadLevelStatus to 0.[/quote]

Thanks Don. I have tried this but the options in the ACTION drop down are not the same as the parameters of the device. There is no LoadLevelLast in the drop down in the Action part of the PLEG. When I create a Device Property and choose a dimmer I see all the parameters of that dimmer. But by the time I get to the Logic Actions and then try to choose what action I want those same parameters are not there.

[quote=“ember1205, post:23, topic:196577”][quote=“Greybeardvacationrental, post:21, topic:196577”]It does have a LoadLevelStatus. This variable shows the percentage of dim that is is currently on. So yes. I have that ability to see where it is at. What I do not know how to do is write code that says

If LoadLevelStatus <= 4 then Set LoadLevelStatus = 0 AND Set LoadlevelLast = xx

Right now I’m trying to use PLEG. In Pleg I can create the Device Property LoadLevelStatus (P1). And then I can create the IF P1 <= 4 then (and this is where it gets funky because when I go to the action part of PLEG It does not have any of the same variables that the switch has but it does have LastLevelTarget) So I finish my PLEG with IF P1 <=4 then ACTION LoadLevelTarget = 0. This turns the switch off when the dimmer is set to 4% or below. I just need to figure out how to get the AND part of that to set the LoadLevelLast to a desired number. And LoadLevelLast is not part of the Action options even though it’s a device variable.[/quote]

I think you have to make a choice here… either work with PLEG and the ease of use combined with the lack of deep flexibility (like this - combining variable settings with simple controls), or learn how to write code for programming to generate your own controls and events.

If you were to drop the PLEG routine you have all together, you could replace it with a single scene in VERA that would detect that the switch had been turned “way down” (less than 5%) and then turn it off AND change the settings. Otherwise, someone turning the switch off correctly would allow it to come back on at that level. This is a MUCH more elegant solution overall (IMHO) because the scene can be set with the trigger point literally being “less than 5%” and the action being the LUA code. A normal “OFF” event is ignored.[/quote]

Thanks. I agree. I am just making sure I’m not missing something in trying to use the system or the plug in before I embark on becoming a computer programmer. But if it is what must be done then I will have to. Or maybe someone with LUA experience can just rattle it off their hip because they already have the experience. :slight_smile:

[quote=“Tillsy, post:24, topic:196577”]Or, how about this… does your dimmer have a configurable parameter for minimum and maximum brightness levels like Fibaro devices?

If so, set the minimum brightness to say 10%.

Then it won’t even be possible for someone to dim it to the point where they “think” it is off, the lights will still be on at a very obvious level and then they still have to turn it off.[/quote]

Excellent suggestion. There is no obvious parameter in the advanced settings for the dimmers to set a minimum but I can research it or contact the company to find out if there is a command that I can add.

Thanks!

[quote=“Greybeardvacationrental, post:26, topic:196577”][quote=“ember1205, post:23, topic:196577”][quote=“Greybeardvacationrental, post:21, topic:196577”]It does have a LoadLevelStatus. This variable shows the percentage of dim that is is currently on. So yes. I have that ability to see where it is at. What I do not know how to do is write code that says

If LoadLevelStatus <= 4 then Set LoadLevelStatus = 0 AND Set LoadlevelLast = xx

Right now I’m trying to use PLEG. In Pleg I can create the Device Property LoadLevelStatus (P1). And then I can create the IF P1 <= 4 then (and this is where it gets funky because when I go to the action part of PLEG It does not have any of the same variables that the switch has but it does have LastLevelTarget) So I finish my PLEG with IF P1 <=4 then ACTION LoadLevelTarget = 0. This turns the switch off when the dimmer is set to 4% or below. I just need to figure out how to get the AND part of that to set the LoadLevelLast to a desired number. And LoadLevelLast is not part of the Action options even though it’s a device variable.[/quote]

I think you have to make a choice here… either work with PLEG and the ease of use combined with the lack of deep flexibility (like this - combining variable settings with simple controls), or learn how to write code for programming to generate your own controls and events.

If you were to drop the PLEG routine you have all together, you could replace it with a single scene in VERA that would detect that the switch had been turned “way down” (less than 5%) and then turn it off AND change the settings. Otherwise, someone turning the switch off correctly would allow it to come back on at that level. This is a MUCH more elegant solution overall (IMHO) because the scene can be set with the trigger point literally being “less than 5%” and the action being the LUA code. A normal “OFF” event is ignored.[/quote]

Thanks. I agree. I am just making sure I’m not missing something in trying to use the system or the plug in before I embark on becoming a computer programmer. But if it is what must be done then I will have to. Or maybe someone with LUA experience can just rattle it off their hip because they already have the experience. :)[/quote]

I’m not a programmer by any stretch, but have written all of my own LUA. I start with a simple “If this is true, do that” sort of writeup. Then I add detail to each section until I have what I need.

[quote=“ember1205, post:28, topic:196577”][quote=“Greybeardvacationrental, post:26, topic:196577”][quote=“ember1205, post:23, topic:196577”][quote=“Greybeardvacationrental, post:21, topic:196577”]It does have a LoadLevelStatus. This variable shows the percentage of dim that is is currently on. So yes. I have that ability to see where it is at. What I do not know how to do is write code that says

If LoadLevelStatus <= 4 then Set LoadLevelStatus = 0 AND Set LoadlevelLast = xx

Right now I’m trying to use PLEG. In Pleg I can create the Device Property LoadLevelStatus (P1). And then I can create the IF P1 <= 4 then (and this is where it gets funky because when I go to the action part of PLEG It does not have any of the same variables that the switch has but it does have LastLevelTarget) So I finish my PLEG with IF P1 <=4 then ACTION LoadLevelTarget = 0. This turns the switch off when the dimmer is set to 4% or below. I just need to figure out how to get the AND part of that to set the LoadLevelLast to a desired number. And LoadLevelLast is not part of the Action options even though it’s a device variable.[/quote]

I think you have to make a choice here… either work with PLEG and the ease of use combined with the lack of deep flexibility (like this - combining variable settings with simple controls), or learn how to write code for programming to generate your own controls and events.

If you were to drop the PLEG routine you have all together, you could replace it with a single scene in VERA that would detect that the switch had been turned “way down” (less than 5%) and then turn it off AND change the settings. Otherwise, someone turning the switch off correctly would allow it to come back on at that level. This is a MUCH more elegant solution overall (IMHO) because the scene can be set with the trigger point literally being “less than 5%” and the action being the LUA code. A normal “OFF” event is ignored.[/quote]

Thanks. I agree. I am just making sure I’m not missing something in trying to use the system or the plug in before I embark on becoming a computer programmer. But if it is what must be done then I will have to. Or maybe someone with LUA experience can just rattle it off their hip because they already have the experience. :)[/quote]

I’m not a programmer by any stretch, but have written all of my own LUA. I start with a simple “If this is true, do that” sort of writeup. Then I add detail to each section until I have what I need.[/quote]

Yeah I’ll just have to take some time to figure out how to write LUA code. One of these days I’ll work it in.

It really shouldn’t be all that difficult. Right now, PLEG is detecting when the dimmer drops down below 5%. Your action is to turn the dimmer off at that point. You could change that as follows:

  • Create a virtual on/off switch
  • Have PLEG turn the virtual switch on when the dimmer drops below 5% (instead of turning the light off)
  • Create a scene that detects when the virtual switch is turned on
    • Immediate action is to turn the virtual switch off AND the dimmed switch off
    • LUA code sets the variables we’ve already talked about

Done.

If someone partly dims the switch and then turns it off, it will come back on at the last level it was dimmed to.

It really shouldn’t be all that difficult. Right now, PLEG is detecting when the dimmer drops down below 5%. Your action is to turn the dimmer off at that point. You could change that as follows:

  • Create a virtual on/off switch
  • Have PLEG turn the virtual switch on when the dimmer drops below 5% (instead of turning the light off)
  • Create a scene that detects when the virtual switch is turned on
    • Immediate action is to turn the virtual switch off AND the dimmed switch off
    • LUA code sets the variables we’ve already talked about

Done.

If someone partly dims the switch and then turns it off, it will come back on at the last level it was dimmed to.[/quote]

I think I’m missing something here. As far as I can tell this has the same end result. If someone sets the dimmer down to 4% it won’t matter if there is a virtual switch or if PLEG just does the turn off action itself. The second that person sets the switch to 4% the “LastLoadLevel” gets set to 4%. If they go to turn the light on by just tapping the up on the paddle it will go back to the LastLoadLevel which is still 4% and it would just go into the constant off loop. What I need is a way to tell the switch to set the LastLoadLevel to xx% if it is dimmed to 4% or lower be it by virtual switch or by a simple PLEG.

It really shouldn’t be all that difficult. Right now, PLEG is detecting when the dimmer drops down below 5%. Your action is to turn the dimmer off at that point. You could change that as follows:

  • Create a virtual on/off switch
  • Have PLEG turn the virtual switch on when the dimmer drops below 5% (instead of turning the light off)
  • Create a scene that detects when the virtual switch is turned on
    • Immediate action is to turn the virtual switch off AND the dimmed switch off
    • LUA code sets the variables we’ve already talked about

Done.

If someone partly dims the switch and then turns it off, it will come back on at the last level it was dimmed to.[/quote]

So I’ve tried this using ember1205 lua code suggestions to no avail. The switch remains in a constant off loop if I dim it to 4% or less and then try to just turn it on. Any suggestions on what the Lua code I should put into the scene should be to set the LoadLevelLastl to XX amount?

This: luup.variable_set(“urn:micasaverde-com:serviceId:ZWaveDevice1”,“LoadLevelLast”,“100”,“20”) didn’t do it.

You’re going to need to determine what your exact variable name is. For example, I have a dimmer that uses urn:upnp-org:serviceId:Dimming1 as the name of the variable to be set as “LoadLevelLast”.

Also, unless you’re able to successfully set that variable, you won’t have the complete “solution” and things will work as you’re describing.

To determine your exact variable name, open up the device. Click on Advanced. From there, click the Variables tab. Scroll down to find “LoadLevelLast” and hover your mouse over it. The pop up box will show you the correct naming.

[quote=“ember1205, post:33, topic:196577”]You’re going to need to determine what your exact variable name is. For example, I have a dimmer that uses urn:upnp-org:serviceId:Dimming1 as the name of the variable to be set as “LoadLevelLast”.

Also, unless you’re able to successfully set that variable, you won’t have the complete “solution” and things will work as you’re describing.

To determine your exact variable name, open up the device. Click on Advanced. From there, click the Variables tab. Scroll down to find “LoadLevelLast” and hover your mouse over it. The pop up box will show you the correct naming.[/quote]

Yes this is exactly the same name I get when I hover over it. My device number is 20. And The name of it is LoadLevelLast I have no idea if these Jesco/GE dimmers allow it to be changed. I’ve written the company… as you can imagine… still waiting.

If I put this in my LUA on my scene using he virtual switch as a trigger from PLEG and then try to run the scene… it fails.

luup.variable_set(“urn:upnp-org:serviceId:Dimming1”,“LoadLevelLast”,“100”,“20”)

Try:

luup.variable_set("urn:upnp-org:serviceId:Dimming1","LoadLevelLast","100",20)

[quote=“ember1205, post:35, topic:196577”]Try:

luup.variable_set("urn:upnp-org:serviceId:Dimming1","LoadLevelLast","100",20)

THANK YOU!!! What a couple little quotation marks can do. Although now I have the daunting task of creating a couple dozen virtual switches and PLEG devices BUT it gets the job done! Much appreciated ember1205. You rule the day!

Glad it worked. I didn’t immediately notice it because I do it just a little differently.

In my LUA code, I first set a variable like this:

DeviceID = 20

Then I send the command like this:

luup.variable_set("urn:upnp-org:serviceId:Dimming1","LoadLevelLast","100",DeviceID)

So, my code doesn’t end up with that number being quoted.

On another note… I also set global variables with my startup LUA. I will do things like this:

DiningRoomDimmerID = 5 LivingRoomDimmerID = 7 MasterBedroomDimmerID = 10 MasterBedroomFanID = 15

Since those variables are global, I can reference them anywhere and don’t have to set them within the scenes. I can change the above command to something like:

luup.variable_set("urn:upnp-org:serviceId:Dimming1","LoadLevelLast","100",MasterBedroomDimmerID)

And not have to declare that variable within the scene first.

Very good. I hope I don’t run into issues with the number of devices. I think the Vera 3 has a limit. Or do virtual devices not count toward that? Also, is there a way to update the controller after a PLEG change without having to reboot it?

Everything has limits. :slight_smile:

My VeraLite has quite a few items in it and it’s fine. I can’t imagine the Vera 3 is more restrictive. Also, if you are adding LUA code directly to your PLEG items, you wouldn’t need the virtual switches. You can act on the devices directly when you detect that you’re at 4% dim or less.

Can’t tell you much about PLEG because I’ve never used it. I always wrote my own code because it was much more flexible. And free. :wink:

[quote=“ember1205, post:39, topic:196577”]Everything has limits. :slight_smile:

My VeraLite has quite a few items in it and it’s fine. I can’t imagine the Vera 3 is more restrictive. Also, if you are adding LUA code directly to your PLEG items, you wouldn’t need the virtual switches. You can act on the devices directly when you detect that you’re at 4% dim or less.

Can’t tell you much about PLEG because I’ve never used it. I always wrote my own code because it was much more flexible. And free. ;)[/quote]

I did try to add the code into PLEG after I found it worked with the virtual switch but it did not fly. Not sure why. I’ll probably play with it some more as I find the time but this will work for now and the summer rental season is upon me and I don’t like to play around with the Vera while that is going on. Cause you just never know and I’m not near it to fix it. I don’t do updates during that time… and actually after the last update I won’t do them anymore until I update my controller. Everytime I have to back up, then reset the controller back to factory, do the update and then restore. I’m not there so this was always nerve racking. I solved it by having a web enabled power strip, a camera and a mini computer all in the cabinet with my controller. After I backed up, and then factory reset I’d loose all my inet configuration (wifi) so I’d turn on the mini pc which was then bridged with the vera and I could then configure the wifi settings again. But I was just there before the season with the most recent update and even with me there it didn’t go well. Backup failed, called support, they were in the unit for quite some time but finally got it but the back up they used was old so lost everything i had done the prior 4 days and didn’t want to take a chance so I just reconfigured the whole damn thing and then said no more of that. So next year I’ll upgrade to a new model so I can avoid that whole mess because of lack of space.