Announcement

Collapse
No announcement yet.

Simple way for global device changes?

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

    Simple way for global device changes?

    Is there a simple way to set up an event covering a range of devices?

    For example, I'd like to get an email message if any z-wave "notification" device gets a value of "3" (Tampering Cover Removed.) For the sake of argument, assume I have a large number (50+) of door/window sensors.

    I can create 50 distinct events, one per device, that does this. Or, I can create a single (massive) event that checks all 50 devices, combining the conditions with "OR." Both of these solutions would be clumsy and difficult to maintain.

    Ideally, I'd love to set a single event with the condition of:

    If any device has a device string of "Z-Wave Home Security" (which is the string the z-wave plugin assigns to the notification command class) and has it's value set to 3 (or "Tampering Cover Removed"), send me an email. It'd be an extra bonus if the email could tell me which specific device tripped the event.

    Can this be done (without a plugin)?

    If not, is there an existing plugin that can accomplish this (without creating a ton of events)?

    Thanks
    Gary

    #2
    There is one method available (there may be more) and that is to run a script that is registered for a device value change callback. Whenever ANY device in HS changes value the script gets called, inside this script you could determine whether it is a Z-Wave device, whether it's value is '3' and then if it is then send an email. There should be an example out there - this is the command - http://www.homeseer.com/support/home...uschangecb.htm

    Comment


      #3
      Originally posted by mrhappy View Post
      There is one method available (there may be more) and that is to run a script that is registered for a device value change callback
      That looks interesting. However, I don't think I'd do it that way... My currently (barely any) knowledge of HS tells suggests that I could only initiate a script in response to an event (as the action portion of the event.) Once I did that, it feels... dirty... to have that resulting in callbacks hooked all over the place for any value changing anywhere (which would have to hard-code the needed device string to filter on, values, etc.)

      It's just.. dirty. It's also a lot of interpreted code being handled by a runtime parser I've already encountered problems with.

      If that's the only way, then I think I'd rather just write a plugin. At least then I can make it configurable by non-script people. Imagine this:

      a Plugin called "something." "Something" allows multiple instances. Each instance of "something" also creates a single device (binary, on/off) that I can call "ADevice." The configuration page for each something has a droplist for "device string" and an edit control for a target value. The droplist would be populated by enumerating all installed devices to uniquely list their device strings. So, in my example, I'd use the droplist to select "Z-Wave Home Security", and put "3" in the edit control.

      From that point, any time any device in the system with a matching device string was set to the configured value, my plugin would modify it's "ADevice" so some field (not sure what field) reflected the redID of matching device AND then toggle the value of ADevice from "off" to "on"

      Now, a user provided event could catch ADevice being set to On, and react as needed... such as sending an email saying "A Home Security Device is being Tampered with." If a user script was used in response to the event, the refID I shoved into ADevice could be extracted and used to provide more information. (Or I might be able to figure out a way to do that for a specific device with replaceable params... no idea...)

      (ugh... I don't even have a license to the s/w yet... why am I designing plugins?)

      Comment


        #4
        Once you register the script it just sits there, most people doing this do it in the startup.vb file so you don't really have an event that starts it off.

        Plugins use exactly the same method albeit on return/callback rather than calling a script they just run the HSEvent function in your plugin, it's even the same method to initiate it IIRC albeit it has been a while since I used this in a plugin.

        I don't know if you have looked at the SDK yet and I know you are a developer (which I ain't) but multi instance plugins with configuration pages and the like are not things that I found particularly trivial to write I must say.

        Comment


          #5
          Originally posted by mrhappy View Post
          multi instance plugins with configuration pages and the like are not things that I found particularly trivial to write I must say.
          If I don't jump in, I won't learn how to do it.

          Comment


            #6
            Okay... so what I've done is write a plugin that "mirrors" other devices. It's kind of primitive right now, but it does solve the problem I was having.

            With the plugin, you create a new HS device that "mirrors" an existing HS device. The new mirrored device takes on the status/control characteristics of the existing device (copies everything from the "status graphics" page), and remembers the device type string of the existing HS device.

            Then, any time a device in HS changes, if that changing device has a device type string that matches the mirror device, the mirror device will set a few global variables (copying the changing device's name, location, etc), and set it's OWN status/value to match the changing device.

            In addition, it keeps a reference to the device that just changed... AND if any control actions are made to the mirrored device, those control actions are forwarded to the last changing device.

            How is this useful? I'll give an example:

            I mirrored one of the "Z-Wave Home Security" child nodes from a door/window sensor. The new mirrored device is called "Device Mirror for Z-Wave Home Security" and has a reference ID of 198. Now, I can create an event that triggers on "Device Mirror for Z-Wave Home Security" changing and becoming "Tampering Cover Removed". The action sends an email, and the email body contains: "$$GLOBALVAREVICE_MIRROR_198_NAME: is reporting that the Tamper Cover has been Removed!!"

            The result is that I get an email any time any "home security" device (which nearly all door/window sensors have) sends a tamper alert.. and the email tells me which specific door/window sensor is being tampered with. All with just a single event.

            ----

            Another example: Several older monoprice door/window and tilt sensors set a "intrusion unknown location" value each and every time the door is opened or closed (this is in addition to the normal open/close device.) This is reported to the same "Home Security" device that a real tamper alert would be sent to, and it doesn't automatically reset the value to "no event" when the sensor is closed. (In fact, it triggers a new "intrusion unknown location" on both opening AND closing.)

            The fix:

            Using the same device mirror mentioned above, I created an event "If Device Mirror for Z-Wave Home Security changes and becomes Intrusion Unknown Location", then "Set Device Device Mirror for Z-Wave Home Security to Reset Notifications." Again, one event handles ALL "Z-wave Home Security" devices. The "Reset Notifications" control is forwarded to whichever device caused event.

            ----

            Another use: Send notifications (email?) when any "z-wave battery" device becomes lower than a set value and include the actual device name that has the low battery. (With a single event and no need to muck with events if you add/remove/change devices.)

            Basically, any event where you want to react to things for an entire class of devices without having to create separate events for each specific device in the class.

            I still need to clean up the code a bit, add some more error handling (and logging) and figure out how the HS packaging thing works. Once I do that, I'll make it available for others...

            Comment


              #7
              Here's what I do with mine using an Event with Pushalot - I am sure a programmer could clean this up with a script but that is definitely not me. It's ugly, but it works.



              IF Battery Bathroom Glass: Bathroom changes and becomes Battery Low Warning

              OR IF Battery Bedroom Glass: Bedroom changes and becomes Battery Low Warning

              OR IF Battery Living Room W Glass: Living Room NW changes and becomes Battery Low Warning

              OR IF Battery Living Room W Glass: Living Room W changes and becomes Battery Low Warning

              OR IF Battery Pantry Glass: Pantry changes and becomes Battery Low Warning

              OR IF Battery Kitchen Glass: Kitchen E changes and becomes Battery Low Warning

              OR IF Battery Kitchen Glass: Kitchen S changes and becomes Battery Low Warning

              OR IF Battery Laundry Room Glass: Laundry Room changes and becomes Battery Low Warning

              OR IF Battery Library Glass: Library changes and becomes Battery Low Warning

              OR IF Battery Living Room E Glass: Living Room E changes and becomes Battery Low Warning

              OR IF Battery Living Room E Glass: Living Room NE changes and becomes Battery Low Warning


              Then Send Pushalot notification
              Title: Low Battery Detected (Glass)!
              Body: $$DSR:663: Bathroom Glass \n $$DSR:597: Bedroom Glass \n $$DSR:1177: Kitchen E Glass \n $$DSR:610: Kitchen S Glass \n $$DSR:724: Laundry Room Glass \n $$DSR:593: Library Glass \n $$DSR:302: Living Room E Glass \n $$DSR:1569: Living Room NE Glass \n $$DSR:55: Living Room NW Glass \n $$DSR:1329: Living Room W Glass \n $$DSR:1593: Pantry Glass \n
              Important: Yes, Silent: No
              Source: Homeseer
              Image: http://homeseer.com/updates3/icons/Plug-In.gif
              TimeToLive: 1 day

              Comment


                #8
                Originally posted by bebaldin View Post
                Here's what I do with mine using an Event with Pushalot ...
                That's quite a bit. I have a plugin that let's me send notifications to my phone via android's "autoremote" tool. I suppose it is similar to the various push tools. Here's the entire event (using the device mirror plugin) that notifies me if _ANY_ z-wave device on my network using the standard z-wave battery command class goes below 51%...

                If I add or remove devices, I don't have to edit, add, remove, fix, or change anything to make everything work.
                Attached Files

                Comment


                  #9
                  Your Plug-in

                  Hi! I have been looking for something similar to what you have created, but haven't found anything. I'd like to create a virtual device that represents a group of other devices, so similar to what you have done, but don't all have to be of the same type. In other words, have a separate interface (or .INI file initially) define member devices of the virtual group device. Then, use that virtual device in events on value changes, etc.

                  As an example, I'd like to create a group of perimeter security devices (ie. external doors and windows) and have an event run on any change.

                  Ideally, even nested groups would be possible (i.e. that virtual device could be a member of an another group).

                  I've started to write something, but haven't gotten very far yet due to lack of time. If you're willing to share the code for your plug-in, we can possible collaborate.

                  Thoughts?

                  Comment

                  Working...
                  X