Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Controllers
  3. PiDome
  4. Send color data to sensors

Send color data to sensors

Scheduled Pinned Locked Moved PiDome
controllercolor
22 Posts 8 Posters 13.1k Views 6 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • BulldogLowellB BulldogLowell

    @John

    an int array, you mean?

    can you fit your RGB 3bytes into arduino's 16bit int?

    JohnJ Offline
    JohnJ Offline
    John
    Plugin Developer
    wrote on last edited by
    #7

    @BulldogLowell
    Was thinking 32bit, sorry....

    My Domotica project: http://www.pidome.org

    1 Reply Last reply
    0
    • BulldogLowellB Offline
      BulldogLowellB Offline
      BulldogLowell
      Contest Winner
      wrote on last edited by
      #8

      yup, you gotta think small!

      JohnJ 1 Reply Last reply
      0
      • BulldogLowellB BulldogLowell

        yup, you gotta think small!

        JohnJ Offline
        JohnJ Offline
        John
        Plugin Developer
        wrote on last edited by John
        #9

        @BulldogLowell
        Yup, i'm spoiled.....

        I will take this option in consideration. It does depends on what users would prefer the most.

        My Domotica project: http://www.pidome.org

        1 Reply Last reply
        0
        • hekH Offline
          hekH Offline
          hek
          Admin
          wrote on last edited by
          #10

          In the next version RGB values it will be transmitted as a 3 byte binary value over the air.
          On the serial line it will probably be split into decimal json like: {red:<0-255>;green:<0-255>;blue:<0-255>}.

          If you want to add this to 1.4.1 i would suggest sending data as RGB hex string (to make survive over serial interface).

          1 Reply Last reply
          0
          • JohnJ Offline
            JohnJ Offline
            John
            Plugin Developer
            wrote on last edited by John
            #11

            Then to make sure there is as less data as possible over the air then this would mean to send data as: "000000" to "ffffff" (so no "#" char)

            This also has my personal preference, but want to know how the community would like it to handle it on the node side.

            My Domotica project: http://www.pidome.org

            1 Reply Last reply
            0
            • hekH Offline
              hekH Offline
              hek
              Admin
              wrote on last edited by hek
              #12

              Using something like:

              string hexstring = "FF3Fa0";
              int number = (int) strtol( &hexstring, NULL, 16);
              int r = number >> 16;
              int g = number >> 8 & 0xFF;
              int b = number & 0xFF;
              
              JohnJ 1 Reply Last reply
              0
              • hekH hek

                Using something like:

                string hexstring = "FF3Fa0";
                int number = (int) strtol( &hexstring, NULL, 16);
                int r = number >> 16;
                int g = number >> 8 & 0xFF;
                int b = number & 0xFF;
                
                JohnJ Offline
                JohnJ Offline
                John
                Plugin Developer
                wrote on last edited by
                #13

                @hek
                Understood, i meant how they want to receive the data. @BulldogLowell would like to receive a long instead of an hex string (if i understood it correctly).

                That's the part i'm interested in.

                My Domotica project: http://www.pidome.org

                BulldogLowellB 1 Reply Last reply
                0
                • JohnJ John

                  @hek
                  Understood, i meant how they want to receive the data. @BulldogLowell would like to receive a long instead of an hex string (if i understood it correctly).

                  That's the part i'm interested in.

                  BulldogLowellB Offline
                  BulldogLowellB Offline
                  BulldogLowell
                  Contest Winner
                  wrote on last edited by
                  #14

                  @John

                  The 3byte message works here.

                  Like I mentioned, a little function to put a bow in it.

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    arendst
                    wrote on last edited by arendst
                    #15

                    I agree on the 6 character hex text value. Who will implement this when in 1.4.2?
                    I have build a RGB neopixel led strip actuator and I would like to control the colours with V_RGB.
                    Thanks in advance. 😉

                    JohnJ 1 Reply Last reply
                    0
                    • A arendst

                      I agree on the 6 character hex text value. Who will implement this when in 1.4.2?
                      I have build a RGB neopixel led strip actuator and I would like to control the colours with V_RGB.
                      Thanks in advance. 😉

                      JohnJ Offline
                      JohnJ Offline
                      John
                      Plugin Developer
                      wrote on last edited by John
                      #16

                      @arendst
                      Together with an user this is implemented in the current PiDome version available on the build server. He has posted a little tutorial on how to do this. So if you are a PiDome user: http://forum.pidome.org/viewtopic.php?id=58

                      It is only available in the serial version for testing purposes.

                      If all goes well, it will be extended to the MQTT version.

                      [EDIT]It sends hex values which can be extracted as posted above[/EDIT]

                      My Domotica project: http://www.pidome.org

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        arendst
                        wrote on last edited by
                        #17

                        @John
                        Thanks for the response. I use Domoticz as controller which just started to support MySensors. It works great for V_Light and V_Dimmer but lacks RGB color support as the MySensors library lacks color support too.

                        @hek
                        Why not update the MySensors library with S_Color and V_RGB. That way Domoticz and other controllers can support color natively.

                        hekH 1 Reply Last reply
                        0
                        • A arendst

                          @John
                          Thanks for the response. I use Domoticz as controller which just started to support MySensors. It works great for V_Light and V_Dimmer but lacks RGB color support as the MySensors library lacks color support too.

                          @hek
                          Why not update the MySensors library with S_Color and V_RGB. That way Domoticz and other controllers can support color natively.

                          hekH Offline
                          hekH Offline
                          hek
                          Admin
                          wrote on last edited by
                          #18

                          @arendst said:

                          Why not update the MySensors library with S_Color and V_RGB. That way Domoticz and other controllers can support color natively.

                          Wanted to add this in the next major release. But if this drags out (time-wise) I might add it to the next minor as well.

                          1 Reply Last reply
                          0
                          • D Offline
                            D Offline
                            davy39
                            wrote on last edited by
                            #19

                            Hi guys,
                            Any news about that ?
                            Is it now possible to use domoticz's rgb module to control an rgb led strip through an arduino mysensor node ?
                            Thanks for your help.

                            1 Reply Last reply
                            0
                            • D Offline
                              D Offline
                              davy39
                              wrote on last edited by
                              #20

                              up !
                              Could anyone help me to configure domoticz & mysensors in order to control analog RGB led strip ?

                              D 1 Reply Last reply
                              0
                              • siklosiS Offline
                                siklosiS Offline
                                siklosi
                                wrote on last edited by siklosi
                                #21

                                @davy39
                                I just made RGB controller for domoticz. So if it's not to late...

                                
                                #include <MySensor.h>
                                #include <SPI.h>
                                
                                #define RED_PIN 3
                                #define GREEN_PIN 5
                                #define BLUE_PIN 6
                                
                                #define NODE_ID 2
                                #define CHILD_ID 0
                                #define SKETCH_NAME "RGB_STRIP"
                                #define SKETCH_VERSION "1.0.0"
                                #define NODE_REPEAT false
                                
                                MySensor gw;
                                
                                long RGB_values[3] = {0, 0, 0};
                                float dimmer;
                                
                                void setup() {
                                
                                
                                  pinMode(RED_PIN, OUTPUT);
                                  pinMode(GREEN_PIN, OUTPUT);
                                  pinMode(BLUE_PIN, OUTPUT);
                                
                                  gw.begin(incomingMessage, NODE_ID, NODE_REPEAT);
                                  gw.sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
                                  gw.present(CHILD_ID, S_RGB_LIGHT, "RGB Strip", false);
                                  gw.request(CHILD_ID, V_RGB);
                                }
                                
                                void loop() {
                                  gw.process();
                                }
                                
                                void incomingMessage(const MyMessage &message) {
                                
                                  if (message.type == V_RGB) {
                                
                                    String hexstring = message.getString();
                                    long number = (long) strtol( &hexstring[0], NULL, 16);
                                    RGB_values[0] = number >> 16;
                                    RGB_values[1] = number >> 8 & 0xFF;
                                    RGB_values[2] = number & 0xFF;
                                  }
                                  if (message.type == V_DIMMER) {
                                    dimmer = message.getInt();
                                    analogWrite(RED_PIN, int(RGB_values[0] * (dimmer / 100)));
                                    analogWrite(GREEN_PIN, int(RGB_values[1] * (dimmer / 100)));
                                    analogWrite(BLUE_PIN, int(RGB_values[2] * (dimmer / 100)));
                                  }
                                
                                  if (message.type == V_LIGHT) {
                                    if (message.getInt() == 0) {
                                      digitalWrite(RED_PIN, 0);
                                      digitalWrite(GREEN_PIN, 0);
                                      digitalWrite(BLUE_PIN, 0);
                                
                                    }
                                    if (message.getInt() == 1) {
                                      analogWrite(RED_PIN, int(RGB_values[0] * (dimmer / 100)));
                                      analogWrite(GREEN_PIN, int(RGB_values[1] * (dimmer / 100)));
                                      analogWrite(BLUE_PIN, int(RGB_values[2] * (dimmer / 100)));
                                    }
                                  }
                                }
                                
                                
                                1 Reply Last reply
                                1
                                • D davy39

                                  up !
                                  Could anyone help me to configure domoticz & mysensors in order to control analog RGB led strip ?

                                  D Offline
                                  D Offline
                                  Dylano
                                  wrote on last edited by
                                  #22

                                  @davy39 said:

                                  up !
                                  Could anyone help me to configure domoticz & mysensors in order to control analog RGB led strip ?

                                  Is this option working?
                                  Or perhaps a RGBW strip...

                                  Domoticz, with a lot of working hardware, include mysensors :-)
                                  OpenPLI, RuneAudio, Solarmeter, etc......

                                  Not a great builder of software and hardware, more a user...
                                  Only i try to do my best :-(

                                  1 Reply Last reply
                                  0
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  23

                                  Online

                                  11.7k

                                  Users

                                  11.2k

                                  Topics

                                  113.1k

                                  Posts


                                  Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • MySensors
                                  • OpenHardware.io
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular