Scripting / scenes for RGB strip, best way to control Mysensors RGBW node from Vera?



  • I have a vera edge (UI7) and an ethernet mysensors gateway. I also have a Mysensors node running on an Uno and controlling an analog RGB LED strip (one of the standard 5050 strips, with a protoboard with external 12V power and some mosfets to handle the PWM to the strip.)

    So in my Vera it shows up as 3 dimmers, for the red green and blue channels. Works fine, as far as that goes. However, I'd like to do some interesting things with this (the purpose of this strip is as a visual notification, not normal illumination).

    I made some manually-triggered scenes such as "red flash" which does red on, off, on, off, on, off at 1 second intervals. But it's hard-coded like that - 3 flashes, 1 second intervals. I tried making a "yellow flash" doing the same but turning both red and green on and off. Again, it works, but since the vera is sending separate red on and green on commands, you can see a split-second of red before green comes on, and then a split-second of green after the red turns off.

    Is there a better way to do this? Any way to have the vera send specific colors as a single command?

    Another thing I'd like to do is continuous flashing when a certain door sensor is open. How best to do that from Vera? I know the logic I'd use if I was coding something would be along the lines of

    while (door=open)
    {
    color on();
    wait 1 second;
    color off();
    wait 1 second;
    }

    but how to implement that on the Vera? Would I be better moving some of the logic over to the arduino? Basically make a bunch of "switches" that each have code in the mysensors sketch, and then just turn those switches on and off via the vera? That'd clutter the vera with devices, but might be simpler in the long run...



  • To me, this is exactly the sort of low-level thing that should be done in a node. That way you don't load the controller or the network... and you can change controller in future and it will still work.

    Shouldn't need a bunch of switches, just one 'mode' variable.


  • Hero Member

    @akbooer agree. @timropp Is Vera not able to handle the V_RGB & V_RGBW types? That would at least avoid sending three datavalues (one for each color).



  • Thanks, this is exactly the sort of help I was looking for. I so far am using the example RGBW sketch, which implements the colors as a trio of dimmers rather than a single V_RGB device. I'll have to test out that device and see how it works.

    As for the mode variable, how do I do that? I see that there's V_VARx variables that I assume you could use with a switch for that purpose, but I don't see anything on how to implement those, on either the mysensors node or the Vera side. Got a reference or example I can use?



  • Maybe you can try use the plugin RGB Controller
    And use that for som help for your animation

    But I'm not sure it works with Mysensors RGB

    http://forum.micasaverde.com/index.php/topic,32613.0.html


  • Hero Member

    @timropp Hi, did you get anywhere with the modes for your RGB node? I have a RGBW node where I would like to use modes to. I just wrote a first attempt to use V_VAR1 for different modes. I have not tested it yet but you can find it here if you like to see it:

    https://codebender.cc/sketch:44740


  • Hero Member

    I have an alarm mode working in my RGBW node now. Just by sending V_VAR1 = 1 to the node it runs an alarm sequence until I send V_VAR1 = 0.

    What more modes could we need for an RGB node??



  • Thanks for that - I haven't had time to mess with my system but want to, so I'll check out your sample code. Is that what you're running that worked, or have you made changes? And how do you send the V_VAR values from Vera? Seems like a simple enough way to have a whole bunch of pre-made sequences built into the RGB sketch and have Vera just send the proper number. V_Var1=0 for all off, =1 for red/blue strobe, =2 for blinking red, etc.


  • Hero Member

    I added "Variable1" under one of the dimmer devices using "urn:upnp-org:serviceId:VContainer1" as service.

    Then I just use the following code to send VAR_1 values to the node:

    luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {radioId="4;3", variableId="VAR_1", value=0}, 276)

    Where 4 is the Node ID and 3 is the sensor ID and 276 is the device ID of the main device for the arduino GW Plugin.

    I´m open for sugestions for other modes to implement.

    Let me know if you have any trouble.


  • Hero Member

    Found a non-blocking library for LED fading so I created 2 new modes. One that randomly fades the colors and one with a pulsating effect for Red color. See the codebender sketch from previous post. What else can we do with a RGB node?


Log in to reply
 

Suggested Topics

  • 1
  • 1
  • 1
  • 5
  • 2

19
Online

11.2k
Users

11.1k
Topics

112.5k
Posts