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. Development
  3. SceneController

SceneController

Scheduled Pinned Locked Moved Development
28 Posts 9 Posters 16.7k Views 5 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

    I haven't played with scene-controllers. Do you run a Vera controller or have something else?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      Dalhoj
      wrote on last edited by
      #3

      I have the vera controller, and would like to make a node that acts like ie. The battery operated remotes you can get in z wave, so you can trigger scenes.

      1 Reply Last reply
      0
      • greglG Offline
        greglG Offline
        gregl
        Hero Member
        wrote on last edited by
        #4

        Actually this is a pretty good idea.
        A zwave scene controller is roughly $50..i have an Aeon one. and yeah its ok function wise, but its pretty ugly. I thought i would open it up and wire its buttons to a nicer wall plate.( Something like the Clipsal Saturn plate...which is going to make it very $$$ but would look great.)

        So to save $$ by using a mysensors battery board/devDuino2 running a "scene Controller" sketch would be pretty nice!

        @hek - the Vera device files used by a scene controller are
        urn:schemas-micasaverde-com:device:SceneController:1
        D_SceneController1.xml

        Do you think these are able to be controlled by a mySensor device?

        hekH 1 Reply Last reply
        0
        • greglG gregl

          Actually this is a pretty good idea.
          A zwave scene controller is roughly $50..i have an Aeon one. and yeah its ok function wise, but its pretty ugly. I thought i would open it up and wire its buttons to a nicer wall plate.( Something like the Clipsal Saturn plate...which is going to make it very $$$ but would look great.)

          So to save $$ by using a mysensors battery board/devDuino2 running a "scene Controller" sketch would be pretty nice!

          @hek - the Vera device files used by a scene controller are
          urn:schemas-micasaverde-com:device:SceneController:1
          D_SceneController1.xml

          Do you think these are able to be controlled by a mySensor device?

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

          @gregl

          Yes it is possible. Just don't know when I have time to do the necessary tests. Anyone want do do some tests on what variables we need to activate/deactivate scenes etc?

          I think ** NumButtons**, sl_SceneActivated and ** sl_SceneDeactivated** is involved.

          1 Reply Last reply
          0
          • greglG Offline
            greglG Offline
            gregl
            Hero Member
            wrote on last edited by
            #6

            @hek said:

            sl_SceneActivated

            @hek - ill have a crack....but any idea where on vera these files reside?

            hekH 1 Reply Last reply
            0
            • greglG gregl

              @hek said:

              sl_SceneActivated

              @hek - ill have a crack....but any idea where on vera these files reside?

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

              @gregl

              Ok, added missing scene controller device (the SCENE_ON / SCENE_OFF variables was already there) to the 1.4 development branch.

              https://github.com/mysensors/Arduino/blob/development/libraries/MySensors/MyMessage.h#L58
              https://github.com/mysensors/Vera/blob/development/L_Arduino.lua#L74

              But I have no idea what happens if you create a SceneController device from your Arduino. When do you specify NumButtons? At creation time? That would be problematic as we today have no way of specifying custom data when doing sensor-presentation from Arduino.

              Edit: My post number 500!

              H 1 Reply Last reply
              0
              • hekH hek

                @gregl

                Ok, added missing scene controller device (the SCENE_ON / SCENE_OFF variables was already there) to the 1.4 development branch.

                https://github.com/mysensors/Arduino/blob/development/libraries/MySensors/MyMessage.h#L58
                https://github.com/mysensors/Vera/blob/development/L_Arduino.lua#L74

                But I have no idea what happens if you create a SceneController device from your Arduino. When do you specify NumButtons? At creation time? That would be problematic as we today have no way of specifying custom data when doing sensor-presentation from Arduino.

                Edit: My post number 500!

                H Offline
                H Offline
                hhg
                wrote on last edited by
                #8

                @hek

                If you want buttons on the device widget I think you need to at some custom D_.xml and D_.js files (See AtiRemote in the rfxtrx code tree as an example)
                But in my experience the generic Scene Controller works fine "as is" - Just sent the "Button number" as the value:

                -- On button press
                luup.variable_set("urn:micasaverde-com:serviceId:SceneController1","sl_SceneActivated", button_no, device_no)
                			
                -- On button release                                                                                       
                luup.variable_set("urn:micasaverde-com:serviceId:SceneController1","sl_SceneDeactivated", button_no, device_no)
                

                Please note: I have not tried this with MySensors - The above is from another Vera plugin I have written

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  Dalhoj
                  wrote on last edited by
                  #9

                  Im not home at the moment so I cant test, but found the guide to set up a z wave remote

                  http://wiki.zwaveeurope.com/index.php?title=KFOB_VERA

                  So I think you will have each button on the node to send a scene_on with the id of the button and then deactivate the scene again.

                  And then just a picture of my wall plate in danish design, with the arduino behind.
                  https://dl.dropboxusercontent.com/u/3260168/arduinotryk01.jpg

                  1 Reply Last reply
                  0
                  • H Offline
                    H Offline
                    hhg
                    wrote on last edited by
                    #10

                    In 1.4b1 1.4b1 (18848a2) Scene Controller support is present, and works fine

                    Present with:

                    gw.present(CHILD_ID, S_SCENE_CONTROLLER); 
                    

                    And it shows as a generic scene controller in Vera:
                    upload-af0688b3-9110-434f-a57c-aa34e808e0fe

                    The sketch to support a 4 button wall controller:

                    // Simple SceneController 
                    
                    #include <MySensor.h>
                    #include <SPI.h>
                    #include <Bounce2.h>
                    
                    #define CHILD_ID 3
                    // PIN for the buttons
                    byte buttons[] = {3, 4, 5, 6};
                    #define NUMBUTTONS sizeof(buttons)
                    byte pressed[NUMBUTTONS], justpressed[NUMBUTTONS], justreleased[NUMBUTTONS];
                    
                    MySensor gw;
                    Bounce debouncer[NUMBUTTONS];
                    
                    int oldValue[NUMBUTTONS];
                    
                    MyMessage msgOn(CHILD_ID,V_SCENE_ON);
                    MyMessage msgOff(CHILD_ID,V_SCENE_OFF);
                    
                    void setup()  
                    {  
                      gw.begin();
                    
                      /// Make input & enable pull-up resistors on switch pins
                      for (short i=0; i < NUMBUTTONS; i++){
                      
                        pinMode(buttons[i], INPUT);
                        digitalWrite(buttons[i], HIGH);
                        oldValue[i] = -1;
                        // After setting up the button, setup debouncer
                        debouncer[i].attach(buttons[i]);
                        debouncer[i].interval(5);
                        
                      }
                      
                      
                      
                      // Send the Sketch Version Information to the Gateway
                      gw.sendSketchInfo("LK 4-Tryk", "1.0");
                      // Register binary input sensor to gw (they will be created as child devices)
                      gw.present(CHILD_ID, S_SCENE_CONTROLLER); 
                    }
                    
                    
                    //  Check if digital input has changed and send in new value
                    void loop() 
                    {
                      for (short i=0; i < NUMBUTTONS; i++){
                        debouncer[i].update();
                        // Get the update value
                        int value = debouncer[i].read();
                     
                        if (value != oldValue[i]) {
                           // Send in the new value
                           if (value==HIGH) {
                             gw.send(msgOff.set(i));
                           }
                           else {
                             gw.send(msgOn.set(i));
                           }
                           oldValue[i] = value;
                        }
                      }
                    }
                    
                    1 Reply Last reply
                    1
                    • korttomaK Offline
                      korttomaK Offline
                      korttoma
                      Hero Member
                      wrote on last edited by
                      #11

                      Sweet!! Thanks @hhg exactly what I need.

                      • Tomas
                      1 Reply Last reply
                      0
                      • androbotA Offline
                        androbotA Offline
                        androbot
                        wrote on last edited by
                        #12

                        I tried this out last night and discovered an interesting issue. A scene will activate once and deactivate once, but all subsequent changes are not applied. I confirmed in my Vera logs that the messages make it through to the unit, but the subsequent application of scene never happens after the first time.

                        I'm suspecting this is due to the "setVariableIfChanged" nature of the code in conjunction with the split V_SCENE_ON/V_SCENE_OFF messages. In other words, it's not a single variable that is toggling, it's two separate ones.

                        H 1 Reply Last reply
                        1
                        • hekH Offline
                          hekH Offline
                          hek
                          Admin
                          wrote on last edited by hek
                          #13

                          @androbot said:

                          I'm suspecting this is due to the "setVariableIfChanged" nature of the code in conjunction with the split V_SCENE_ON/V_SCENE_OFF messages. In other words, it's not a single variable that is toggling, it's two separate ones.

                          This most surely is the problem! I will have to make a mental note of it and fix it the next time I mess with the Vera plugin code.

                          1 Reply Last reply
                          0
                          • androbotA androbot

                            I tried this out last night and discovered an interesting issue. A scene will activate once and deactivate once, but all subsequent changes are not applied. I confirmed in my Vera logs that the messages make it through to the unit, but the subsequent application of scene never happens after the first time.

                            I'm suspecting this is due to the "setVariableIfChanged" nature of the code in conjunction with the split V_SCENE_ON/V_SCENE_OFF messages. In other words, it's not a single variable that is toggling, it's two separate ones.

                            H Offline
                            H Offline
                            hhg
                            wrote on last edited by
                            #14

                            @androbot said:

                            I'm suspecting this is due to the "setVariableIfChanged" nature of the code in conjunction with the split V_SCENE_ON/V_SCENE_OFF messages. In other words, it's not a single variable that is toggling, it's two separate ones.

                            Nice spottet!

                            Change line 182 in L_Arduino.lua from

                             if ((value ~= curValue) or (curValue == nil)) then
                            

                            to:

                            if ((value ~= curValue) or (curValue == nil) or (serviceId == "urn:micasaverde-com:serviceId:SceneController1")) then
                            

                            So the sl_SceneActivated/sl_SceneDeactivated variables are updated unconditionally

                            androbotA 1 Reply Last reply
                            1
                            • H hhg

                              @androbot said:

                              I'm suspecting this is due to the "setVariableIfChanged" nature of the code in conjunction with the split V_SCENE_ON/V_SCENE_OFF messages. In other words, it's not a single variable that is toggling, it's two separate ones.

                              Nice spottet!

                              Change line 182 in L_Arduino.lua from

                               if ((value ~= curValue) or (curValue == nil)) then
                              

                              to:

                              if ((value ~= curValue) or (curValue == nil) or (serviceId == "urn:micasaverde-com:serviceId:SceneController1")) then
                              

                              So the sl_SceneActivated/sl_SceneDeactivated variables are updated unconditionally

                              androbotA Offline
                              androbotA Offline
                              androbot
                              wrote on last edited by
                              #15

                              @hhg

                              Worked like a charm!

                              1 Reply Last reply
                              0
                              • D Offline
                                D Offline
                                dayve218
                                wrote on last edited by
                                #16

                                hey guys, trying to set this one up, i have the widget displaying, but no control happening

                                pretty new to all of this so any help would be appreciated.

                                dayve

                                1 Reply Last reply
                                0
                                • D Offline
                                  D Offline
                                  Dalhoj
                                  wrote on last edited by
                                  #17

                                  Hi

                                  After the Node and Scenecontroller shows up in the Vera UI you have to create a scene and then asign the scenecontroller as a trigger:
                                  arduino_trigger.png

                                  For button 1 the scene number is 0
                                  for button 2 the scene number is 1 and so on.

                                  Hope is helps ;-)

                                  D 1 Reply Last reply
                                  0
                                  • D Offline
                                    D Offline
                                    dayve218
                                    wrote on last edited by
                                    #18

                                    @Dalhoj thanks for that, it seems super obvious now in retrospect.

                                    1 Reply Last reply
                                    0
                                    • D Dalhoj

                                      Hi

                                      After the Node and Scenecontroller shows up in the Vera UI you have to create a scene and then asign the scenecontroller as a trigger:
                                      arduino_trigger.png

                                      For button 1 the scene number is 0
                                      for button 2 the scene number is 1 and so on.

                                      Hope is helps ;-)

                                      D Offline
                                      D Offline
                                      dayve218
                                      wrote on last edited by
                                      #19

                                      @Dalhoj is it possible to have one button stop/start the same scene, as an on/off switch for a light for example?

                                      korttomaK hekH 2 Replies Last reply
                                      0
                                      • D dayve218

                                        @Dalhoj is it possible to have one button stop/start the same scene, as an on/off switch for a light for example?

                                        korttomaK Offline
                                        korttomaK Offline
                                        korttoma
                                        Hero Member
                                        wrote on last edited by korttoma
                                        #20

                                        @dayve218

                                        If you use PLEG you could do it like this:

                                        Condition ----------------- Action
                                        LightOn AND Button = Turn Light Off

                                        LightOff AND Button = Turn Light On

                                        • Tomas
                                        1 Reply Last reply
                                        0
                                        • D dayve218

                                          @Dalhoj is it possible to have one button stop/start the same scene, as an on/off switch for a light for example?

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

                                          @dayve218

                                          Some "scene controllers" I've seen triggers "scene off" when you push-and-hold button for say one a second.

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


                                          7

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 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