Announcement

Collapse
No announcement yet.

BlueTooth Connector Features and Documentation

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    BlueTooth Connector Features and Documentation

    The Bluetooth Connector has been released and is available through the HomeSeer updater.

    To download the latest release for HomeSeer 2.0 and HomeSeer 2.1, see here: http://board.homeseer.com/showthread.php?t=111846


    Features:

    - Supports both the Microsoft and the Widcomm Bluetooth Stacks. Does not support the Toshiba, BlueSoleil or other Bluetooth stacks.
    - Supports RSSI (signal strength) on the Widcomm stack only
    - Currently supports 3 polling methods (Connect to Service, Discover Services, or AutoDiscovery).
    - The AutoDiscovery method does not support signal strength, as it does not connect to the device (It uses BT discovery packets).
    - Configurable polling interval for each device
    - Autocreates HomeSeer device for each BT Device, or use any existing (pre-created) HomeSeer device.
    - You can rename the Bluetooth device to anything you want in the HomeSeer status page.
    - Polling for each Bluetooth device can be independantly Enabled / Disabled from the web configuration interface.
    - Additional "Device lost confirmation polls" configurable for each device.
    - Supports setting multiple device strings and values based on signal strength through the plugin web configuration interface.

    To install the plugin:

    - Shutdown HomeSeer
    - Unzip the attached file and copy the content to the HomeSeer 2 directory. There is an html subdirectory (for the web configuration interface) that must go to the HomeSeer 2 html subdirectory. If you copy the whole directory as-is, everything should be OK.
    - Restart HomeSeer2
    - Go to Setup / Interfaces
    - Enable the 'BT Connector' interface (by clicking the 'Disabled' button)
    - Click the 'Save' button
    - Click the yellow 'Config' button
    - An empty list of Bluetooth devices should appear
    - Turn on a first Bluetooth device, and click the "Scan for new Bluetooth Devices" button
    - After a while (please wait) the device should appear in the list (if it doesn't you can try to scan again)
    - Click the 'Edit' button
    - Fill a HomeSeer Device Code (such as w1...) in the 'HS Device' column
    - Click 'Update'
    - Click 'Enable'

    Then you can go to the HomeSeer Device Status page, and watch your new Device Status (it may take as long as the specified polling period for the initial update)


    How to use Signal Strengh and Device Strings

    In the latest versions of the plugin, all this is configurable through the Web Configuration interface...

    The description of the config file hspi_bt bellow is only kept here for reference.

    Here is the format of a Bluetooth Device section in Config/hspi_bt.ini:

    [Device0]
    Enabled=True
    BtAddress=(00:07:E0:5C:91:EC)
    PollDelay=10
    PollMethod=ConnectService
    PollService=1
    HsDevice="w1"
    HsConfig0=2,Too Close, @(Network0) > 1
    HsConfig1=1,Normal, @(Network0) >= -1
    HsConfig2=3,Too Far, @(Network0) > -15
    HsConfig3=0,Away, true


    The HsConfigX entries are evaluated in order. The first boolean expression that matches will assign the specified device value and device string to the HomeSeer device.

    HsConfigX= Device Value <HS device value>, Device String<HS device string>, Boolean expression

    The Boolean expressions can be anything and follow the C# syntax.
    The variables @(Network0), @(Network1), @(Network2)... represent the signal strength seen from each network (Bluetooth dongle).

    For Example:

    HsConfig0=5,Kitchen,@(Network0)>-5 && @(Network0)<1 && (@Network1)>-15 && (@Network1) <=0 && (@Network2) > -4

    This will assign value 5 and status string "Kitchen" to the device if the boolean expression matches the specified signal strength from Networks 0, 1 and 2.

    You should always add a last HsConfigX statement with expression "true" such as in the example (HsConfig3=0,Away, true). This last statement will match if none of the above statement matched.

    If you use the Microsoft stack and want to use device strings, you can configure something very simple such as:

    HsConfig0=1,Device Present, @(Network0)>=0
    HsConfig1=0,Device Away, true

    Don't forget that you may have to Shutdown HomeSeer before making manual changes to the .ini, because HomeSeer may cache the config file internaly.


    Advanced functionalities of the expression evaluator (this may be usefull for advanced positionning if you have good BT dongles)

    Valid unary operators: <CODE>-</CODE>, <CODE>!</CODE>, <CODE>~</CODE>.
    Valid binary operators: <CODE>*</CODE>, <CODE>/</CODE>, <CODE>%</CODE>, <CODE>+</CODE>, <CODE>-</CODE>, <CODE><</CODE>, <CODE><=</CODE>, <CODE>></CODE>, <CODE>>=</CODE>, <CODE>==</CODE> (also <CODE>=</CODE>), <CODE>!=</CODE>, <CODE>&</CODE>, <CODE>^</CODE>, <CODE>!</CODE>, <CODE>&&</CODE>, <CODE>||</CODE>.
    Parenthesis are evaluated first.
    E-notation (<CODE>7.511E-10</CODE>) is allowed for numbers and...
    Hexadecimal as well (<CODE>0xaaf1</CODE>).
    Math functions:

    "sin","cos","tan","sec","csc","cot","asin","acos","atan"
    "sinh","cosh","tanh","abs","sqrt","ciel","floor","exp"
    "log10","log","max","min","pow","round", "PI", "E"

    DateTime functions:

    "now","today","mindate","maxdate","monthname"
    "adddays","addmonths","addyears","addhours","addminutes", "addseconds"

    Logical functions:

    "iif", "case"

    Other:

    - You may remove the dll BlueToolsMS.dll from your HomeSeer2 directory if you use the Widcomm stack

    - You may remove BluetoolsWC.dll and BluetoolsWC150.dll if you use the MS stack.

    - The Bluetooth lib doesn't currently support multiple dongles per computer. It should be available soon but I didn't get any release date from the Lib developer.


    Last edited by stipus; June 16, 2008, 04:37 PM.
    --
    stipus

    #2
    Any feedback ?

    TIA,
    --
    stipus

    Comment


      #3
      Hi Stipus, first of all thanks alot for this plugin

      some feedback

      - plugin is turning on the screen of my phone every time it polls, this happens using connectservice or discoverservice and also on both the widcom or microsoft stack (this never happend using the bluetooth scanner you posted in a previous thread).

      - discoverservice works on both stacks, connectservice only works using the widcomm stack.

      - would it possible to include/display the device name after a scan, making it easier to identify

      - a delete button would also be usefull to delete any unwanted devices after a scan, although doing this by editing the ini file was easy enough.

      I really hope theres something you can do about my phone/screen problem as this would be a show stopper for me.

      Nick

      Comment


        #4
        Nick,

        1) I have a new version of the plugin ready with a new poll method (autodiscovery) that shouldn't turn on your phone screen. I have a few checks to make before releasing it (hopefully within a few hours).

        2) I really don't understand why ConnectService doesn't work on the MS Stack. It should. Did you try a few different service number (1, 2, 3... ) ?

        3) I'm going to add device names right now.
        --
        stipus

        Comment


          #5
          Nick,

          1) I have a new version of the plugin ready with a new poll method (autodiscovery) that shouldn't turn on your phone screen. I have a few checks to make before releasing it (hopefully within a few hours)..
          talk about service, thanks stipus will look forward to trying it out tomorrow

          2) I really don't understand why ConnectService doesn't work on the MS Stack. It should. Did you try a few different service number (1, 2, 3... ) ?
          didnt try a different service number but will tomorrow, funny thing it still turned on the screen, but status stayed the same (away)

          3) I'm going to add device names right now.
          excellent


          Nick

          Comment


            #6
            OK. Here is version V0.2 of the plugin.

            1) Bluetooth Address have been replaced with Bluetooth Names. You must clear your Config/hspi_bt.ini and scan for bluetooth devices again as names are retrieved during scanning. Bluetooth Names are also written to the HomeSeer Device name if you let the plugin create the HomeSeer device. (If it's already existing, the HomeSeer device won't be changed).

            2) A new polling method has been implemented (AutoDiscovery) that should interract a lot less with the Bluetooth Devices. You can change this from the Web Configuration Interface.

            In the .ini [Network0] section, there are new parameters you can experiment with:

            [Network0]
            AutoDiscovery=True | False (Default=True)
            AutoDiscoveryInterval=number of seconds (Default=10) (0 for as fast as possible)

            If you Set AutoDiscovery to False for the Network, Devices with PollMethod=AutoDiscovery will default to PollMethod=ConnectService for this Network.
            Last edited by stipus; February 25, 2006, 04:29 AM.
            --
            stipus

            Comment


              #7
              I should be in bed but I couldn't help myself, new version works great !

              although I had to enable discovery on the phone , this is something I can live with.

              thanks again stipus for a great plugin and even greater service.

              Now I'm definately off to bed, please no more updates until tomorrow



              Nick

              Comment


                #8
                Hi stipus,

                Tried version 1 but got an error, just tried version 2 and am still getting this error (see screengrab)

                Thanks, TrOjAn
                Attached Files

                Comment


                  #9
                  Trojan,

                  I really don't understand. The HomeSeer2.Application object always had a Connect() method.

                  What version of HomeSeer2 are you running ?
                  --
                  stipus

                  Comment


                    #10
                    Good call stipus, yes works in 2041.... it didnt pick up my phone but thats not important at the moment..

                    TrOjAn

                    Comment


                      #11
                      I tested the plugin from V2003 to V2052.

                      I would really like to know what Method replaces Connect() in new HomeSeer versions, because all my plugins use it.

                      I suspect the new Method has 2 aditional parameters such as Connect( user, password) because the availability of the Connect() method without password was hmmmm.... a little dangerous (security hole).
                      --
                      stipus

                      Comment


                        #12
                        Nick777,

                        Did you have any interesting results with the NSLU2 experiment ?

                        It would be cool to see the output of each NSLU2 as additional Networks in the plugin.
                        --
                        stipus

                        Comment


                          #13
                          More feedback from anyone ?
                          --
                          stipus

                          Comment


                            #14
                            stipus.. sorry bud, not usable on mine when i did run it on 2041 it didnt seem to be able to find my K750i using the 100meter dongle on the HS2 box.

                            TrOjAn

                            Comment


                              #15
                              Can you provide more info for this problem ?

                              What stack are you running (Microsoft or Widcomm ?)

                              Can you discover your K750i using the operating system bluetooth discovery tool (completely independant of the plugin) ? You don't need to reinstall 2041 to try this.

                              stipus
                              --
                              stipus

                              Comment

                              Working...
                              X