When turning off the dimmer, set the LoadLevelLast to 100%

I have the following issue: In my VeraPlus (firmware 7.31), I have created a dimmer using the Switchboard plugin. I want this light always turn on at 100% brightness when turn the light on. By default, the dimmer remembers its last used setting. I have created the following scene: when the light is turned off, the LoadLevelLast should be 100. Here is my luupcode:

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

Manually, this works by using Test Luup code (Lua), but does not work in scenes by using execute the following Luup code.

Does anyone know what is wrong?

I had a similar problem recently where command worked on the LUA test screen but not as code in a scene. Very puzzling. In the end it was the text editor was putting in the wrong " characters when pasting.

So check your scene text to be sure you have " and not so called âťťpretty quotesâťž.

1 Like

Thank you for your response.

I checked the text, but no result. However, I have now discovered that if I manually start the scene by clicking “run”, the action does come through correctly. If I activate the scene automatically, it doesn’t work, even though the scene is activated. Last Run does show the new time when automatically activate the scene and I also let a light turn on by activating the scene. The light turns on, so the scene is started.

Does anyone know the solution?

Another couple of thoughts but not sure they will help.

  • I would edit the exact lua line in your scene and delete the " character a retype it in instead of pasting it from another source. I deleted the " character and typed it in from the keyboard for each instance in the scene.

  • I also turned on the check mark on the Users & Account Info / Security/ Enable potentially unsafe lua code, like wget and RunLua

When this happened to me I was trying all sorts of things so I can’t say for sure what cleared up the problem. Also restart the lua engine and/or reboot after the changes.

Might not be your situation but I’d give these two a try just in the off chance it helps.

Hi,

You cannot set the LoadLevelLast value. You have to look at your dimmer and see if it has the option to ignore the last load level or not. The other things you can do is create a scene that will turn the dimmer up to 100% when it is turned on, or if possible turn it on using a scene that sets the dimming level to 100% rather than using the On command.

Cheers Rene

If I understand correctly, I cannot set the LoadLevelLast via scene activation or something like that. However, it is strange that it can be set manually and also via manual scene activation by hand.

Thank you for the response

seems strange. If you can effect the change via running at a lua test page the you should be able to run the same function in a wrapper in a meshbot/scene.

did you check the enable potentially unsafe lua code… switch in users & account section then rebooted as an experiment? I think this fixed my inconsistency with a command working at the prompt vs in a scene.

Thank you for thinking along. I have “Enable potentially unsafe lua code, like wget and RunLua.” enabled, but gives no result

Hi,

Maybe I should explain my self a bit more. Setting the LastLoadLevel value has no effect on the actual result. It is a value reported by the dimmer, not one you can set. Some dimmers have an attribute you can set so that it will ignore the last level when turned on with the “On” command so they always will go to 100%, many do not. You have to look in the manual of your dimmer.

The only thing you can do is have a scene to set the dimmer at the desired level using the SetDimlevel at 100% command rather than the On. As a trigger for that scene you can use the dimmer getting turned on. After a second or two the dimmer will them go the the 100% level. All this can be done using the scene editor. No Lua required.

Cheers Rene

My comments were directed to the OP who claimed the feature worked when commanded at the Vera/App/Develop apps/Test Luup code (Lua) window.

I had a similar problem where a command worked at this test window but not as code in a scene which was very puzzling.

I have been around and around with this for years. I have a vacation rental with the GE dimmer switches. The issue I was running into is guests would not know that they can just tap it down… they would dim it to “turn it off” which of course only brought it down to like 2 or 3 out of 100. So at first, in an effort to combat this I was using PLEG and created these exact codes and it worked. The guest would dim it to under 5 and I had code that said if under 5 then turn off and set to “45” or whatever I wanted it set at. But after about 2 or 3 years that stopped working out of nowhere. You’ll see my frantic posts about it in the old forum posts. In any case, I’ve never been able to get it to work again. It’s like you can’t turn the switch off and while it’s off send a command to it to set a parameter or something. I tried saying that if it got below 5 to instantly go to 45 but then instantly turn off. It got so complex I just gave up. I know this isn’t helping but just know… some of us who have been on this system for a near a decade have been down this road.

Would an option be to have a script that:

  1. In the middle of the night (say 2 or 3AM) turn the light to 100% then 1 second later turn it off. Would that store the 100% for the next tap cycle on? I have a couple (2AM and 3AM) so called “clean up” scenes that run in the night just to turn off any lights that might have inadvertently been left on.

  2. If the light is reduced to 3-5% I presume the power lost (until the evening recycle to 0%) wouldn’t be a costly hardship. At worst a few hours of draw at a few %. I presume we aren’t talking incandescent bulbs or else there are far better ways to save $$ on electricity (i.e. get rid of the incandescent).

It’s not really about power consumption, although I’d prefer to not have power contantly going to a switch that guests thinks are off. It’s more about then they go in the room and turn the light on and it doesn’t come on because it thinks the last light level is 3%. In anycase. I don’t want to flash anyone with 100% in the middle of the night even for the second it would appear and disappear. I just monitor it from time to time but I gave up. It would be nice if you could just send a command to an off switch and change the one parameter field.

The GE dimmers have really limited configurability (like inability to set the trim for the dimmer). I would suggest, in PLEG since that is what you are using. Trigger the switch to turn off, if it is dimmed below a certain number (where the light goes off but the dimmer it not off). Then when the switch is turned on, if the dimmer value is below a certain level, brighten it a set level.

Other experiments, turn off the ramp rates or make them very very quick so the user isn’t confused by the fade affect.

1 Like

Interesting idea. Although I don’t know how I would tell PLEG to determine the difference between the switch hitting 3% after being dimmed and turning off and it hitting 3% after being turned on. You would have to be able to tell it it’s ramping down or ramping up. I haven’t seen any way of doing that. It’s been a while since I visited PLEG though. Today I decided to add some creative voice commands from Alexa and it required some PLEG programming so it was nice to get my hands in there again.

The switches USED to be able to be configured. I had it down my first couple of years. So much so I even wrote down all the steps so that if I ever had a controller crash I’d know (or a tech person I’d have to pay) exactly how to program it. So there was a time where I could tell the system that if the switch hit 3% turn the switch off and set the LoadLevelLast to 65. For some reason I haven’t been able to get a LUA code to stick for LoadLevelLast. I don’t know why.