Announcement

Collapse
No announcement yet.

Controlling group's of RGB Device

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

    Controlling group's of RGB Device

    I'm struggling to figure out how to set the color of some z-wave bulbs as a group. Controlling them individually with an event like this works fine.
    Click image for larger version

Name:	Screen Shot 2019-09-15 at 4.28.22 PM.png
Views:	437
Size:	18.0 KB
ID:	1326744



    The way I see it I have two options and I've tried both.
    1. With EasyTrigger DeviceGroup
      1. Create virtual device that represents colors
      2. Event that sees changes in this virtual device and sets it's value to the easy trigger device group
    2. Without EasyTrigger Device Group
      1. Create virtual device that represents colors
      2. Event that sets the value of the virtual device to each bulb rgb node

    Here's my virtual device that has rgb int values. I've also tried using the "color changer" Control Use on the virtual device but that doesn't seem to work.
    Click image for larger version

Name:	Screen Shot 2019-09-15 at 4.50.24 PM.png
Views:	374
Size:	92.4 KB
ID:	1326746

    Here's my event using EasyTrigger device groups. I've confirmed that the Virtual Front Patio Bulbs Color device above is q76.
    Click image for larger version

Name:	Screen Shot 2019-09-15 at 4.53.38 PM.png
Views:	351
Size:	59.0 KB
ID:	1326747

    In the logs I see the two bulbs being set (I think)
    Click image for larger version

Name:	Screen Shot 2019-09-15 at 4.57.29 PM.png
Views:	328
Size:	35.4 KB
ID:	1326748

    But the color doesn't actually change and the rgb devices in HomeSeer don't change.
    When I change the a device invididually I see this in the log
    Click image for larger version

Name:	Screen Shot 2019-09-15 at 5.00.54 PM.png
Views:	327
Size:	18.9 KB
ID:	1326749


    What am I missing?
    Attached Files

    #2
    Originally posted by jimbo715 View Post
    I'm struggling to figure out how to set the color of some z-wave bulbs as a group. Controlling them individually with an event like this works fine....


    What am I missing?

    Zigbee.

    The first thing I notice is for "Blue" you have 255 as the device control, which is an "On" command and not a color command.

    How many child devices do you have for each bulb? Do you have a single color device, or child devices that each represent Red, Green, Blue, White, and Brightness? I might be confused, but I think you will need multiple Easy Trigger groups and each will have to contain like-kind devices. In other words, you'd need an Easy Trigger group for each child device (color and/or brightness) that you want to control.

    --Barry

    Comment


      #3
      Originally posted by logman View Post


      Zigbee.

      The first thing I notice is for "Blue" you have 255 as the device control, which is an "On" command and not a color command.

      How many child devices do you have for each bulb? Do you have a single color device, or child devices that each represent Red, Green, Blue, White, and Brightness? I might be confused, but I think you will need multiple Easy Trigger groups and each will have to contain like-kind devices. In other words, you'd need an Easy Trigger group for each child device (color and/or brightness) that you want to control.

      --Barry
      I was trying to avoid Zigbee because it can interfere with Wifi connectivity because they function at the same frequency right?


      Click image for larger version

Name:	Screen Shot 2019-09-15 at 9.14.19 PM.png
Views:	348
Size:	103.5 KB
ID:	1326765

      There is a mix of devices. I don't have them set here, but the way to use the "Custom RGB" is to make sure the Red, Green, Blue Channels are set to 255 and the Cold_White and Warm_White are "Off".

      The 255 is misleading. It's actually the RGB int value which is the value type the device uses. 06AA19 in Hex up there is 436761 in RGB as an integer.


      Click image for larger version

Name:	Screen Shot 2019-09-15 at 9.17.17 PM.png
Views:	333
Size:	28.7 KB
ID:	1326766

      Comment


        #4
        Originally posted by jimbo715 View Post

        I was trying to avoid Zigbee because it can interfere with Wifi connectivity because they function at the same frequency right?
        Normally it is Zigbee that takes the hit with interference, not Wifi taking the hit. But for the most part I think the danger of interference from either to the other is overstated.

        I have a very large Unifi mesh Wifi deployment here on our farm, with over 20 APs both indoors and outdoors. Some of the outdoor APs use external booster antennas that broadcast either in a full radius and or in a directional wedge. But all are broadcasting at the maximum level allowed by the FCC. There are usually over 70 "Users" (devices) connected to the Wifi at any given time.

        I also have several Zigbee networks (several Hues, 1 SmartThings, 1 Hubitat and 2 Conbees) that operate mostly on Zigbee channels 15, 20 and 25. In total there are over 300 lights and over 100 sensors on the various Zigbee networks. So if ever there was going to be an issue with Wifi/Zigbee interference, I should be the one that experiences it. Yet never have I detected or suspected any sort of interference causing issues with either my Zigbee or Wifi networks. Both seem to coexist with the other just fine.

        I think the main thing to keep in mind is to not locate a Zigbee controller within a few feet of a Wifi router or access point. Other than that they seem to play well together.

        --Barry

        Comment


          #5
          Originally posted by logman View Post
          The first thing I notice is for "Blue" you have 255 as the device control, which is an "On" command and not a color command.
          Uh, I think 255 as an ON command is only if you have defined it as such. Since Control Use is "Not Specified", for the 255 value, should not be an issue here.

          Comment


            #6
            Originally posted by aa6vh View Post

            Uh, I think 255 as an ON command is only if you have defined it as such. Since Control Use is "Not Specified", for the 255 value, should not be an issue here.
            I could be wrong, which happens quite often, but I think HS defaults 0 to OFF and 100 along with 255 to ON when not specified. In this case apparently the RGB colors all have to be set to 255 ("ON") in order to use the Custom Color device.


            --Barry

            Comment


              #7
              Originally posted by logman View Post
              I could be wrong, which happens quite often, but I think HS defaults 0 to OFF and 100 along with 255 to ON when not specified. In this case apparently the RGB colors all have to be set to 255 ("ON") in order to use the Custom Color device.
              Some plugins will insist on using specific values for off and on, for the devices that they control. For example, the ZWave plugin will use 0 and 255 for off and on for ordinary ZWave light bulbs. Since we are discussing a Virtual Switch, this does not apply.

              When Homeseer creates a new Virtual Switch, HS will create that switch with two values, 0 (Off) and 100 (On). However, these values can be modified, or even deleted. The "Control Use" field is used to specify which one of the various Virtual Switch values are the Off or On state for that switch. The OP's Virtual switch has all of its Control Use fields set to "Not Specified", so that switch does not have an Off or On value (which is perfectly acceptable).

              Comment


                #8
                Originally posted by jimbo715 View Post
                What am I missing?
                I did not even know those Aeotec color bulbs existed. Clever the way you are using the Virtual Switch as input to the bulb's color settings. I may have to get one to play with (right now I am using Hue bulbs for my color bulbs).

                A thought: The value in a Virtual Switch internally is a Double (floating point number). Could the conversion from Double to Long Integer be causing some issues? I also have used a Virtual Switch to hold my color values, but I just created a simple integer value to represent the color (i.e. 0 Off, 1 Blue, 2 Cyan, 3 Yellow...), and then make the conversion to RGB in script.

                Comment


                  #9
                  Originally posted by aa6vh View Post

                  I did not even know those Aeotec color bulbs existed. Clever the way you are using the Virtual Switch as input to the bulb's color settings. I may have to get one to play with (right now I am using Hue bulbs for my color bulbs).

                  A thought: The value in a Virtual Switch internally is a Double (floating point number). Could the conversion from Double to Long Integer be causing some issues? I also have used a Virtual Switch to hold my color values, but I just created a simple integer value to represent the color (i.e. 0 Off, 1 Blue, 2 Cyan, 3 Yellow...), and then make the conversion to RGB in script.

                  Oh that's an interesting thought. The only logs I'm aware of to check for a possible error are from the Log page. Is there a more detailed log file? I couldn't find any log settings.

                  Could you share more details about how you use a script? I'd be ok with going the scripting route.

                  Comment


                    #10
                    On another note, I am able to control the individual Red, Blue, And Green Channels via a virtual device.

                    Red Channel Virtual Device

                    Click image for larger version

Name:	red_virtual_device.png
Views:	333
Size:	30.8 KB
ID:	1326966

                    Red Channel Easy Trigger
                    Click image for larger version

Name:	red_easy_trigger.png
Views:	326
Size:	29.6 KB
ID:	1326969

                    Red Channel Virtual Event
                    Click image for larger version

Name:	red_event.png
Views:	342
Size:	43.0 KB
ID:	1326967

                    Red Channel Logs
                    Click image for larger version

Name:	red_logs.png
Views:	352
Size:	150.2 KB
ID:	1326968

                    The only difference I see here is that a Z-Wave Type Log is generated here, but not for the custom rgb colors.

                    Comment


                      #11
                      Originally posted by jimbo715 View Post
                      Could you share more details about how you use a script? I'd be ok with going the scripting route.
                      Unfortunately, what I have to do to control Hue bulbs is quite a bit different than what you need. Essentially I build a JSON control string, then pass that control string to Hue using an HTTP Put (I do not use the Hue plugin).

                      I cannot be too much help on your AEOTEC bulbs until I get one to play with. But I would think that code would be something like:

                      Look up the appropriate RGB color parameters from a table lookup based on your color value (remember I use a single digit number to represent a color, such a 0 = Off, 1 = Blue, 2 = Green, 3 = Red, etc). Something like:

                      Code:
                      Dim iRed() As Integer = {0, 0, 0, 255}
                      Dim iGrn() As Integer = {0, 0, 255, 0}
                      Dim iBlu() As Integer = {0, 255, 0, 0}
                      Dim iRedValue As Integer = iRed(iColorValue)
                      Dim iGrnValue As Integer = iGrn(iColorValue)
                      Dim iBluValue As Integer = iBlu(iColorValue)
                      Then I would directly control the child devices of that bulb, i.e the Red control, Green Control and Blue Control.

                      Code:
                      Dim iRef As Integer = hs.GetDeviceRefByName("Patio Left Light Bulb 2 Dimmer Color Control Red Channel")
                      hs.SetDeviceValueByRef(iRef, iRedValue, True)
                      I won't know if that would work until I can try it though.

                      Comment


                        #12
                        No worries! Thanks for the snippets. I'm a developer by trade but haven't gotten into scripting in HomeSeer. I'll see what I can do.

                        Comment


                          #13
                          Originally posted by aa6vh View Post

                          Look up the appropriate RGB color parameters from a table lookup based on your color value (remember I use a single digit number to represent a color, such a 0 = Off, 1 = Blue, 2 = Green, 3 = Red, etc). Something like:

                          Code:
                          Dim iRed() As Integer = {0, 0, 0, 255}
                          Dim iGrn() As Integer = {0, 0, 255, 0}
                          Dim iBlu() As Integer = {0, 255, 0, 0}
                          Dim iRedValue As Integer = iRed(iColorValue)
                          Dim iGrnValue As Integer = iGrn(iColorValue)
                          Dim iBluValue As Integer = iBlu(iColorValue)
                          Then I would directly control the child devices of that bulb, i.e the Red control, Green Control and Blue Control.

                          Code:
                          Dim iRef As Integer = hs.GetDeviceRefByName("Patio Left Light Bulb 2 Dimmer Color Control Red Channel")
                          hs.SetDeviceValueByRef(iRef, iRedValue, True)

                          I was able to get something working here. I went with your idea of controlling the red, green, and blue controls individually. I still used my virtual device with values set to the RGB int values as in the screenshot in my original post.


                          Code:
                          public object Main(object[] args) {
                           string[] rawData = args.Where(x => x != null)
                            .Select(x => x.ToString())
                            .ToArray();
                           if (rawData.Length != 1) {
                            hs.WriteLog("Error", "No parameters passed");
                            return -1;
                           }
                           string[] data = rawData[0].Split(',');
                           if (data.Length != 4) {
                            hs.WriteLog("Error", "Must pass 4 parameters: device to grab value from, red channel device to set, green channel device to set, blue channel device to set");
                            return -1;
                           }
                           try {
                            int deviceValueToGrab = System.Convert.ToInt32(data[0]);
                            int redDevice = System.Convert.ToInt32(data[1]);
                            int greenDevice = System.Convert.ToInt32(data[2]);
                            int blueDevice = System.Convert.ToInt32(data[3]);
                          
                            int valueToSet = hs.DeviceValue(deviceValueToGrab);
                            int r, g, b;
                            string hex = String.Format("{0:X}", valueToSet);
                            hs.WriteLog("hexrgbcolor", hex);
                            int num = (int) long.Parse(hex, System.Globalization.NumberStyles.HexNumber);
                            r = (num & 0xFF0000) >> 16;
                            g = (num & 0xFF00) >> 8;
                            b = num & 0xFF;
                            hs.WriteLog("hexrgbcolor", string.Format("{0}, {1}, {2}", r, g, b));
                          
                            hs.SetDeviceValueByRef(redDevice, r, true);
                            hs.SetDeviceValueByRef(greenDevice, g, true);
                            hs.SetDeviceValueByRef(blueDevice, b, true);
                           } catch (FormatException e) {
                            return -1;
                           } catch (OverflowException e) {
                            return -1;
                           }
                          
                           return 0;
                          }
                          This expects 4 device Reference IDs as parameters: The device to grab the value from, the red channel device, the green channel device, and the blue channel device

                          It takes the value stored as an int, converts that to hex, and converts that to individual r,g,b values and sets corresponding color device. I have it setting virtual red, green, and blue channel devices that in turn will set multiple physical devices.


                          Click image for larger version

Name:	devices.png
Views:	349
Size:	60.0 KB
ID:	1327552

                          Click image for larger version

Name:	event.png
Views:	297
Size:	50.8 KB
ID:	1327553

                          Comment


                            #14
                            For anyone looking...reached out the HomeSeer. They are aware of the issue of with the "color changer" type device. This issue is fixed in HS4 and they plan to fix it in HS3.

                            Comment


                              #15
                              I've confirmed that the Virtual Front Patio Bulbs Color device above is q76.
                              How did you determine the device number? I am trying to figure out how to turn a group of lights to a certain colour and dim them. Suggestions have been to use EasyTrigger, which I have but I don't understand how to use the device value expressions.

                              Comment

                              Working...
                              X