Author Topic: Dimming UPB Lights with X10RF (W800RF32)  (Read 2576 times)

Work2Play

  • Newbie
  • *
  • Posts: 8
    • View Profile
Dimming UPB Lights with X10RF (W800RF32)
« on: March 31, 2011, 12:17:38 am »
Hi,

I have a handful of X10 slimfire remotes and keychain remotes I'd like to use to bridge wireless into my UPB setup.

I was able to successfully create rules that capture the On or Off commands from X10 and turn lights on or off - but I was trying to figure out if there was a way to use the dimming feature as well.

Today if I press an On or an Off button - the remote remembers which light code was used last - so if I press a Dim button (up or down) it's sending a dim up or dim down for the light code last used.

How can I incorporate that into UPB?  I experimented with doing custom values against the current light level - ie: for each press of the Dim button set light level to (current level - 10%) - I wasn't getting any result... but then again, I'm not familiar with doing functions like that within Elve at all yet.

Is there a way to make this work? If so, can you give me an example?

Thx!
-Todd

John Hughes

  • Administrator
  • Hero Member
  • *****
  • Posts: 2852
    • View Profile
    • Codecore Technologies
Re: Dimming UPB Lights with X10RF (W800RF32)
« Reply #1 on: March 31, 2011, 01:12:36 pm »
Did you try adding a rule for the W800RF32 device's ReceivedCommand event and set the CommandCode filter to Dim or Bright?

You may need to turn on diagnostics logging for the driver to see what commands the driver is really seeing come in.

I believe it should be possible to do receive the dim/bright commands on the W800RF32 and then send UPB commands to dim/brighten a light. I think a normal x10 dim/bright command is 16.67% (1/16). So I think you would just add or subtract 17 to the current light level for each dim/bright command.
« Last Edit: March 31, 2011, 01:16:36 pm by John Hughes »
John Hughes
Codecore Technologies

Work2Play

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Dimming UPB Lights with X10RF (W800RF32)
« Reply #2 on: March 31, 2011, 01:54:19 pm »
I was able to receive the Dim and Brighten commands just fine - I just wan't too successful with performing the math on the current light level.  Do you have any examples of what that might look like purely from the UPB rules side?

I don't need a lot of handholding - generally just a good kick in the right direction.

Thx!
« Last Edit: March 31, 2011, 01:58:38 pm by Work2Play »

John Hughes

  • Administrator
  • Hero Member
  • *****
  • Posts: 2852
    • View Profile
    • Codecore Technologies
Re: Dimming UPB Lights with X10RF (W800RF32)
« Reply #3 on: March 31, 2011, 05:21:43 pm »
Assuming your lighting driver is named "lighting" then you could do something like this when a dim command is received... you'll need to script this...

lighting.LightLevels[4] = lighting.LightLevels[4] - 17;

That will reduce light #4 by 17 percent (since the lighting drivers use a scale of 0 to 100).

Another thing to consider here is whether or not UPB is fast enough to process all your dim/bright commands.
John Hughes
Codecore Technologies

Work2Play

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Dimming UPB Lights with X10RF (W800RF32)
« Reply #4 on: April 04, 2011, 12:15:56 am »
Yup - that worked... thx!  You're right though - I have to wait for UPB to update it's current value to Elve before I can make the next step.  It is pretty quick.

To try making it even faster I just tried this out using some variables so it doesn't have to wait for an updated status. 
When the light is turned on or off:
------
lighting2.SetLightLevel(17, 80, 2);
vars.SetVariableValue(@"varOfficeLightLevel", lighting2.LightLevels[17]);
------
Then for a dim button:------
lighting2.SetLightLevel(17,(vars.GetVariableValue(@"varOfficeLightLevel")- 10),4);
vars.SetVariableValue(@"varOfficeLightLevel", vars.GetVariableValue(@"varOfficeLightLevel")- 10);
------
Logic being you have to press a light button first to set the remote's mode - so capturing the value then means you can do future math on that readily available status rather than having to wait for UPB to transmit the updated status level.  Of course if someone screws with the wall switch it's prone to some error but the light will just go to the level it thinks it should and proceed from there.

It seems to be pretty easy to trip the remote up to where it doesn't respond until I mess with another light then come back to the first light - i haven't run the debugger yet to see what's happening... but for under $3.34/remote I'm not complaining.