Announcement

Collapse
No announcement yet.

Passing Z-Wave Parameters - WD200 LEDs

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

  • Passing Z-Wave Parameters - WD200 LEDs

    Bit of a niche request so I understand if it is not worth the effort.

    My use case is as follows;
    Currently to control the LEDs on a WD200 I have to use events
    There are 7 LEDs
    There are 8 colours
    There are two modes
    7 x 8 x 2 (minus 8 special cases)
    Thats 104 events PER SWITCH for full control of the LEDs

    Is it possible to bypass the event system to send z-wave parameters directly to switches through plugins?
    Handling colors and blinks programically is much easier than building these events.

    Thanks for looking!

    How I am currently having to handle LEDs
    Click image for larger version

Name:	Capture.PNG
Views:	12
Size:	20.8 KB
ID:	1262426

    Z-Wave Parameters for WD200 Switches (from https://homeseer.com/wp-content/uplo...0-Manual-4.pdf)
    Click image for larger version

Name:	Capture.PNG
Views:	8
Size:	131.0 KB
ID:	1262427


  • #2
    I do not have the WD200 to look myself, but what you are getting into is the CAPI control because that is the mechanism provided by HS to control devices managed by plugins. One needs to understand what the Z wave plugin exposes for CAPI for this device. Since this is done on a interface/device by interface/device basis there is no specific standards that I know has been published. I have shown an image of the CAPI object. It is generic, as intended. mcsMQTT looks at the ControlValue, Label, Range and ControlType searching for something that matches what is in the MQTT Payload. The debug output itemizes the emumeration as it searches. By looking at the debug output is how I found what is exposed for some the devices I have worked.

    The question that needs to be answered is the definition of the CAPI object for the WD200. These parameters should exists in the CAPI interface since Zwave is a plugin just as any other. Once the interface is known then we can look into how it can be mapped into MQTT such as might occur with a JSON payload.

    Comment


    • #3
      Thanks for the pointers.
      I tracked down an app tenScriptAid 1.27
      It seems to show CAPIControls over the network. Quite handy

      Unfortunately the device that is used to control the LEDs (Parent node, Ref 120 in my case) has no CAPIControls listed.
      The child Ref 122 Dimmer shows the standard dimming CAPI stuff only.
      If this app isn't showing things you would expect I'll dig deeper.

      Otherwise I will bug the HS guys to see if there is an easier way to create events.

      Thanks for taking the time.

      Click image for larger version

Name:	Capture.PNG
Views:	13
Size:	76.5 KB
ID:	1262473

      Comment


      • #4
        It is not CAPI Control, it is a plug-in function. Al (sparkman) wrote about it here. Al referenced a post by Greig (enigmatheatre) It will apparently only writes parameters, not read them - but that is what you want.
        Randy Prade
        Aurora, CO
        Prades.net

        PHLocation - Pushover - EasyTrigger - UltraECM3 - Ultra1Wire3 - Arduino

        Comment


        • #5
          Thanks!

          I actually came across that script and I'm currently working on some code.
          VERY long time since I wrote VB.

          Trying to learn the homeseer scripting stuff... docs arn't the best

          Comment


          • #6
            Now that you are well on your way I suspect some type of scripting will be the mechanism to avoid all the events. Once you understand what is needed by the Zwave plugin you can propose something based upon MQTT topic & payload if that would seem to be the best approach.

            Comment


            • #7
              Alright... posting to help others who come across this. Its a decent setup I think
              It is linux compatible. No testing done on windows.

              Not working yet:
              Blink lights support

              I use a MQTT device to store a data variable. I did mine like this:
              Click image for larger version  Name:	Capture1.PNG Views:	1 Size:	17.7 KB ID:	1262551

              Then I use an event to trigger a script
              Click image for larger version  Name:	Capture2.PNG Views:	1 Size:	35.7 KB ID:	1262552

              The script below has two hard coded variables.
              One is the Ref ID of the MQTT device that holds the data string that is generated externally (In my case Node-Red)
              The other is the HomeID of your Z-wave network. (This could probably be fetched programically but the Z-wave plugin is undocumented and I can't be bothered)

              PHP Code:
              ' Homeseer WD200 LED Updater
              Written by LoafDude 2018-11-27
              ' Contact via homeseer forums
              code stolen from all over the placeCredit where it is due.

              Imports System.Collections.Generic

              Public Sub Main(params as object)
                
              hs.WriteLog("Info""LED Script Started")

                
              'Change this Ref below to device that is sent updates via MQTT
                Dim StrData As String = hs.DeviceString(143)

                '
              Change this value below to match your HomeID
                Dim ZwaveHomeID 
              As String "E7E22DD2"
                
              Dim ConfigResult As Integer 0
                Dim ConfigResultVal
              (3) As String

                ConfigResultVal
              (0) = "Unknown"
                
              ConfigResultVal(1) = "Success"
                
              ConfigResultVal(2) = "Queued"
                
              ConfigResultVal(3) = "Failed"
                
              Dim Data() As String StrData.Split("|")
                
              Dim ZwaveCommand as String
                Dim colour_lookup 
              As New Dictionary(Of StringInteger)
                
              colour_lookup.Add("red"1)
                
              colour_lookup.Add("green"2)
                
              colour_lookup.Add("blue"3)
                
              colour_lookup.Add("magenta"4)
                
              colour_lookup.Add("yellow"5)
                
              colour_lookup.Add("cyan"6)
                
              colour_lookup.Add("white"7)
                
              colour_lookup.Add("off"0)
                
              Dim led_lookup As New Dictionary(Of StringInteger)
                
              led_lookup.Add("1"21)
                
              led_lookup.Add("2"22)
                
              led_lookup.Add("3"23)
                
              led_lookup.Add("4"24)
                
              led_lookup.Add("5"25)
                
              led_lookup.Add("6"26)
                
              led_lookup.Add("7"27)

                For 
              Each ZwaveCommand in Data
                  Dim Command
              () as String ZwaveCommand.Split("-")
                  
              Dim room As String Command(0)
                  
              Dim led As String Command(1)
                  
              Dim colour As String Command(2)
                  
              Dim pk() As String
                  Dim x 
              As Integer
                  Dim s 
              As Object
                  Dim plugin_data 
              As clsPlugExtraData Nothing
                  Dim device 
              As Scheduler.Classes.DeviceClass
                  Dim enumerator 
              As Scheduler.Classes.clsDeviceEnumeration
                  enumerator 
              hs.GetDeviceEnumerator

                  
              Do While Not enumerator.finished
                    device 
              enumerator.getnext
                    
              If String.Compare(device.Device_Type_String(hs), "Z-Wave Switch Multilevel Root Device") = 0 Then
                      
              If String.Compare(room"all") = 0 OrElse String.Compare(roomdevice.Location(hs)) = 0 Then
                        plugin_data 
              device.PlugExtraData_Get(hs)
                        
              pk plugin_data.GetNamedKeys()
                        If (
              pk IsNot NothingThen
                          
              For 0 To pk.Length() - 1
                            s 
              plugin_data.GetNamed(pk(x))
                            If (
              pk(x) = "node_id"Then
                              Dim arrStrings 
              = New Object() {ZwaveHomeIDConvert.ToByte(Convert.ToInt32(s)), Convert.ToByte(Convert.ToInt32(led_lookup.Item(led))), Convert.ToByte(1), Convert.ToInt32(colour_lookup.Item(colour))}
                              
              ConfigResult hs.PluginFunction("Z-Wave""""Configuration_Set"arrStrings)
                              
              hs.WriteLog("Info""Set " device.Location(hs) & " Node: " s.ToString() & " LED: " led " (Param:" led_lookup.Item(led) & ") to Colour: " colour " (Value:" colour_lookup.Item(colour) & ")")
                            
              End If
                          
              Next
                        End 
              If
                      
              End If
                    
              End If
                  
              Loop

                  
              'hs.WriteLog("Info", ZwaveCommand)

                Next

              End Sub 
              The format of the mqtt payload follows
              PHP Code:
              room-led_position-colour|room2-led_position2-colour 

              So for example I send this to configure the bottom 4 LED lights for all switches in my Kitchen (3 switches in my case)
              Click image for larger version  Name:	Capture3.PNG Views:	1 Size:	5.1 KB ID:	1262553

              I threw this together fairly quickly and haven't written VB in quite a while so it's not very pretty.

              The script is quite quick.
              It sets my 3 switches and all 7 LEDs in 2 seconds
              It is dependent on how many zwave devices you have though. I have 25 in my setup (plus many child devices so around 75 total)
              The script enumerates and iterates over all zwave devices to find the matching devices to update.

              It also supports the room "all" which will change every switch on the network

              Hope someone else gets use outa this

              Comment


              • #8
                Looks like a good solution for your case and an excellent example where a small script can be very effective. There is much that is user-specific such as has room is used and the convention adopted for the MQTT payload that would make it awkward to generalize for something in mcsMQTT, but really good for a simple local solution. Where did you get the info about what is stored in PlugExtraData for the device?

                Comment


                • #9
                  PlugExtraData info was found here
                  https://forums.homeseer.com/forum/de...258#post944258


                  Comment

                  Working...
                  X