Announcement

Collapse
No announcement yet.

Returning to last status for lighting events?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Returning to last status for lighting events?

    Just wondering if there is a way, or if I am missing something simple, to where I have an event turn a light on and then after X time it will restore it back to it's previous state? An example would be with dimmable Z-wave switches.

    If I have the kitchen lights currently set to 50% and I get a phone call (tasker linked to HS3) I'd like to have the lights kick up to 100%, then after the call is ended the lights go back to the "previous state", in this case 50% or whatever it may have been.

    This is a totally made up example, but something I'd like to have happen but with the event engine it doesn't allow this (from what I can see). How can I achieve this?

    #2
    I think you could do it by modifying the script I posted here:
    https://forums.homeseer.com/showthread.php?t=188757
    Instead of toggling between dim and off, you'd change it to capture the current dim level, then toggle between "full on" and the stored dim level.
    Fred

    HomeSeer Pro 3.0.0.548, HS3Touch, Zwave 3.0.1.252, Envisalink DSC 3.0.0.40, WeatherXML, Z-stick, HS phone, Way2Call

    Comment


      #3
      I am totally green to scripting so this initially seems difficult. Haha. I'll try and tackle this with the main light in our loft. If I can get it to work then I'll roll it out to the rest of the dimmers through the house. It's too bad this wasn't natively stored within the device itself somehow. So you could choose in the event engine to restore to "previous level" or something similar.

      Comment


        #4
        Originally posted by Conrad_Turbo View Post
        I am totally green to scripting so this initially seems difficult. Haha. I'll try and tackle this with the main light in our loft. If I can get it to work then I'll roll it out to the rest of the dimmers through the house. It's too bad this wasn't natively stored within the device itself somehow. So you could choose in the event engine to restore to "previous level" or something similar.
        There is an "on last level" event option, but I'm not sure it will work for you. In your case, the "last level" would be "full on", since you're turning it on full bright.

        How do you intend to trigger the event to run the script? Is tasker going to do that for you? [I'm not familiar with Tasker - that's why I'm asking].

        If you'd like, I'd be glad to help you with the script.
        Fred

        HomeSeer Pro 3.0.0.548, HS3Touch, Zwave 3.0.1.252, Envisalink DSC 3.0.0.40, WeatherXML, Z-stick, HS phone, Way2Call

        Comment


          #5
          I cannot think of a way you could accomplish this at the dimmer itself, but it would be easy within Events. In the Events below are one example. I built a Virtual Device that mimics a dimmer. I used a double tap of the HS-WD100+ as a trigger for the first event. I used Spud's Easy Trigger Action to store the current level in the Virtual Device. The second event is what returns the value from the Virtual Device to the dimmer. It is called with a 30 second delay.

          The trigger could be anything, except local control of the dimmer. The amount of time it takes for the light to return to the prior level is determined by the delay imposed on the second event.

          Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	89.6 KB
ID:	1190824

          You would probably need some housekeeping so you don't get surprises. One thing I can think of is manually turning the light Off during the delay for the second event. This would result in the light going back to the stored level when the delayed Event runs. You could create another event that is triggered by the light being turned off which would cancel the delayed event.

          Click image for larger version

Name:	Capture2.PNG
Views:	1
Size:	38.1 KB
ID:	1190825
          HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

          Comment


            #6
            Originally posted by ITguyHS View Post
            There is an "on last level" event option, but I'm not sure it will work for you. In your case, the "last level" would be "full on", since you're turning it on full bright.

            How do you intend to trigger the event to run the script? Is tasker going to do that for you? [I'm not familiar with Tasker - that's why I'm asking].

            If you'd like, I'd be glad to help you with the script.
            Wow...ya..."On Last Level" is what I thought I was looking for and it's the first option on the list when I want to control the device.

            So I guess a better example is for an ON/OFF switch, not a dimmer. For example we use our entry way light as a notification light. One event I have is at 8pm the light will be turned on (if it already isn't on) and a voice announcement happens, then 5 seconds later it shuts off the light. However this is great if the light was off prior to the announcement event being triggered, but if the light was already on I wouldn't want the announcement event to shut the light off. I read the HS3 scripting tutorial and entered everything in made up two test events, they run, however I think I would need two scripts? One to store the status of the light, then allow the event to run, then restore it to the previous status? This is how I have set it up right now (ignore the Test Sound event):

            936 is the virtual device to store the status
            4 is the light being controlled
            Attached Files

            Comment


              #7
              Originally posted by Conrad_Turbo View Post
              Wow...ya..."On Last Level" is what I thought I was looking for and it's the first option on the list when I want to control the device.

              So I guess a better example is for an ON/OFF switch, not a dimmer. For example we use our entry way light as a notification light. One event I have is at 8pm the light will be turned on (if it already isn't on) and a voice announcement happens, then 5 seconds later it shuts off the light. However this is great if the light was off prior to the announcement event being triggered, but if the light was already on I wouldn't want the announcement event to shut the light off. I read the HS3 scripting tutorial and entered everything in made up two test events, they run, however I think I would need two scripts? One to store the status of the light, then allow the event to run, then restore it to the previous status? This is how I have set it up right now (ignore the Test Sound event):

              936 is the virtual device to store the status
              4 is the light being controlled
              As you noted, On Last Level only works on dimmers. It also only works from "Off". You can use a script or Easy Trigger as I posted above. You would need to store the value (with a script or a Easy Trigger) with one event, and return the device to that value with another.
              HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

              Comment


                #8
                Originally posted by rprade View Post
                As you noted, On Last Level only works on dimmers. It also only works from "Off". You can use a script or Easy Trigger as I posted above. You would need to store the value (with a script or a Easy Trigger) with one event, and return the device to that value with another.
                That's almost what my script does. If it's on, and you execute the script, then it stores the dim value and turns the device off. If the device is off, it looks up the "last level" from the virtual device, then turns it on to that level. If you want to do it with a combination of events and scripts, just use the section of the script that saves the current value, deleting the rest, and use events for the rest of the stuff, testing the virtual device to see if it was on or off.

                Here's the modified version that just stores the value in a virtual device.
                Code:
                ' Store_device_value.vb
                '
                ' Store a device's current value in a virtual device
                '
                ' Parm 1 is the device reference of the virtual device
                ' Parm 2 is the device reference of the real device
                ' Pass the parms as a comma-separated string
                
                Sub Main(ByVal Parms As String)
                
                Dim ParmArray() as String
                ParmArray = Parms.tostring.split(",")
                dim targetDev1 as Integer = CInt(ParmArray(0)) 			'reference ID of the virtual device to use for value
                dim targetDev2 as Integer = CInt(ParmArray(1)) 			'reference ID of the device of the z-wave device
                dim current_value as double = hs.DeviceValueEx(targetDev2)   	'current value of actual device
                
                	hs.setdevicevaluebyref(targetDev1,current_value,True)
                	hs.setdevicestring(targetDev1,current_value,True)
                
                End Sub
                Last edited by ITguyHS; May 11, 2017, 08:56 AM. Reason: Add script
                Fred

                HomeSeer Pro 3.0.0.548, HS3Touch, Zwave 3.0.1.252, Envisalink DSC 3.0.0.40, WeatherXML, Z-stick, HS phone, Way2Call

                Comment


                  #9
                  Ideally HS3 would store history for ANY/ALL devices marked (could be a device property in HS3 on each device)... for N versions. 1 or 2 would probably be sufficient for most use cases.

                  Then we'd be able to recall DeviceValue; -1 to go back 1 version, or something like that.

                  Add this to the LONG list of what HS3 doesnt have and really needs.

                  Comment

                  Working...
                  X