We have moved at community.getvera.com

Author Topic: Dimmer question  (Read 1936 times)

Offline ChrisK

  • Full Member
  • ***
  • Posts: 207
  • Karma: +22/-59
Dimmer question
« on: July 04, 2015, 01:17:51 pm »
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: [Select]
rule "Daytime rule"
when
Time cron "0 07 10 * * ?" or

then

sendCommand(DeskLampStatus,ON)

end

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


Offline guessed

  • Moderator
  • Master Member
  • *****
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: Dimmer question
« Reply #1 on: July 04, 2015, 01:42:27 pm »
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:

Code: [Select]
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):
Code: [Select]
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

Offline ChrisK

  • Full Member
  • ***
  • Posts: 207
  • Karma: +22/-59
Re: Dimmer question
« Reply #2 on: July 04, 2015, 02:15:14 pm »
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.
 

Offline guessed

  • Moderator
  • Master Member
  • *****
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: Dimmer question
« Reply #3 on: July 04, 2015, 02:27:15 pm »
I figured you might want to gradually fade up, given the starting time ;)

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.

Offline ChrisK

  • Full Member
  • ***
  • Posts: 207
  • Karma: +22/-59
Re: Dimmer question
« Reply #4 on: July 04, 2015, 03:33:54 pm »
I figured you might want to gradually fade up, given the starting time ;)

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.