Send color data to sensors
-
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;@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.
-
@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.
-
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. 😉@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=58It 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]
-
@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. -
@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.@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.
-
@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))); } } } -
up !
Could anyone help me to configure domoticz & mysensors in order to control analog RGB led strip ?
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login