Dimmer question

Hi,

The learning curve of openHAB has been steep. I have managed to get several rules working. Now I am stuck on something that I am sure is so simple, but …

I am trying to set a dimmer to 50%. I can get it full on by, and this is my test rule:

[code]rule “Daytime rule”
when
Time cron “0 07 10 * * ?” or

then

sendCommand(DeskLampStatus,ON)

end[/code]

But I just cannot figure out the syntax that will set the dimmer to, say 50%. Replacing “ON” with 50 didn’t work.

I have copied the MiOS transforms and used the item generator in my setup.

Thanks,
Chris

You want the “*LoadLevelStatus” openHAB Item, since it’s bound to the Dimmer interface of the corresponding MiOS Device. The “*Status” openHAB Item is bound to the Switch interface of the MiOS Device.

Your rule will end up something akin to:

rule "Daytime rule" when Time cron "0 07 10 * * ?" or then sendCommand(DeskLampLoadLevelStatus, 10) end

I tested this in my env, using the following (creating a cycling light):

rule "Daytime rule" when Time cron "0/10 * * * * ?" or then sendCommand(GuestBedroom2LightsLoadLevelStatus, 10) Thread::sleep(1000) sendCommand(GuestBedroom2LightsLoadLevelStatus, 0) Thread::sleep(1000) sendCommand(GuestBedroom2LightsLoadLevelStatus, 40) Thread::sleep(1000) end

Many thanks guessed. That really helps. The delays in your example also gives me some ideas that can really improve what I want to do.

I figured you might want to gradually fade up, given the starting time :wink:

Note that you can safely add delays directly in a Rule definition, and it won’t cause a restart like it does in Vera Scene (without extra work and/or addons). I do it in a number of places.

You are correct. Today for example, in the late afternoon, my family room lights ramp up in steps. The goal is by the time it is dark outside, the lamps are fully on, and no one noticed it happened.

I use the elevation of the sun and outdoor light level to determine when this starts. The elevation creates the window of time to consider the light level. On cloudy days, the scene will starts earlier than sunny days, just because of the light level being lower. The sun elevation is continued to be evaluated, acting as a low pass filter so a dark cloud passing by doesn’t fool the system into thinking it is time to turn the lights all the way up.

Doing this on the Vera was okay, but I think it can now make it much smoother with openHAB.