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. Vera
  4. My MySensors RGBW plug in has an init problem

My MySensors RGBW plug in has an init problem

Scheduled Pinned Locked Moved Vera
11 Posts 3 Posters 6.0k Views 3 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.
  • hekH Offline
    hekH Offline
    hek
    Admin
    wrote on last edited by
    #2

    Nice work @BartE.

    If you'd like you can perhaps incorporate this in the MySensors plugin? Or ask vosmont to pull your additions?

    1 Reply Last reply
    0
    • BartEB Offline
      BartEB Offline
      BartE
      Contest Winner
      wrote on last edited by BartE
      #3

      Thx @hek

      I'm not sure what you mean by incorporate it in the MySensors plug in, but i did make a pull-request to vosmont.

      I hope he can help me with fixing the initialize issue, for some reason the MySensor plug in does not start when the RGBcontroller is configured as slave. I took me quite some time figuring this out but no luck.

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

        I have a vague memory of trying setting up a VariableContainer(plugin) as child-device in MySensors way back. But it didn't work either. I don't think a plugin in Vera can delegate commands to child devices (the build in devices is the exception).

        That's why I think you have to move the parts needed from vosmont's device into the MySensors plugin. The GUI/descriptor files can of course be reused.

        @akbooer might have some more insight to the Vera mysteries.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          akbooer
          wrote on last edited by
          #5

          Happy to help. I've played a bit with @vosmont's RGB plugin when getting it to run under openLuup. It would be best if he could add a new device as part of the standard plugin - it does have some very specific code for different manufacturers. I guess I need to take a closer look at the workflow in the OP and try and understand what is needed and what is not working.

          1 Reply Last reply
          0
          • BartEB Offline
            BartEB Offline
            BartE
            Contest Winner
            wrote on last edited by BartE
            #6

            @akbooer that would be really great if you could help.

            What i see is that Vera calls the initialized (startup) function of the child devices though the parent device. So in this specific case the RGBController lua startup function is called with the lul_device id of the MySensors device and the startup function of the child plugin is NOT called.

            So i modified the RGB controller startup function (L_RGBController1.lua) with a check if it was called for a child or for itself as parent.

            function startup (lul_device)
            	log("startup", "Start plugin '" .. PLUGIN_NAME .. "' (v" .. PLUGIN_VERSION .. ")")
            
            	-- Update static JSON file
            	if updateStaticJSONFile(lul_device, PLUGIN_NAME .. "1") then
            		warning("startup", "'device_json' has been updated : reload LUUP engine")
            		luup.reload()
            		return false, "Reload LUUP engine"
            	end
            
            	-- Init
             	if luup.devices[lul_device].device_type == "urn:schemas-upnp-org:device:RGBController:1" then
            	     log("startup", "Found RGB master #" .. lul_device)
              	     initPluginInstance(lul_device)
            
            	     -- ... and now my watch begins (setting changes)
            	     luup.variable_watch("initPluginInstance", SID.RGB_CONTROLLER, "DeviceType", lul_device)
            	     luup.variable_watch("onDebugValueIsUpdated", SID.RGB_CONTROLLER, "Debug", lul_device)
            	else
            	     -- Look for a child RGB device, which need to start up
            	     for child_id, v in pairs(luup.devices) do
            		   -- if I am the parent device of a child RGBController start it up
            		   if v.device_num_parent == lul_device and v.device_type == "urn:schemas-upnp-org:device:RGBController:1" then
            			log("startup", "Found RGB child #" .. child_id)
              	     		initPluginInstance(child_id)
            
            	     		-- ... and now my watch begins (setting changes)
            	     		luup.variable_watch("initPluginInstance", SID.RGB_CONTROLLER, "DeviceType", child_id)
            	     		luup.variable_watch("onDebugValueIsUpdated", SID.RGB_CONTROLLER, "Debug", child_id)
            		   end
            	     end
            	end
            
            	if (luup.version_major >= 7) then
            		luup.set_failure(0, lul_device)
            	end
            
            	return true
            end
            
            

            This does NOT do the trick, i think the MySensors device is not ready (initialized) at the moment the RGB child start up is called. I even copied all action implementations (with dummy debug log) from the I_RGBController1.xml to I_Arduino1.xml so the "no implementation errors" where all gone.

            Maybe the L_Arduino.lua needs to be adapted so that the RGB-startup function is called when MySensors is ready or implement a delayed startup for child devices in L_RGBController1.lua

            I'm not sure...

            1 Reply Last reply
            0
            • A Offline
              A Offline
              akbooer
              wrote on last edited by
              #7

              Just to start again from the beginning, you are trying to get the RGBW Controller plugin to work with MySensors RGBW devices. What I don't know is how MySensors presents an RGBW device - I am assuming you get a node with 4 child dimmers, but perhaps not? This is what a native Vera multi-colour dimmer typically does (eg. Fibaro.)

              One problem I foresee is that the MySensors plugin is parent to all the MySensors devices, be they actual nodes or individual sensors, so you don't get the same logical grouping with one Vera RGBW device controlling its separate R G B W children (which is what, I think, @vosmont's controller requires.)

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

                @akbooer: No, since version 1.5 MySensors supports RGB and RGBW devices and in L_Arduino.lua these devices are created with D_RGBController1.xml. This is also the definition file name of vosmont's RGB-controller (coincident or not?).

                So one child is presented of type RGB or RGBW showing the vosmont's RGB color-wheel, the code i did write for the RGB-controller directly control's the RGB MyS device with MyS message's.

                luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {variableId = "RGBW", value = formerColor, radioId = pluginParams.rgbRadioId}, pluginParams.rgbArduinoId)
                

                This part of the code is working.

                You are right an alternative could be, represent 3 or 4 dimmers and configure vosmont RGB module so it controls these 3 or 4 dimmers like Fibaro. But i do like the idea of having only one tile with the color wheel.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  akbooer
                  wrote on last edited by
                  #9

                  @BartE OK, so the device D_RGBController1.xml is actually a child of the Arduino plugin, which handles (with your changes) the action call you showed. The problem, then is that @vosmont's plugin does not recognise this device as one it can control? Or is it that you are expecting, somehow, the colour wheel to work directly with the MYSensor plugin?

                  Sorry to be so dim about this, but I'd hate to be chasing up the wrong tree.

                  1 Reply Last reply
                  0
                  • BartEB Offline
                    BartEB Offline
                    BartE
                    Contest Winner
                    wrote on last edited by
                    #10

                    @akbooer the second option, i expect the color wheel to work directly with the MySensor plugin/Arduino. Like some other supported RGB devices.

                    To do so i've created a new type of device in vosmont's plugin called "MYS-RGBW", this one you can select in the RGBcontroller and as work around one has to set the MySensor plugin id and the radio id of the RGB device. But when it is created as child device this information should be known to the plugin.

                    So the problem is NOT controlling the device, but having the RGBController to startup correctly as child.

                    A 1 Reply Last reply
                    0
                    • BartEB BartE

                      @akbooer the second option, i expect the color wheel to work directly with the MySensor plugin/Arduino. Like some other supported RGB devices.

                      To do so i've created a new type of device in vosmont's plugin called "MYS-RGBW", this one you can select in the RGBcontroller and as work around one has to set the MySensor plugin id and the radio id of the RGB device. But when it is created as child device this information should be known to the plugin.

                      So the problem is NOT controlling the device, but having the RGBController to startup correctly as child.

                      A Offline
                      A Offline
                      akbooer
                      wrote on last edited by akbooer
                      #11

                      @BartE said:

                      So the problem is NOT controlling the device, but having the RGBController to startup correctly as child.

                      OK, here's my confusion: you can't have the Arduino plugin AND the RGBW Controller plugin both controlling the RGBW device. By definition, it is a child of the Arduino plugin and all functionality for that child device has to be provided by the parent. Are there, perhaps, some actions defined in the services or implementation file which are not, in fact, implemented by your additional code in the Arduino plugin?

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


                      17

                      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