Announcement

Collapse
No announcement yet.

Alarm clock both ways

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

    Alarm clock both ways

    This is a request for a new feature actually.

    There are threads in this message board about people trying to design their own Alarm Clocks by scripting.

    LMS does support alarm clocks and has easy web interface for setting those.

    The HS plug-in does generate "Alarm clock" devices, however those are in passive "listening" mode. They would trigger HS events etc., however one can not set an alarm clock proactively from HS.

    For me personally it would be a great benefit if the HS plug-in would allow alarm clock settings from HS. There are two reasons for that

    1. I do not have the classic nightstand squeezebox but rather the "squeezebox duet" that sits in an equipment closet. Yes, it comes with a remote control that is always lost and out of batteries.

    2. I'm trying to unify all various interfaces in the house to go trough a single control - HS, using few iPads strategically located throughout the house.

    Thanks,

    RI2

    #2
    Hi RI2,

    The alarms can be modified through HS scripts. You could create a virtual device that could hold the alarm time, etc. and based on it, modify the SB alarms with a script. See http://board.homeseer.com/showthread.php?t=156371 for examples.

    Cheers
    Al
    HS 4.2.8.0: 2134 Devices 1252 Events
    Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

    Comment


      #3
      Hand holding

      Thanks a bunch Al.

      I did find this code (below) at the thread you mentioned. I'm on HS2 so I assume this is the right code not the later version that you adapted for HS3.

      I'm not that well versed in programming. Can you hold my hand and explain what do I need to do with this code in order to make an alarm clock out of it.

      I can run it as a script in an HS event, however how do I enter the time of the alarm clock? Do I create one or more virtual devices to hold the alarm time? Do I hold the alarm time as "value" or as a "string" in those virtual devices? Where in the script should I point to my virtual devices? Besides adjusting the URL to point to my LMS is there any other customization needed? Last but not least any practical advise of how to design this in HSTouch?

      Thanks

      RI2

      Sub Main(ByVal parm As Object)
      Dim hspi As Object = hs.plugin("SqueezeBox")
      Dim y, command As String
      command = "aa:bb:cc:dd:ee:ff alarm add dow:1,2,3,4,5 enabled:1 repeat:1 url:loop://192.168.1.xxx/sounds/foghorn.mp3 time:25200"
      If hspi Is Nothing Then
      hs.WriteLog("SqueezeBox Script", "Plugin not found!")
      Else
      command = URLEncode(command)
      hs.writelog("SqueezeBox Alarm", command)
      y = hspi.ServerQueryCLICommand(command)
      hs.writelog("SqueezeBox Alarm", y)
      End If
      End Sub

      Function URLEncode(ByRef Text As String) As String
      Dim lngA As Long, strChar As String
      For lngA = 1 To Len(Text)
      strChar = Mid$(Text, lngA, 1)
      If strChar Like "[A-Za-z0-9]" Then
      ElseIf strChar = " "
      strChar = " "
      Else
      strChar = "%" & Right$("0" & Hex$(Asc(strChar)), 2)
      End If
      URLEncode = URLEncode & strChar
      Next lngA
      End Function

      Comment


        #4
        Originally posted by risquare View Post
        Thanks a bunch Al.

        I did find this code (below) at the thread you mentioned. I'm on HS2 so I assume this is the right code not the later version that you adapted for HS3.

        I'm not that well versed in programming. Can you hold my hand and explain what do I need to do with this code in order to make an alarm clock out of it.

        I can run it as a script in an HS event, however how do I enter the time of the alarm clock? Do I create one or more virtual devices to hold the alarm time? Do I hold the alarm time as "value" or as a "string" in those virtual devices? Where in the script should I point to my virtual devices? Besides adjusting the URL to point to my LMS is there any other customization needed? Last but not least any practical advise of how to design this in HSTouch?
        Hi RI2,

        I would envision two virtual devices for each alarm. One virtual device that would be used to enable/disable the alarm and the other to hold the time that you would want the alarm to go off.

        I don't have much experience with the HS Touch side, so you may need to ask questions elsewhere in the board on how to change the virtual devices from HS Touch.

        For the enable/disable virtual device, I would have events that trigger on it changing and then using the Squeezebox plugin actions to enable/disable the actual alarm on the player. I'm showing a screen shot of an HS3 event below as I don't have HS2 running any more.

        Click image for larger version

Name:	sb alarm enable.png
Views:	1
Size:	29.5 KB
ID:	1175431

        For setting the time, I would have a virtual device hold the time either in "regular" time format (would need to be in the "string" field) or seconds from midnight (could be in the "value" field). Seconds from midnight is how the Squeezebox server stores the time internally for alarms. If you take a look at the command below the first value is the mac address of the player, then "alarm add" is the command to add a new alarm, "dow" is the days of the week for which the alarm works, "enabled" means the alarm is active, "repeat" that the alarm is not a one time alarm, then the sound to play and finally the time in seconds past midnight for the alarm time.

        Code:
        aa:bb:cc:dd:ee:ff alarm add dow:1,2,3,4,5 enabled:1 repeat:1 url:loop://192.168.1.xxx/sounds/foghorn.mp3 time:25200
        There are also commands to delete alarms, update alarms, etc. Likely what is easiest in your case is that a change to the time virtual device, triggers an event that deletes the current alarm and then runs a script that creates a new alarm for the new time. The script can basically be the same as mine, except you would need to obtain the value from your alarm time virtual device and then modify the script command with the correct seconds after midnight. If you store the value as a "normal" time, then there are vb functions to convert and I can help with that. The easiest may be to start with having the virtual device hold the value in seconds past midnight and once you have the mechanics working, change it to hold a normal time. Hope that helps and feel free to ask more questions

        Cheers
        Al

        PS Things will be much simpler if you only use one alarm per SB player. They support more, but it gets more complicated trying to manage that.
        HS 4.2.8.0: 2134 Devices 1252 Events
        Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

        Comment


          #5
          I wanted simple alarm clock that requires zero HST programming/GUI creation so I built this:

          http://board.homeseer.com/showthread.php?t=157454

          I have now setup 3 different ones (one for each bedroom) and tie it to lights/music in those rooms. It is simple but works well.
          <!-- / message -->
          One of the events that triggers from setting alarm clock could be handling any SB updating ... I personally use sonos so events (next morning) just turn it on. I don't use sonos native alarm clock as plugin doesn't support that.

          Comment


            #6
            device value/status pairs

            Thanks Person.

            How do you set device value/status pairs in HS2?

            It seems that setting a virtual device to hold the alarm time is essential and I stumbled right here in the beginning without knowing how to setup device value/status pairs to have my virtual device look like yours in the illustration.

            Other than that your instructions are great and I do understand the rest of them. Furthermore, I'm already thinking of using your "early" event to prepare the wake-up music/sound in Sqeezebox and the real event to turn on the sound (for me those are two different things).

            RI2

            Comment


              #7
              Resolved

              Found the button in the device additional info page.
              Sorry for the stupid question.

              RI2

              Comment


                #8
                Hi RI2,

                One thing that you may want to do, rather than using the values 100, 200, etc. that Person did, is to use the seconds past midnight as the value. So 12:00 AM would be 0, 1:00 AM would be 3600, 2:00 AM would be 7200, etc. That way you can use that value with the script to set the SB alarm time.

                Cheers
                Al
                HS 4.2.8.0: 2134 Devices 1252 Events
                Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                Comment


                  #9
                  Thanks

                  Thanks for the kind advice and support.
                  I have more than one idea now how to make an alarm clock for each of my zones that are equipped with speakers and controlled by HS.
                  I'm afraid however that no one is going to use it since each member of our family is addicted to their smart phone and would rather use the smart phone for alarm.

                  Not every automation idea is worth implementing :-( For example, I have an automated motion sensing soap dispenser in the powder room. It was displaced so I moved it. It splashed a portion of soap on the counter top. Damn, I said and reached to wipe it just to get another splash on top of the hand that reached out. I had a good hand-wash and a good thought of how far the automation should go.

                  RI2

                  Comment


                    #10
                    Originally posted by risquare View Post
                    Thanks for the kind advice and support.
                    I have more than one idea now how to make an alarm clock for each of my zones that are equipped with speakers and controlled by HS.
                    I'm afraid however that no one is going to use it since each member of our family is addicted to their smart phone and would rather use the smart phone for alarm.


                    RI2
                    In ideal world either setting time in HS or on your phone should set the clock the same for both devices. There might be ways of doing this using tasker or similar software but that is way beyond my skills.

                    I found that having everyone use HS for alarm clock works well. Sometimes when I have something really important I also set alarm on my tablet. Oh and another thing that helped is following - when we turn off light in bedroom to go to sleep it announces the time alarm clock is setup for next morning. That helped to train us to use the HS clock and also helped us not miss events in few cases where clock needed to be adjusted due to one off time!

                    Comment


                      #11
                      In case anyone is interested in doing this, I've posted my solution (inspired by Person's methods) here: http://board.homeseer.com/showpost.p...34&postcount=2. It will set the SB alarm based on the status of a virtual alarm clock device and vice-versa. It can also be used to change when other events run (in my case a sunrise alarm).

                      Cheers
                      Al
                      HS 4.2.8.0: 2134 Devices 1252 Events
                      Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                      Comment

                      Working...
                      X