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.