No announcement yet.

BT Connector performance issues

This topic is closed.
  • Filter
  • Time
  • Show
Clear All
new posts

    That's a damm fine idea to change the polling if you are out of the house. Has anyone worked out how to do it?


      It seems like Emotion has

      Originally posted by darren-mc View Post
      That's a damm fine idea to change the polling if you are out of the house. Has anyone worked out how to do it?
      He has done it thru scripting. He also seems to be the only one who has figured out how to make Iphones work (I don't have one, so no biggie for me)


        Changing the polling times has been posted in the forum before. Here's my BTProcessing.vb script. Call in an event with the paramer "ClientID|Interval". Note, the client ID can change if you add/modify clients.

        PHP Code:
        ''' <summary>
        Modify bluetooth client polling interval
        ''' </summary>
        <param name="Params">Client|Interval where Client is the bluetooth client device name as 
        ''' string and Interval is the time interval in seconds to poll</param>
        <remarks>This function changes the polling interval for a clientIt can be used
        ''' to make the polling interval longer when a client is detected or home and shorter
        once the client is not detected or awayThis allows the system to detect the client
        ''' faster on return without draining the battery while home.</remarks>
                Public Sub ChangePolling(ByVal Params As String)

                    Dim Client As String
                    Dim Interval As String
                    Dim arrParm() As String

                    arrParm = Split(Params, "|", -1, 1)
                    Client = arrParm(0)
                    Interval = arrParm(1)

        Save the new PollDelay value
        ' Force the plugin to update the polling interval
                    hs.Plugin("BT Connector").scanner.Devices(Client).ReloadConfig()
                End Sub 


          Here's another example script of how to change the polling interval.

          I agree it would be great if this were built in to the plugin.


            Hi Blinder,

            I have several iPhones registered of all different versions with the Bluetooth connector, they work OK with "ConnectService". I've found you must always pair your phone up with the PC with HomeSeer not running - works much faster. Then you must do the Bluetooth Connector stuff within HomeSeer fairly soon afterwards before the Bluetooth stack gets too busy - again, this just saves time.

            Here is a cut&paste of the Bluetooth routine taken from the Emotion application for HS which reconfigures the PollDelay and LostConfirm values to whatever you pass into the Sub.

            The important line is section = hs.GetINISection(SectionName, "hspi_bt.ini") which allows you to change the settings in hspi_bt.ini in the HomeSeer directory somewhere (I think in C:\Program Files\HomeSeer HS2\Config). Then you need to do a hs.Plugin("BT Connector").scanner.Devices(SectionName).ReloadConfig() to commit those changes and make them active without having to restart HomeSeer.

            Private Sub ConfigureBluetooth(ByVal PollDelay, ByVal LostConfirm, ByVal hcuc)
            Dim BtDevice As String
            Dim SectionName, items
            Dim section As String = ""
            Dim FoundSection As Boolean
            BtDevice = hcuc.ToLower
            For ds = 0 To MaxFriends
            SectionName = "Device" & ds.ToString
            section = hs.GetINISection(SectionName, "hspi_bt.ini")
            Catch : End Try
            If section = "" Then
            FoundSection = False
            Exit For
            End If
            items = Split(section, Chr(0))
            For I = 0 To UBound(items)
            If Strings.Left(items(I), 9) = "HsDevice=" Then
            If LCase(Mid(items(I), 10)) = BtDevice Then
            FoundSection = True
            Exit For
            End If
            End If
            If FoundSection = True Then 'Start configuring
            hs.SaveINISetting(SectionName, "PollDelay", PollDelay, "hspi_bt.ini")
            hs.SaveINISetting(SectionName, "LostConfirm", LostConfirm, "hspi_bt.ini")
            hs.Plugin("BT Connector").scanner.Devices(SectionName).ReloadConfig()
            Catch ex As Exception
            If My.Settings.Debug Then hs.WriteLogEx(My.Settings.ComputerSpoken, "Sub ConfigureBluetooth failed on hs.Plugin")
            End Try
            End Try
            Exit For
            End If
            End Sub


              Thanks for the scripts

              Looks like I'll be messing around with my first scripts.

              I still need to review these and figure out what Emotion's scripts are doing, it's obviouls that it's doing more than the obvious!

              There is no way I could have even started without some help.

              Thanks again!


                Hi Emotion,

                After running your script to change the bluetooth poll delay for home/away

                I get the message:

                Script compile error: Der Name "ds" wurde nicht deklariert.on line 20

                Where is the issue ?

                Regards, Fischi


                  It looks like the ds variable isn't being correctly defined by the For command above or that you've used the ds variable again perhaps outside of the For Next loop. Check what you've cut and pasted matches the code.


                    Thanks Emotion,
                    but I didn't understand what you mean.
                    Could you give me more details ?

                    Reg. Fischi