No announcement yet.

Adjust Dimming Level Without Turning Lights On

  • Filter
  • Time
  • Show
Clear All
new posts

    Adjust Dimming Level Without Turning Lights On

    I have a bunch of Cooper Wiring dimmers (9540, 9542). I want to set them to certain dimming levels for certain times, e.g. at 5am 20%, at 7am 40%, at 9am 100%. The idea is that when I turn on the lights between 5am and 7am they only go to 20%, if I turn them on between 7am and 9am they go to 40%, etc.

    The problem is that when I set the dimming level the lights turn on. I guess I could look for a status change and then depending on the time adjust the dimming level. However, that means it will first go to the previous level and then dim slowly as I programmed slow adjustments. This is particularly annoying in the morning when the previous level was high but now it should be very low.

    Isn't there a way to achieve this through HomeSeer because I can adjust the dimming level on the actual switch without turning on the lights.

    I had a similar question to yours a few years ago when I used non instant status switches. At the time I concluded that the only way to accomplish dimming based on time would be to control the switches using homeser instead of manually. I had planed to set up motion/occupancy senors to do this but never did get around to it. When HS released their instant status switches/dimmers I started upgrading and was able to accomplish this using a script.

    My script has only 2 set levels "day" 100% and "night" dimmed. With a bit of modification the same script should work for you. Assuming I'm not mistaken about cooper dimmers being instant status.

    You'll need an event for each dimmer to call the script each time the top paddle/on is used. Use that event to pass the ref number of the dimmer to the script.

    In my setup, since my lights dim up and down at the dimmers default rate, the experience is seamless. I tap the switch and it either dims up and stops at the dimmed level the script provides, or it goes to full brightness. My lights therefore never return to their last level used when turned on.

    If you end up using this script you may also be interested in a companion script I use that fires at the same time my night mode starts and dims any dimmable lights that are currently on to the correct level.

    Public Sub Main(ByVal Parms As Object)
            '' This script intended for dimmer switches that support instant status, it should be called by an event which passes the device ref as it's parameter
            '' If the device is dimmed set to 'on' (override), If 'off' we want to set to either 'on' or dimmed depending on the time.
            '' nightmode = when lights should be dimmed when turned on
            '' daymode = when lights should be set to 'on' when turned on
            Dim deviceRef As Integer = Integer.Parse(CType(Parms, String))
            Dim startingDeviceValue As Integer = hs.DeviceValue(deviceRef)
            Dim endingDeviceValue As Integer = 0
            '' the start and end of the day need to be in 24 hour time format; ie 10pm would be 2200.  The variable can be hard coded if you prefer
            ''Dim nightmode = New DateTime(Now.Year, Now.Month, Now.Day, 22, 00, 0)
            ''Dim daymode = New DateTime(Now.Year, Now.Month, Now.Day, 07, 00, 0)
            '' I prefer to store the variable in a virtual device; so lets get the value and make sure the it has 4 places, if not prefix with 0's
            Dim virtualdevicevalue As String = hs.DeviceValue(93).ToString.PadLeft(4, "0")
            '' we can now split the string into hours and minutes and insert into our time variable
            Dim nightmode = New DateTime(Now.Year, Now.Month, Now.Day, Left(virtualdevicevalue, 2), Right(virtualdevicevalue, 2), 0)
            ''repeat for the next value
            virtualdevicevalue = hs.DeviceValue(94).ToString.PadLeft(4, "0")
            Dim daymode = New DateTime(Now.Year, Now.Month, Now.Day, Left(virtualdevicevalue, 2), Right(virtualdevicevalue, 2), 0)
            '' set the dimmed level we wish to use for nightmode
            Dim dimmed As Integer = hs.DeviceValue(95)
            '' check to see if the device is currently dimmed; if dimmed override and set to 'on'
            If startingDeviceValue <> 0 AndAlso startingDeviceValue < 99 Then
                endingDeviceValue = 99
            End If
            '' check to see if we're in night mode, if so and the device is off set to dimmed
            If (DateTime.Now >= nightmode Or DateTime.Now <= daymode) AndAlso startingDeviceValue = 0 Then
                endingDeviceValue = dimmed
            Else endingDeviceValue = 99
            End If
            '' if we've changed something lets set the new value, otherwise exit
            If startingDeviceValue <> endingDeviceValue Then
                Dim cc As HomeSeerAPI.CAPIControl = hs.CAPIGetSingleControl(deviceRef, True, "Dim (value)%", False, False)
                cc.ControlValue = endingDeviceValue
                Dim cr As HomeSeerAPI.CAPIControlResponse = hs.CAPIControlHandler(cc)
            End If
        End Sub
    HS4 Pro on Shuttle NC10U, Win10; Z-NET
    Number of Devices: 1005
    Number of Events: 293

    Plug-Ins: BLLock, DirecTv, EasyTrigger, Honeywell WiFi Thermostat, Marquis monoprice Amp, MeiHarmonyHub, PHLocation2, Pushover 3P, UltraM1G3, rnbWeather, Worx Landroid, Z-Wave

    External applications: Homebridge-homeseer, Geofency, EgiGeoZone.