Announcement

Collapse
No announcement yet.

Control Device for a Set Time

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

    Control Device for a Set Time

    Is it possible with HS and Alexa to control a device for a certain amount of time? Example: "Alexa turn masterbed fan to medium for 2 hours" Figuring that this would set the fan to medium then shut it off after hours are done?

    Thanks

    #2
    This would be a very useful feature. Over the winter I like to turn our hot tub on manually to give it an hour to filter.. I always forget to turn it off again.

    Comment


      #3
      I don't believe there's an exact scenario yet, but here's what I do with a similar need:

      -In HomeSeer create a device that's a virtual switch called Alexa Fan 2 Hours
      -Create an event that is triggered by the device Alexa Fan 2 Hours turning on
      -In that event, have HS turn the fan on to medium. Same event choose to turn the fan off after a delay of 2 hours. Also turn the device Alexa Fan 2 Hours off as an event action (you can do that right away when the fan turns on

      -Go to the Alexa App and create a Smarthome Routine
      -Have the routine fire from you saying, "Alexa turn masterbed fan to medium for 2 hours"
      -The action of the event should be to turn on the device: Alexa Fan 2 Hours

      HS sees the Alexa Fan 2 Hours turn on and the event you created runs.
      Dan-O
      HomeSeer contributor since summer 1999, yes 1999!

      Comment


        #4
        Thanks I will try that but in the past when I have tried to create Smarthome Routines in the app to control a device that already exists in the app I get a statement from Alexa that she can't control the said device that way.

        But like I said, I will try again. Thanks.

        Comment


          #5
          I think you misunderstood.
          You will create a new virtual device in HomeSeer, making sure to click the Voice Command box in the properties.
          You will create an event in HomeSeer that is triggered by that newly created device changing to on - This will turn the fan on, the virtual device back off and then turn the fan off after 2 hours.

          Once you add/discover that new device in the Alexa App, you will control the device in a new routine with the desired text you speak as the input and the output being to control the newly created device in HomeSeer.
          When the device is controlled through Alexa, the event will trigger in HomeSeer and do as you wish.
          You will say, "Alexa, Alexa turn masterbed fan to medium for 2 hours" and then Alexa will control the new virtual device which in turn will trigger the event.

          You might have to change your text to say, "Alexa, run the bedroom fan for 2 hours please" instead of the phrase that includes the exact name of the device.
          I do know that Alexa does not like the phrase, "Lock the door" so adding more precise text might be your answer too.
          (I've found that adding please ensures that the routine is called upon with the exact phrase and false alarms don't happen)
          Dan-O
          HomeSeer contributor since summer 1999, yes 1999!

          Comment


            #6
            I have this setup for both my fireplace and heating blanket. I use Alexa to turn them on and have an event which monitors each device separately. If they have been on for an hour, the event fires to turn them off. No need to implement a virtual device.
            HS3PRO 3.0.0.500 as a Fire Daemon service, Windows 2016 Server Std Intel Core i5 PC HTPC Slim SFF 4GB, 120GB SSD drive, WLG800, RFXCom, TI103,NetCam, UltraNetcam3, BLBackup, CurrentCost 3P Rain8Net, MCsSprinker, HSTouch, Ademco Security plugin/AD2USB, JowiHue, various Oregon Scientific temp/humidity sensors, Z-Net, Zsmoke, Aeron Labs micro switches, Amazon Echo Dots, WS+, WD+ ... on and on.

            Comment


              #7
              Originally posted by sonypoolplr View Post
              Is it possible with HS and Alexa to control a device for a certain amount of time? Example: "Alexa turn masterbed fan to medium for 2 hours" Figuring that this would set the fan to medium then shut it off after hours are done?

              Thanks
              With my Alexa helper and a small script, this can be accomplished! The duration would be what you asked and not fixed to 2 hours for example.
              Jon

              Comment


                #8
                Originally posted by jon00 View Post

                With my Alexa helper and a small script, this can be accomplished! The duration would be what you asked and not fixed to 2 hours for example.
                Thank you that's great. I will take a look at your Alexa helper and see what else I need to do to get it to work. I will admit that I am not that good at scripting, so I will probably need a push in the right direction.

                Comment


                  #9
                  Originally posted by sonypoolplr View Post

                  Thank you that's great. I will take a look at your Alexa helper and see what else I need to do to get it to work. I will admit that I am not that good at scripting, so I will probably need a push in the right direction.
                  So you would create a trigger as shown below. Not shown but you also would need to set the Capi control settings to run the fan at medium speed or use an event to do so.

                  You would then need to create an event to turn off the fan. Let's call this event 'Fan Off'

                  Copy the code below and call it 'FanDelay.vb' and place in your scripts folder. You will see I have added this script name to the Run Script entry.

                  That's it!

                  So how does it work?

                  When you say 'Alexa, ask Homeseer to turn masterbed fan to medium for two hours' it will trigger on the words 'masterbed, fan and medium' and this will turn on the fan on to medium via the Capi control setting or via an event. It will also run the script Fandelay.vb

                  The helper automatically parses out any numbers in the sentence and this is passed as a script parameter to the specified script (FanOff.vb).

                  The code in the script will create an event which will run after the specified time (in hours) passed to it from the helper. This is basically a delayed event which will run the event 'Fan Off' to shut off the fan.

                  Code:
                  Sub Main(ByVal Num As Integer)
                  
                  If Num > 0 Then
                      Dim d as Date = DateTime.Now.AddHours(Num)
                      Dim EvRef As Integer = hs.GetEventRefByName("Fan off")
                      Dim res As Boolean = hs.EventSetTimeTrigger(EvRef, d)
                      hs.SaveEventsDevices()
                  End if
                  End Sub
                  (You could specify minutes by changing DateTime.Now.AddHours(Num) to DateTime.Now.AddMinutes(Num))

                  Click image for larger version

Name:	Fanoff.PNG
Views:	264
Size:	53.1 KB
ID:	1256593
                  Last edited by jon00; November 1, 2018, 01:49 PM.
                  Jon

                  Comment


                    #10
                    Jon,

                    Taking this a step further, is it possible to pass an event start time with your helper? My use-case is that I have my bedroom lights which start tuning on gradually at say 7:00am but I'd like to be able to pass a new time say 6:45 or 7:15 if we decide to change that. I think the complication would be parsing the time...
                    I do use the helper to enable or disable the lights, but was wondering if I could set the time? As well, I can setup my outlook calendar on those days like holidays which may be out of the normal routine. This new request would be handy.

                    Robert
                    HS3PRO 3.0.0.500 as a Fire Daemon service, Windows 2016 Server Std Intel Core i5 PC HTPC Slim SFF 4GB, 120GB SSD drive, WLG800, RFXCom, TI103,NetCam, UltraNetcam3, BLBackup, CurrentCost 3P Rain8Net, MCsSprinker, HSTouch, Ademco Security plugin/AD2USB, JowiHue, various Oregon Scientific temp/humidity sensors, Z-Net, Zsmoke, Aeron Labs micro switches, Amazon Echo Dots, WS+, WD+ ... on and on.

                    Comment


                      #11
                      Jon,

                      Where do I download your Alexa helper from? I checked the installer and I don't see it. I think I remember your stuff only being available from your website? If so, could you supply a link to it?

                      Thank you.

                      Comment


                        #12
                        Originally posted by langenet View Post
                        Jon,

                        Taking this a step further, is it possible to pass an event start time with your helper? My use-case is that I have my bedroom lights which start tuning on gradually at say 7:00am but I'd like to be able to pass a new time say 6:45 or 7:15 if we decide to change that. I think the complication would be parsing the time...
                        I do use the helper to enable or disable the lights, but was wondering if I could set the time? As well, I can setup my outlook calendar on those days like holidays which may be out of the normal routine. This new request would be handy.

                        Robert
                        No, not easy with time but you could have fixed triggers especially for 'Six Forty Five' and 'Seven fifteen' in the Alexa Text field. If I get a spare moment, I'll see if I can add time parsing to the script.
                        Jon

                        Comment


                          #13
                          Originally posted by sonypoolplr View Post
                          Jon,

                          Where do I download your Alexa helper from? I checked the installer and I don't see it. I think I remember your stuff only being available from your website? If so, could you supply a link to it?

                          Thank you.
                          Click on my banner below!
                          Jon

                          Comment

                          Working...
                          X