I have a number of standard wall mounted light dimmers. On my theme I have four buttons for each one - Off Dim Bright On
The On and Off ones are easy, they just change the property of the device directly.
The Dim and Bright ones are doing my head in! I can't set the dim level absolutely, it needs to be relative. So for example, each time the Dim is pressed, it runs a task that has a single command to change the composite property of my X10 contoller to A;3;Dim 2. This works fine, apart from the fact that each dim or bright button needs its own task.
I have thought of replacing the On and Off buttons with tasks that issue say 10 brights or 10 dims and keep a record of the state to help with knowing what the lighting level is. But this would mean another two tasks per device!
I have been round the houses of trying to do it with each button setting a flag and then having a task that is continually polling the flags and issuing the relevant commands based on which flag is set. - At least this way it is a single file that I'm editing and can just cut and paste when extra devices are added. Unfortunately, the whole processes of the task detecting the change and then sending the code out is far too slow and produces very 'jerky' dimming.
I've tried doing it externally with scripts, but still need to trigger the script and either need a lot of scripts or a similar approach to above. It would be good if I could chnage two properties on the script device i.e. set its state to running and also pass it a parameter - the device ID for example.
So..... do I have to live with loads of tasks / scripts or out of all of you out there has someone done this in a far more sensible way?
Cheers,
P.S. I know multi-tasking is good, but I don't think this is what they mean
How do I dim lots of lights without loads of tasks?
I think your suggestion of using a single script Device to handle everything should work. Try this:
Scott
- Create a Script Device
- Add Properties to the Script Device (right mouse click on device and select "Add Properties...") for X10 House Code, X10 Unit Code, and X10 Dim Level.
- You may need to also add a 'Current Dim Level' Property to each Device that you will be controlling. I think if you try and change the existing Dim level property, it will try and send the Dim commands instead of just storing it.
- In the script, use the GetPropertyValue call to get the HouseCode, UnitCode and desired dim level from the script properties. Also get the current dim level (from the previous step) of the Device and send the appropriate number of Dim or Bright commands using the X10 Controller Device.
- You can create a Task to trigger off of a change to one of the Script Properties. For example, always set the Dim level last and have a script condition that tests the Script.Dim Level for a value that will never exist (e.g. Script.Dim Level Is Not Equal 1000). For the Task Action, have it set the state of the Script Device to Running.
- Then all you need to do is to setup the Script Properties and make sure to set the Dim Level last. When the Dim Level is changed, the script will execute.
Scott
Ok, I'm getting there.... My only remaining question is how I actually trigger this from a button in the theme. Bearing in mind that I can only change one property from a button (that is true isn't it?) I can't set the house code, unit code and dim level from one button. Of course I can write a task to do it, but then as I can't pass the task any paramaters, I'm back to a task per device action.
The nearest I can get is to have a device whose one property that is changed by the button is the device name (or house / unit code combination). I can then have a task running that notices that the value has changed from a preset 'nul' value and then does the rest, picking the device name from the parameter. At the end of the script it would reset the dummy device back to the null value.
Sorry if I'm being a bit thick here. I can't be the only one doing this sort of thing, how does everyone else do it?
The nearest I can get is to have a device whose one property that is changed by the button is the device name (or house / unit code combination). I can then have a task running that notices that the value has changed from a preset 'nul' value and then does the rest, picking the device name from the parameter. At the end of the script it would reset the dummy device back to the null value.
Sorry if I'm being a bit thick here. I can't be the only one doing this sort of thing, how does everyone else do it?
Nick,
I'm not sure how everyone else does this, but it's a good question. Personally, I use Leviton brand switches that have a direct dim feature, so I don't mess with the X10 dim/bright stuff. In my own experience when dealing with X10 dimming, I gave up because I couldn't get consistent behavior. All it takes is someone changing the dim setting from the switch to mess everything up. It's very frustrating, I know.
I'm not sure what your Theme layout looks like and how you intend to select the Device to control. I suppose you could either use multiple buttons to select the Device, and then use a single set of up/down buttons to control the dimming. Or you could have a slew of up/down buttons for each Device.
My last advice was not really considering controlling this from a Software Remote. So instead of having separate X10 HouseCode, UnitCode, DimLevel Properties, you could create your own composite property for storing the HouseCode/UnitCode and even the Dim Level. You can use a standard Property Change button and set it to something like (B;4 or B;4;-4). Then have the script parse that value to get all three values.
Scott
I'm not sure how everyone else does this, but it's a good question. Personally, I use Leviton brand switches that have a direct dim feature, so I don't mess with the X10 dim/bright stuff. In my own experience when dealing with X10 dimming, I gave up because I couldn't get consistent behavior. All it takes is someone changing the dim setting from the switch to mess everything up. It's very frustrating, I know.
I'm not sure what your Theme layout looks like and how you intend to select the Device to control. I suppose you could either use multiple buttons to select the Device, and then use a single set of up/down buttons to control the dimming. Or you could have a slew of up/down buttons for each Device.
My last advice was not really considering controlling this from a Software Remote. So instead of having separate X10 HouseCode, UnitCode, DimLevel Properties, you could create your own composite property for storing the HouseCode/UnitCode and even the Dim Level. You can use a standard Property Change button and set it to something like (B;4 or B;4;-4). Then have the script parse that value to get all three values.
Scott
And of course the answer is.......................
............ use the new Direct X10 Command property in 1.62 !!!
My dim & bright buttons now no longer need to call tasks, they simply set the Direct X10 Command property of the device to be controlled to something like 'Bright;2' or 'Dim;2'
Of course it means that the buttons now are purely relative so that I can't set the lighting level to 50% for example, but I can just have 'Dim a bit' and 'Bright a bit' buttons.
Oh, how I wish I had the appropriate cabling to the switches and the budget to Leviton type kit!
My dim & bright buttons now no longer need to call tasks, they simply set the Direct X10 Command property of the device to be controlled to something like 'Bright;2' or 'Dim;2'
Of course it means that the buttons now are purely relative so that I can't set the lighting level to 50% for example, but I can just have 'Dim a bit' and 'Bright a bit' buttons.
Oh, how I wish I had the appropriate cabling to the switches and the budget to Leviton type kit!