Announcement

Collapse
No announcement yet.

Controlling WD-200+ status mode LEDs from a script

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

  • Controlling WD-200+ status mode LEDs from a script

    I've had no problem controlling WD-200+ status mode LEDs from events, but now I'd like to do it from a script, and my Googling skills are letting me down. Can anyone give me a quick example of this? Sorry if this should be obvious to anyone experienced with HomeSeer scripts, but I am not. lol Any help is appreciated.

  • #2
    In the event, are they set based on a z-wave parameter change, or a device change?
    HS 3.0.0.548: 1976 Devices 1156 Events
    Z-Wave 3.0.1.262: 123 Nodes on one Z-Net

    Comment


    • #3
      Originally posted by sparkman View Post
      In the event, are they set based on a z-wave parameter change, or a device change?
      I'm not sure I fully understand your question, but I already have the event triggering and execution of the script worked out. The script has the devRef, the LED number, and the color. I just need to know what code will send the message to the device.

      Comment


      • #4
        Originally posted by Doug Meredith View Post

        I'm not sure I fully understand your question, but I already have the event triggering and execution of the script worked out. The script has the devRef, the LED number, and the color. I just need to know what code will send the message to the device.
        I don't have a WS200, so trying to understand the mechanism for setting the LEDs. Can you post a screen shot of an event that sets them?
        HS 3.0.0.548: 1976 Devices 1156 Events
        Z-Wave 3.0.1.262: 123 Nodes on one Z-Net

        Comment


        • #5
          Originally posted by sparkman View Post

          I don't have a WS200, so trying to understand the mechanism for setting the LEDs. Can you post a screen shot of an event that sets them?
          Ah, got it! This is how it's done in an event:

          Click image for larger version

Name:	Capture.PNG
Views:	27
Size:	13.8 KB
ID:	1272417

          Comment


          • #6
            Thanks. Looking at the manual, it looks like it is based on z-wave parameter changes (https://homeseer.com/wp-content/uplo...0-Manual-4.pdf), so you can use the following method to set them in a script using the parameters and values in the manual. The script below requires the parameters to be passed to the script, but you could hard code as needed.

            Code:
            Imports System.Text
            
            'call Main with NodeID|ParameterNum|Value
            'Based on http://board.homeseer.com/showpost.php?p=1176987&postcount=11
            
            Sub Main(parms As String)
                Dim logName As String = "Z-Wave Param"                'set log name for HS log
                Dim debug As Boolean = True
            
                Dim param as String() = parms.Split("|")
                Dim HomeID as String = "your home ID here"
                Dim NodeID as String = param(0)
                Dim ParamNumber as String = param(1)
                Dim Value as String = param(2)
                Dim ConfigResult As Integer = 0
                Dim ConfigResultVal() As String = {" is Unknown"," is Successful"," has been Queued"," has Failed"}
            
                Try
                    ConfigResult = hs.PluginFunction("Z-Wave", "", "Configuration_Set", New Object(){HomeID, Convert.ToByte(NodeID), Convert.ToByte(ParamNumber), Convert.ToByte(1), Convert.ToInt32(Value)})
                    If Debug Then hs.WriteLog(logName, "Result of Parameter " & ParamNumber & " change to " & Value & " on Node " & NodeID & ConfigResultVal(ConfigResult))
                Catch ex As Exception
                    hs.writelog(logName, "Error:  " & ex.Message.ToString)
                End Try
            
            End Sub
            HS 3.0.0.548: 1976 Devices 1156 Events
            Z-Wave 3.0.1.262: 123 Nodes on one Z-Net

            Comment


            • #7
              Thank you very much, sparkman. This is exactly the information that I was looking for!

              Comment


              • #8
                I've done a quick test, and this works great. Thanks again.

                Note to other newbies: NodeID is a Z-Wave node number, not a HomeSeer device reference.

                Comment


                • #9
                  You're welcome. Glad to help.
                  HS 3.0.0.548: 1976 Devices 1156 Events
                  Z-Wave 3.0.1.262: 123 Nodes on one Z-Net

                  Comment


                  • #10
                    Doug check out my Flash plugin. I have support for the switch done and dimmer 99% done (need a value from someone who can install it with the 200 dimmers).

                    The plugin lets you create led flash sequences which are then merged into what the device displays. This way your (say) garage dooor open to long event only needs to set and clear its sequence (say flash an indicator red every second) without stepping on your gate open too long events which flashes yellow every 5 seconds.

                    If your open to trying use this version. It has the 200+ dimmer support 99% done. If you try to configure an action with one your hslog will report the integer model number. It’s this number I need to finish support. The on/off switch model is already supported in this version, just the dimmer needs to be added.

                    Latest version : http://download.casapiedrasoftware.i...r_override.txt

                    Comment


                    • #11
                      I'm trying to do this in C# and I'm having some troubles... when I call the Configuration_Set plugin function, the change is made in the device, but then I get an exception printed to the console and the plugin stops processing. Even reloading it doesn't do anything, InitIO doesn't seem to be called at all.

                      Code:
                      Setting config option 13 for [redacted] to 1
                      Exception deserializing message: Unable to find assembly 'HSPI_ZWave, Version=3.0.2.240, Culture=neutral, PublicKeyToken=null'.
                      Code:
                              public override string InitIO(string port) {
                                  Program.WriteLog(LogType.Verbose, "InitIO");
                      
                                  SetZwaveConfigOption(679, 13, 1);
                                  SetZwaveConfigOption(679, 21, 0);
                      
                                  return "";
                              }
                      
                              private void SetZwaveConfigOption(int devRef, byte parameterNumber, int parameterValue) {
                                  SetZwaveConfigOption(GetDeviceAddress(devRef), parameterNumber, parameterValue);
                              }
                      
                              private void SetZwaveConfigOption(ZwaveAddress address, byte parameterNumber, int parameterValue) {
                                  SetZwaveConfigOption(address.HomeId, address.NodeId, parameterNumber, parameterValue);
                              }
                      
                              private void SetZwaveConfigOption(string homeId, byte nodeId, byte parameterNumber, int parameterValue) {
                                  Program.WriteLog(LogType.Debug,
                                      "Setting config option " + parameterNumber + " for " + homeId + "-" + nodeId + " to " + parameterValue);
                                  try {
                                      hs.PluginFunction("Z-Wave", "", "Configuration_Set", new object[] {
                                          homeId,
                                          nodeId,
                                          parameterNumber,
                                          (byte) 1,
                                          parameterValue
                                      });
                                  }
                                  catch (Exception ex) {
                                      // don't care
                                  }
                              }
                      
                              private ZwaveAddress GetDeviceAddress(int devRef) {
                                  DeviceClass device = (DeviceClass) hs.GetDeviceByRef(devRef);
                                  string[] addressParts = device.get_Address(hs).Split('-');
                                  return new ZwaveAddress {
                                      HomeId = addressParts[0],
                                      NodeId = byte.Parse(addressParts[1])
                                  };
                              }
                          }

                      Comment


                      • #12
                        Ran into the same thing. Just means you don’t have the binaries local to your dev box to deserialize the results. It will go away if you copy all the zwave files locally or run on your HS system instead of remotely. Same thing bit me.

                        Comment


                        • #13
                          Oh also you should be catching exceptions when calling HS.* and Callback.* methods. Never let an exception escape your code back to HS.

                          Comment


                          • #14
                            Thank you so much, you're the best.

                            The exception in question seemed to be getting caught by HS3... surrounding the hs.PluginFunction call in a try/catch didn't do anything.

                            Comment

                            Working...
                            X