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.
  • 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
                            • D Offline
                              D Offline
                              dayve218
                              wrote on last edited by dayve218
                              #22

                              how would i make that happen?

                              @korttoma i dont, PLEG is infinitely confusing to me.

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

                                I dont know if you can have a 1 sec press!

                                but i uses LUUP and a simple ex could be turn on a lamp and if the lamp if on turn it off:

                                local relay1 = 114 --Light ID

                                local relay1_status = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1", "Status", relay1) --Status of Light

                                if (relay1_status == "0") then
                                luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue="1" }, relay1)
                                else
                                luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue="0" }, relay1)
                                end

                                Or you can use a toggle from the advanced scene menu:
                                upload-cb06931d-0aaa-4ee3-b90f-345180b5247c

                                That is how I do it.

                                hekH 1 Reply Last reply
                                0
                                • D Dalhoj

                                  I dont know if you can have a 1 sec press!

                                  but i uses LUUP and a simple ex could be turn on a lamp and if the lamp if on turn it off:

                                  local relay1 = 114 --Light ID

                                  local relay1_status = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1", "Status", relay1) --Status of Light

                                  if (relay1_status == "0") then
                                  luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue="1" }, relay1)
                                  else
                                  luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue="0" }, relay1)
                                  end

                                  Or you can use a toggle from the advanced scene menu:
                                  upload-cb06931d-0aaa-4ee3-b90f-345180b5247c

                                  That is how I do it.

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

                                  @Dalhoj said:

                                  I dont know if you can have a 1 sec press!

                                  I mean that the Arduino checks if user presses button for one sec and send the SCENE_OFF. You probably shouldn't let Vera handle this.

                                  D 1 Reply Last reply
                                  0
                                  • NuubiN Offline
                                    NuubiN Offline
                                    Nuubi
                                    wrote on last edited by
                                    #25

                                    Hey! Any pictures of scene controller installations? I'm planning on DIY'ing some "aesthetically pleasing" ones :-)

                                    1 Reply Last reply
                                    0
                                    • hekH hek

                                      @Dalhoj said:

                                      I dont know if you can have a 1 sec press!

                                      I mean that the Arduino checks if user presses button for one sec and send the SCENE_OFF. You probably shouldn't let Vera handle this.

                                      D Offline
                                      D Offline
                                      Dalhoj
                                      wrote on last edited by
                                      #26

                                      @hek said:

                                      I mean that the Arduino checks if user presses button for one sec and send the SCENE_OFF. You probably shouldn't let Vera handle this.

                                      I would make the Arduino send ie. for button 1 send scene ID 0 at short press and scene ID 1 for long press and so on.

                                      @Nuubi Here is two of my scene controllers:

                                      The first one is installed in my bedtable upload-c29b281d-083c-4b73-a4df-b27240ee9e31 and is a combination of a scenecontroller and a relaysensor for controling the 3 leds.

                                      The 2. is installed in the living room, and is a 8 button scenecontroller.
                                      upload-aee5fc51-3dea-4a00-b592-db58744e1e87
                                      It controlles

                                      • the lights in the living room
                                      • Blinds Open / Close
                                      • a power outlet On/Off
                                      • pause/plays my XBMC Medie Center
                                      • starts my Yamaha reciver and starts playing net radio
                                      • stops the radion again and turn of the reciver
                                      • turns up / down the volume on the reciver

                                      That is what I use it for at the moment.

                                      S 1 Reply Last reply
                                      0
                                      • D Dalhoj

                                        @hek said:

                                        I mean that the Arduino checks if user presses button for one sec and send the SCENE_OFF. You probably shouldn't let Vera handle this.

                                        I would make the Arduino send ie. for button 1 send scene ID 0 at short press and scene ID 1 for long press and so on.

                                        @Nuubi Here is two of my scene controllers:

                                        The first one is installed in my bedtable upload-c29b281d-083c-4b73-a4df-b27240ee9e31 and is a combination of a scenecontroller and a relaysensor for controling the 3 leds.

                                        The 2. is installed in the living room, and is a 8 button scenecontroller.
                                        upload-aee5fc51-3dea-4a00-b592-db58744e1e87
                                        It controlles

                                        • the lights in the living room
                                        • Blinds Open / Close
                                        • a power outlet On/Off
                                        • pause/plays my XBMC Medie Center
                                        • starts my Yamaha reciver and starts playing net radio
                                        • stops the radion again and turn of the reciver
                                        • turns up / down the volume on the reciver

                                        That is what I use it for at the moment.

                                        S Offline
                                        S Offline
                                        Smelliot
                                        wrote on last edited by
                                        #27

                                        @Dalhoj what enclosures are they? They look really slick!

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

                                          Its a danish enclosure: http://www.lk.dk/produkter/afbrydermateriel-lk-fuga/lk-fuga/antibakteriel/underlag/baseline-2-modul-346dd488/ for the button one and: http://www.lk.dk/produkter/afbrydermateriel-lk-fuga/lk-fuga/antibakteriel/underlag/baseline-1-modul-hvid/ for the top one.

                                          Its a danish department of Schneider Electric called LK(Lauritz Knudsen)

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


                                          14

                                          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