Announcement

Collapse
No announcement yet.

EZsnsRF (dakota motion sensor) external script

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

    EZsnsRF (dakota motion sensor) external script

    UPDATE: Check below for a new version of this script!


    All:

    Here's my first stab at a script to add support for the EZsnsRF module from simplehomenet to the Homeseer Insteon Plug-in. If you aren't aware, the EZsnsRF module sends Insteon events when it receives RF-based triggers from Dakota Alert sensors. The system has a remarkable RF range (I use it for 400' runs personally, and they claim it can send signals as far as 3000') and is only mildly painful to setup.

    I have this working (for me) to the point where it recognizes on and off events from 2 of my Dakota Alert outdoor motion sensor modules. There's a lot of work to be done on the code still, and I'm waiting on simplehomenet to furnish me with documentation on exactly what the module sends, but this appears to work for the first 2 sensor groups in the device (I've currently set it up for a maximum of 8 but I understand it internally can recognize up to 20 -- I'll fix this in future updates)

    I've only tested this against the first PLM beta, and have no idea what it does w/ the PLC. [UPDATE: I can confirm it works with my PLC, too.]

    In order for this to work:

    1) You will need to manually pair your RF module with the sensors per the Quick Start guide, and then set the RF module to send updates to a module in your home. I used an unused PLC module as the target.

    2) Back up your current Insteon_ExtDevSupport.vb file in the homeseer 2 scripts directory. Keep it someplace safe since you're taking your life in your own hands by using this code.

    3) Download the attachment. You will need to rename this script Insteon_ExtDevSupport.vb and place it inside your homeseer 2 scripts directory.

    4) Edit the script and insert the ID of your RF module. Change the House Code if you have X10 or other modules using E already.

    5) Restart Homeseer 2. It should create 8 new devices, E40-E47. E40 will react to the first sensor you paired against the EZsnsRF. E41 will react to the second paired sensor, and so on.

    6) Test the module by watching the logs. Note that by default the EZsnsRF sends on followed almost immediately by off, so it's almost impossible to see a sensor in the on state in Homeseer's status screen (unless you've specifically programmed the ezsnsrf to delay sending the off signal). Watching the logs will show you the data as it goes by. When it works, you should currently see (in debug mode) something like this:

    Code:
    6/11/2007 5:15:49 PM   Insteon_ExtDevSupport.vb  Received Insteon Data 01 08 9E 01 00 00 01 CB 11 00 
    6/11/2007 5:15:49 PM   Insteon_ExtDevSupport.vb  SNSRFDebug: 0:01, 1:08, 2:9E, 3:01, 4:00, 5:00, 6:01, 7:CB, 8:11, 9:00 
    6/11/2007 5:15:49 PM   Insteon_ExtDevSupport.vb  SNSRFDebug: GroupNum:1 
    6/11/2007 5:15:49 PM   Insteon_ExtDevSupport.vb  ProcessEZSnsRFGroupCmd: 1, 11 
    6/11/2007 5:15:49 PM   Insteon_ExtDevSupport.vb  Turning device E40 on 
    6/11/2007 5:15:51 PM   Insteon_ExtDevSupport.vb  Received Insteon Data 01 08 9E 01 00 00 01 CB 13 00 
    6/11/2007 5:15:51 PM   Insteon_ExtDevSupport.vb  SNSRFDebug: 0:01, 1:08, 2:9E, 3:01, 4:00, 5:00, 6:01, 7:CB, 8:13, 9:00 
    6/11/2007 5:15:51 PM   Insteon_ExtDevSupport.vb  SNSRFDebug: GroupNum:1 
    6/11/2007 5:15:51 PM   Insteon_ExtDevSupport.vb  ProcessEZSnsRFGroupCmd: 1, 13 
    6/11/2007 5:15:51 PM   Insteon_ExtDevSupport.vb  Turning device E40 off
    That's it. You can either directly define trigger events based on status change to the devices E40-E47 to have homeseer take action based on the motion sensors, or you can use a third-party plugin like DooMotion (which I love) to handle groups of sensors by setting E40-E47 as motion sensors.

    Good luck -- feel free to PM me with questions!

    -Tom

    UPDATE: Check below for a new version of this script!
    Last edited by bobwondernut; August 31, 2007, 07:21 PM.

    #2
    Hi Bob,
    Thanks for doing this, I am eager to give it a try. One question: Can I use a keypad linc button as the module that is monitored by insteon? You mention you use a PLC. Is there something special about the PLC, or will any Insteon device that turns on/off work as a module?

    Also, do I need to re-do my pairings after your software has been installed, or will the installation work with a previously done pairing?
    Thanks
    Jono

    Comment


      #3
      I haven't tried it against a keypadlinc, but I imagine it might work.

      You shouldn't need to change or reassign any pairings after you install.

      I've tested with my PLC and the script seems to function with it as well. There's definitely some tightening up to do, but it should work for basic needs for now.

      Comment


        #4
        Tom,
        I don't one of these devices, but I'm looking into one.... My question is that it seems like you need to have an unused Insteon device linked to the SimpleHomeNet RF device. Is that correct? You used an old PLC, but I assume that could have been any lamp or such. So, does that mean if I have 4 wireless sensors, then I need 4 lamp modules plugged in that do nothing but give me status of the wireless sensors?

        Or am I missing something here?

        Thanks,

        Chad.

        Comment


          #5
          Hey Chad:

          I used my disconnected PLC because I was testing the PLM at the time and couldn't get the snsrf to link up to the PLM. If you have a PLC, you should be able to manually link the EZsnsRF to the PLC per the printed quick start instructions (hint: use the link button on the PLC as tap-add or manual-add via the plug-in doesn't work).

          I currently have my sensor linked in this way to the PLC I'm using in homeseer. The script is working with both the PLM and the PLC at this time, whichever one I happen to have installed.

          You can link multiple sensors against the same target module, but you have to perform the full linking procedure once for each rf sensor you set up.

          As you link multiple sensors, remember that the first IR sensor you link will show as E40, the next E41, and so on.

          Comment


            #6
            Hi Tom
            I tried this and am having some difficulty, but it could be my rudimenatary knowledge of this stuff.

            First, I don't have a file in my scripts directory with the name you use, but instead have
            Insteon_ExtDevSupport_Source.vb

            Should I remove the file I have and replace it with yours, renamed as you described? Or should I keep that one as well as yours? If I do have to remove the "source" one, do you know what functionality I might lose?

            Second, I was not able to fine where the new devices E40 to E47 are located. Is this supposed to appear in the general homeseer logging, or in some other logging?

            Thanks much
            Jono

            Comment


              #7
              Hey Jono:

              It has to be in the scripts directory, and explicitly named Insteon_ExtDevSupport.vb. The Insteon_ExtDevSupport_Source.vb is the example code that they ship with the plug-in, but it isn't enabled by default and has to be renamed in order to load.

              Make sure you changed the ID in the script to match the hex id of the rf module -- this is a must in order for it to work.

              When it's working, you'll see a message on the main Insteon Configuration web page directly above the "Save changes" button that says:

              Externally registered device: EZSnsRF1 (Insteon Address xx.xx.xx) registered through Insteon_ExtDevSupport.vb method EZSnsRFRcv

              where xx.xx.xx will be the ID of your ezsnsrf module. if you don't see this message, then the script isn't installed correctly or you haven't set the right address for the rf module in the script. You won't see E40-E47 until you've set up the script per the instructions above.

              don't forget to restart homeseer in between script changes.

              Comment


                #8
                this is very helpful, but unfortunately still not working for me. Could it be how the file is saved? I am using the correct file name and it is saved as a text file using ANSI encoding.


                My log says
                6/24/2007 1:48:22 AM - Startup - Scripting is OK
                6/24/2007 1:48:22 AM - Info - Finished initializing scripting

                but I don't see the new entries you mention
                thanks again for your guidance
                Jono

                Comment


                  #9
                  Hey Jono:

                  That's homeseer's internal scripting initialization messages and not the insteon plugin's. I have debugging enabled on the insteon config page, and when I start up HS2 with the script placed at c:\program files\homeseer 2\scripts\Insteon_ExtDevSupport.vb I see the following lines. Note that the insteon plug-in doesn't instantiate the script until after all start-up is complete.

                  Code:
                  6/24/2007 8:49:13 AM ~!~Startup~!~Starting scheduler
                  6/24/2007 8:49:13 AM ~!~Startup~!~Start up complete.
                  6/24/2007 8:49:13 AM ~!~Insteon~!~Requesting external device support registration...
                  6/24/2007 8:49:25 AM ~!~Insteon~!~External device name EZSnsRF1 (Address:08.9E.01) has registered with callback to Insteon_ExtDevSupport.vb using method EZSnsRFRcv as external device #1
                  6/24/2007 8:49:25 AM ~!~Insteon~!~Calling DM.AddRecord for 08.9E.01 1 True
                  6/24/2007 8:49:25 AM ~!~Insteon~!~Registration complete.
                  If you don't see these messages, then the plug-in isn't finding your script at the right location, or it can't read from the file.

                  You should see your EZsnsRF's ID instead of 08.9E.01, provided that you've changed the ID in the .vb. The line to modify is:

                  Code:
                  Const EZSnsRFAddress As String = "08.9E.01"         ' The Insteon address of the EZSnsRF controller
                  You also want to make sure this line is set to True:

                  Code:
                  Const EnableEZSnsRF As Boolean = True
                  Hope that helps,
                  -t

                  Comment


                    #10
                    Hey Jono:

                    It occurs to me that your file might have been saved as Insteon_ExtDevSupport.vb.txt if you used notepad. Windows by default hides extensions for known file types (as it assumes people to be dumb), and would display the file in explorer as Insteon_ExtDevSupport.vb. To check, open the scripts folder in explorer, and go to the tools menu -> folder options. Set your options per the attached image to see full filenames and all files in that folder. Click OK and hopefully that's the issue.
                    Attached Files

                    Comment


                      #11
                      That did it! Thanks very much for the help. This looks like it will be really cool.
                      Jono

                      Comment


                        #12
                        Script update

                        All:

                        Here's a significantly improved version of the script. I've got this confirmed to work at home now with the following equipment:


                        I've posted this one as a zip, so just unzip and copy the single script file into your Homeseer 2 Scripts directory.

                        Install instructions are almost the same: follow the EZsnsRF manual's instructions to pair the sensors (one at a time) against your PLM/PLC. Then, edit the script in Notepad and give it the Insteon address of your EZsnsRF, make sure EnableEZSnsRF is set to True, and (optionally) set EZsnsRFNumSensorsToWatch to the number of Dakota Alert sensors/devices/channels you intend to monitor. Shut down and restart homeseer and you should see the devices appear in the status screen starting at E40 (unless you've changed the starting code in the script). Each device corresponds to the sensors bound to the ezsnsrf (in the order you bound them.)

                        I also cleaned up a couple of lines of code for the other EZ devices simplehomenet makes. I don't have those devices so I can't test if they work now, but there was little chance of them working before.

                        Range here is great -- I've got the outdoor sensors at least 300 feet away from the EZsnsRF! It's also very reliable!
                        Attached Files

                        Comment


                          #13
                          Genaralized version of ExtDevSupport

                          Tom and Jonathan,

                          I've taken the liberty of generalizing the ExtDevSupport script to make it easier to handle new device types. I've tested the revised version with EZSnsRf, EZX10RF, and RemoteLinc. I don't have the EZIO or EZRain, but it should work OK with those devices, too.

                          There were some parts of the code that didn't seem to me to be necessary, so I've commented them out. Please let me know if that was a mistake.

                          By the way, it turns out not to be necessary to link the EZ devices with another Insteon device to make them visible to HomeSeer. All that's needed is to link the Dakota or X10 devices as broadcast devices. To do that, press and hold the link button on the EZ device for 4 seconds. Then make the RF device fire, then wait for the RF device to time out so that it will fire again, then fire it again. That will make the EZ LED stop blinking. Then press and hold the EZ LED for 4 seconds.

                          This technique causes the EZ device to generate a broadcast instead of a group message when the RF device fires. The new version of the script handles those broadcast messages correctly. I think.

                          David
                          Attached Files

                          Comment


                            #14
                            good man, sir.

                            Comment


                              #15
                              Interesting! Thanks for sharing. Your approach is similar to mine, although I ended up not using the classes and collections for the sake of clarity while playing with the code.

                              StatusChangeCB is useful for the EZIO units so that when on/off is set within HomeSeer (either by clicking something on the Status page, or from within an event or script), we can operate the relays:

                              This isn't strictly necessary, as one can write a relay-operate subroutine and call it directly.

                              Code:
                              Public Sub EZIOOperateRelay(parms as object)
                                 Dim iDevice as Integer
                              
                                 Try
                                    If g_bEZIO_Enabled Then
                                       iDevice = parms
                                       If iDevice >= 1 AND iDevice <= 2 Then
                                          hs.plugin("Insteon").ExtDev_TransmitToExternalDevice(g_szEZIO_DevName,&H7,&H45,iDevice - 1)
                                       Else
                                          hs.WriteLog(g_szScriptname,"EZIOOperateRelay: Was expecting 1 or 2 as parameter")
                                       End If
                                    End If
                              
                                 Catch ex As Exception
                                    hs.WriteLog(g_szScriptName,"Error in EZIOOperateRelay: " & ex.ToString)
                                 End Try
                                
                              End Sub
                              My own callback for the EZIO2x4 does nothing more than call this subroutine. I'm using the two output relays to control the garage doors, so I added buttons called "Operate" on the HomeSeer Status page, and set the relays to shut off automatically after two seconds. This yields the same function as pressing the regular garage door momentary contacts, but I can do it from within HS.

                              Comment

                              Working...
                              X