Announcement

Collapse
No announcement yet.

Redux: Android Speaker Client frequently disconnects

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

    Redux: Android Speaker Client frequently disconnects

    Revisiting an issue from long ago that I've never resolved: The speaker client on my LG G5 (Android) keeps getting disconnected...and sometimes, it will reconnect on its own a few minutes later.

    Log snippets:
    Dec-07 6:13:32 PM HSTouch Server Client Android:Jim's LG G5 (192.168.x.x/4086) has raised LineDisconnected or was forced closed.
    Dec-07 6:13:32 PM HSTouch Server Client Android named Jim's LG G5 has DISCONNECTED.
    Dec-07 6:21:17 PM HSTouch Server Client Android (192.168.x.x/4257) named Jim's LG G5 has CONNECTED.
    Dec-07 6:21:17 PM Speaker Speaker host added, Name: CIC Instance: Jim's LG G5 IP address: 192.168.x.x
    1. Is this a known issue? If there is something I can do to stop this from happening, I'm all ears.
    2. Is there a way of programatticaly (sp) forcing a connection to my Android Speaker Client? I was thinking of using Jon00's excellent HSLogMonitor to fire an event whenever it sees LineDisconnected or whatever, but I wouldn't know what to put in the event. There doesn't even seem to be a script function that forces (pushes) a connection to a specific client.
    I await your solution(s).


    Current Date/Time: 12/8/2020 12:25:34 AM
    HomeSeer Version: HS3 Standard Edition 3.0.0.548
    Operating System: Microsoft Windows 10 Home - Work Station
    System Uptime: 7 Days 4 Hours 41 Minutes 34 Seconds
    IP Address: 192.168.9.121
    Number of Devices: 288
    Number of Events: 113
    Available Threads: 600
    HSTouch Enabled: True
    Event Threads: 0
    Event Trigger Eval Queue: 0
    Event Trigger Priority Eval Queue: 0
    Device Exec Queue: 0
    HSTouch Event Queue: 0
    Email Send Queue: 0
    Anti Virus Installed: Windows Defender
    In Virtual Machine: No MFG: gigabyte technology co., ltd.
    Enabled Plug-Ins
    3.0.0.71: EasyTrigger
    3.0.7.1: Insteon Thermostat
    3.0.7.19: Insteon
    1.0.0.354: MagicHome


    Jim Speiser
    37-year veteran of Home Automation
    Still don't know squat

    #2
    I didn't write this : https://www.techjunkie.com/lg-g5-not...ected-to-wifi/ but may be worth investigating

    Eman.
    TinkerLand : Life's Choices,"No One Size Fits All"

    Comment


      #3
      Originally posted by Eman View Post
      I didn't write this : https://www.techjunkie.com/lg-g5-not...ected-to-wifi/ but may be worth investigating

      Eman.
      Well, I understood most of that, in spite of the typos and Koringlish. I will give it a try.


      Jim Speiser
      37-year veteran of Home Automation
      Still don't know squat

      Comment


        #4
        Originally posted by Eman View Post
        I didn't write this : https://www.techjunkie.com/lg-g5-not...ected-to-wifi/ but may be worth investigating

        Eman.
        So you're thinking my problem is the constant switching back and forth between the router and the 4G? Hmmmm....


        Jim Speiser
        37-year veteran of Home Automation
        Still don't know squat

        Comment


          #5
          Originally posted by JimSpy View Post

          So you're thinking my problem is the constant switching back and forth between the router and the 4G? Hmmmm....
          Especially with Android beyond version 6. They introduced a lot of features security and battery saving to compete with iOS battery life.

          If tablets, best choice is the Chinese types some of which include RJ45 (Ethernet) communication and some are even PoE.

          Tip : If you doubt the HSTouch client, is best to make sure you have your designs in a safe place before you can wipe it out the phone then re-install it.


          Eman.
          TinkerLand : Life's Choices,"No One Size Fits All"

          Comment


            #6
            I had the same problem on and off with samsung and other tablets. I increased the number of AP and I only get a disconnect when HSTouch hangs or the android tablet reboots. I also turned off alot of the crap on the tablets that are just not needed when you run as dedicated HSTouch. All of my speaker clients are android tablets. I use this in the following script to set the name of the client. You could modify to see what items had logged off.

            Code:
            REM HSTouchClientID.vb - JLG
            REM Replacement Script to identify each client uniquely and without user intervention
            REM Started 6-1-2020, First Testing 6-4-2020.
            REM Logic Breakdown
            REM Set Client Text, Client Number, Screen Used For setup.
            REM Get Current Speaker List
            REM Retrieve Saved Speaker List
            REM If Current List is nothing or unchanged - Exit Routine
            REM Split the List into clients
            REM Compare list to clients specified
            REM When Client found set client name
            REM Save most current speaker list to global var
            
            IMPORTS System.Core
            IMPORTS System.IO
            
            Sub Main(ByVal parms As Object)
            
            '--------------------------------------
            'Variable Declaration
            '--------------------------------------
            Dim parm As String
            Dim myList As String
            Dim gList As String
            Dim gVar As String
            Dim i As Integer
            Dim j As Integer
            Dim ListElement As Integer
            Dim ClientName As String
            Dim myClients() As String
            Dim HostClient() As String
            Dim ListClient() As String
            Dim Found As Boolean
            Dim err
            Dim err1
            
            '--------------------------------------
            'User Setup for HSTOUCH Clients
            ' The user should change the three lines below to
            ' The Number of HStouch Clients - 1 --->MaxClients
            ' The HSTouch Screen name where the corresponding elements were created ---> Screen
            ' The names of the Clients ---> Clients " _" must have no characters following or won't compile
            '--------------------------------------
            
            Dim MaxClients As Integer = 9 ' Arrays start at element 0 so Count - 1
            Dim Screen As String = "Setup:" ' The hstouch screen used for setup must have :
            Dim Clients(9) As String
            
            If parms.GetType().ToString = "System.String" Then 'Called from an Event
            parm = parms.ToString()
            Else ' Called from HSTouch
            parm = parms(0).ToString()
            End If 'Now use parm as your input variable...
            
            ' hs.WriteLog("Names", parm)
            
            gvar = "instances"
            Clients(0) = "Android:MainFloor"
            Clients(1) = "Android:Bar"
            Clients(2) = "Android:Media"
            Clients(3) = "Android:Upstairs"
            Clients(4) = "Android:TV-Netflix"
            Clients(5) = "Android:Dad"
            Clients(6) = "Android:JPhone"
            Clients(7) = "Android:GPhone"
            Clients(8) = "AcerLaptop:AcerLaptop"
            Clients(9) = "Virtual-Win7:Virtual-Win7"
            
            '--------------------------------------
            'Determine the Client List
            ' Please note that the speaker list is serving as a proxy for the client list.
            ' The two are not necessarily the same and there has to be modifications to deal with different sources.
            ' The list is stored in a Global variable named "instances". This is used to check against current list
            ' and if there are no changes to exit the routine. This is an efficiency measure to allow more frequent
            ' calls.
            '--------------------------------------
            
            hs.CounterIncrement("ClientID")
            
            If hs.CounterValue("ClientID") > 10 Then 'Force a run after 5 minutes during day and 150 minutes at night
            hs.CounterReset("ClientID")
            hs.SaveVar(gvar, "Junk")
            End If
            
            myList = hs.GetInstanceList
            gList = hs.GetVar(gvar)
            ' hs.WriteLog("Names", myList)
            
            If myList = gList Then
            Exit Sub
            End If
            
            If myList Is Nothing Then
            Exit Sub
            End If
            
            '--------------------------------------
            'Find the appropriate Client to Send release element command
            '--------------------------------------
            
            myClients = Split(myList, ",", -1, 1) 'Split InstanceList into individual clients.
            ' hs.WriteLog("Names", myList)
            
            For i = 0 To myClients.Length-1
            
            HostClient = Split(myClients(i), ":", -1, 1) 'Element 1 of HostClient is the hstouch client
            
            ' hs.WriteLog("Names", HostClient(1))
            
            Found = False
            
            For j = 0 to MaxClients
            
            ListClient = Split(Clients(j), ":", -1, 1)
            
            If HostClient(1) = UCase(ListClient(1)) Then
            ListElement = j
            Found = True
            Exit For
            End If
            
            Next
            
            '--------------------------------------
            'Send release element to Tablet Found
            '--------------------------------------
            
            If Found Then
            ' hs.WriteLog("Names", ListClient(1))
            Dim ArrString = New Object() {35, Clients(ListElement), Screen & ListClient(1), ""}
            err1 = hs.PluginFunction("HSTouch Server", "", "ClientAction", ArrString) ' Set Client name
            If err1 <> "" then
            hs.WriteLog("Names", "Error from hs.PluginFunction = " & err)
            End If
            Else
            hs.WriteLog("Names", "Client " & myClients(i) & "Not Found - No Action Taken. Client Remains Unnamed")
            End If
            
            Next
            
            err = hs.SaveVar(gvar, myList) 'Save to the Global Variable so minimize runtime
            
            If err <> "" then
            hs.WriteLog("Names", "Error Saving List to Global Variable")
            End If
            
            End Sub

            Comment


              #7
              Originally posted by Eman View Post

              Especially with Android beyond version 6. They introduced a lot of features security and battery saving to compete with iOS battery life.

              If tablets, best choice is the Chinese types some of which include RJ45 (Ethernet) communication and some are even PoE.

              Tip : If you doubt the HSTouch client, is best to make sure you have your designs in a safe place before you can wipe it out the phone then re-install it.


              Eman.
              This ain't no tablet, just a smartphone.
              I don't have designs, I just use the default screens. Haven't gotten into the designer yet.
              Those instructions you linked me to aren't workable. They don't match the menu structure on my phone. Furthermore I can't find any "Smart Network Switch." They may have dropped it since that article was written 5 years ago; perhaps as you say to keep up with the Apples.

              But thanks for the effort!

              ==JJS==


              Jim Speiser
              37-year veteran of Home Automation
              Still don't know squat

              Comment


                #8
                Originally posted by AllHailJ View Post
                I had the same problem on and off with samsung and other tablets. I increased the number of AP and I only get a disconnect when HSTouch hangs or the android tablet reboots.
                Please, what does it mean, ":increased the number of AP"? Is that Access Points? I got a Gryphon router and a mesh repeater, I'm pretty well covered here. And besides, I do leave my house once in a while (masked up, of course!), so that wouldn't help me on the road. This problem manifests randomly no matter where I am.



                Jim Speiser
                37-year veteran of Home Automation
                Still don't know squat

                Comment


                  #9
                  Yes Access Points.

                  Comment


                    #10
                    If you are using your phone then the app has to stay visible to prevent disconnects. If the app is put in the background the phone software will sever the connection in most instances.
                    -Rupp
                    sigpic

                    Comment


                      #11
                      Originally posted by Rupp View Post
                      If you are using your phone then the app has to stay visible to prevent disconnects. If the app is put in the background the phone software will sever the connection in most instances.
                      Well, then, HSTouch just became a dunsel for me. Anyway, I have control through my Alexa app, I guess that will be good enough.
                      Just out of curiosity, does that apply to the new HS mobile product?


                      Jim Speiser
                      37-year veteran of Home Automation
                      Still don't know squat

                      Comment


                        #12
                        From what I remember, Rich/Mark are Android users... One thing that I love to do is repurpose old phones or tablets as speaker clients. Unfortunately, Android has evolved to block apps with legacy-type coding from running all the time, to prevent battery consumption. I use Tasker to attempt to ensure HS3 Touch app is in foreground all the time, but it sometimes doesn't even work, so I added another task to literally kill everything, and restart the app, once per hour. Still, not always foolproof. And yes, I have disabled all battery and power optimizations.

                        While the new HS Mobile is lacking the speaker client, I really wish a new app can be published that is only a speaker client. There are many newer apps that take advantage of new APIs that do allow lots to go on while running in the background, and in my opinion, would be a huge benefit to using old devices as clients. It is so easy to put one in every room of the house, outside, etc... on Wifi Only, and block outgoing to internet via firewall (since these devices no longer get security updates).

                        But yes, I get tons of disconnects, and hopefully someone at the head office whips up a lightweight app that can be used as a standalone client

                        Kevin

                        Comment


                          #13
                          kevins669
                          But yes, I get tons of disconnects, and hopefully someone at the head office whips up a lightweight app that can be used as a standalone client
                          Maybe help me beat the drum here : https://forums.homeseer.com/forum/ul...id-speaker-app


                          Eman.
                          TinkerLand : Life's Choices,"No One Size Fits All"

                          Comment


                            #14
                            Eman Will do. I am sure they will bring Speaker Client to the new HS Mobile eventually, but I see a ton more flexibility for older devices and easier management to just have something that can deployed on cheap or old android devices. I am afraid it will get lost in the Alexa/Node Red shuffle, though... I hate to ditch all these old phones!

                            Comment

                            Working...
                            X