Announcement

Collapse
No announcement yet.

Play wav on Android Client Through a Script?

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

    Play wav on Android Client Through a Script?

    Wav files are played properly when sent from an event, but I really need to send them via script. All of my tablets are configurable by setup screens (user management, tablet management, camera management, etc...) which looks like this as an example:

    Click image for larger version

Name:	Tablet Management Screen.PNG
Views:	111
Size:	180.6 KB
ID:	1267544

    The tablet names are stored as virtual devices, and the only thing that I can't get to work is the frakking door chime function. Screens can be controlled via script using:

    hs.PluginFunction("HSTouch Server", "", "ClientAction", New Object() {70, "Android" & ":" & "Lenovo Tab 4 10", "TV Screen", ""})

    But when I try to send a wav, no joy. I've tried:

    Code:
    hs.PluginFunction("HSTouch Server", "", "ClientAction", New Object() {100, "JEFF-TOWER:SAMSUNG NOTE TABLET", "D:OpenDoorChime.wav", ""})
    hs.PluginFunction("HSTouch Server", "", "ClientAction", New Object() {100, "ANDROID:SAMSUNG NOTE TABLET", "D:OpenDoorChime.wav", ""})
    I've tried putting the wav file in every conceivable HS3 folder as well, the D: drive was just my last attempt. The log shows no error when running the script.

    Has anyone tried using "ClientAction 100" on an Android client? Is my syntax wrong?

    Any help would be appreciated because I need to get away from events so variables can be used instead of hard coding when tablet names change/are added or deleted.

    Jeff

    #2
    I'm pretty sure hs.Speak() will take a wav file as input - try it out and see if that works...
    HS4Pro on a Raspberry Pi4
    54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
    Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

    HSTouch Clients: 1 Android

    Comment


      #3
      Originally posted by rmasonjr View Post
      I'm pretty sure hs.Speak() will take a wav file as input - try it out and see if that works...
      That worked, thank you so much!!! It took a little experimenting with the hs.speak() syntax, but here is the script to send wav files to specific clients:

      Code:
      Sub Main(ByVal parm As Object)
      
          Dim TNumber, CurrentTablet, CurrentTabletN, CurrentTabletName, CurrentTabletFullName, CurrentTabletChime
          TNumber=0
      
          Do While TNumber < 8
              CurrentTablet = "Tablet" & TNumber & "DoorChime"
              CurrentTabletN = "Tablet" & TNumber & "Name"
              CurrentTabletName = hs.DeviceStringByName(CurrentTabletN) ' Get current tablet name
              CurrentTabletFullName = "JEFF-TOWER:" & CurrentTabletName ' Create full client name to send wav file to
              CurrentTabletChime = hs.DeviceValueByName(CurrentTablet) ' Get Current tablet Chime on/off value
              hs.writelog("Chime",CStr("Tablet: " & CurrentTablet & " Named: " & CurrentTabletFullName & "is set to: " & CurrentTabletChime))
              If CurrentTabletChime = 100
      [B]        hs.Speak("C:\Program Files (x86)\HomeSeer HS3\Media\DoorAlertChime.wav", True, CurrentTabletFullName)[/B]
              End If
              TNumber = TNumber + 1
          Loop
      
      End sub
      The loop is to step through 8 potential clients that can be set to chime when a zone opens.

      FYI - all of this could be avoided if HS would just make the client name accessible as a system variable. I've asked and they said "We can't do that at this time." Grrr...

      Comment


        #4
        Have you experimented with hs.GetInstanceList?
        Mike____________________________________________________________ __________________
        HS3 Pro Edition 3.0.0.548, NUC i3

        HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

        Comment


          #5
          Originally posted by Uncle Michael View Post
          Have you experimented with hs.GetInstanceList?
          I have not seen hs.GetInstanceList, is it better/more efficient?

          Comment


            #6
            I don't have experience using it, but it is supposed to return a list of your active speaker clients. It's a bit obscure, so I was just wondering if you'd seen it and if it would be of use.
            Mike____________________________________________________________ __________________
            HS3 Pro Edition 3.0.0.548, NUC i3

            HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

            Comment


              #7
              It works, not what I need, but I'm sure I can use it for something in the future. This code:

              Code:
              Sub Main(ByVal parm As Object)
              
                  Dim SpeakClients As String = ""
                  SpeakClients = hs.GetInstanceList
                  hs.writelog("Speakers", CStr(" Status: ") & SpeakClients)
              
              End sub
              Returns this:
              Dec-19 5:46:32 PM Speakers Status: JEFF-TOWEREFAULT,JEFF-TOWER:IPAD,JEFF-TOWER:SAMSUNG NOTE TABLET
              Dec-19 5:46:32 PM Event Running script in background: C:/Program Files (x86)/HomeSeer HS3/scripts/Test.vb
              Dec-19 5:46:32 PM Event Event Trigger "Utility & Test Events Test"
              Thanks for the help!

              Jeff

              Comment


                #8
                Thank you for that information! I have been searching for a way to determine if a HS3 Touch Tablet is online or not. Looks like hs.GetInstanceList might be an answer.

                Comment

                Working...
                X