SceneController
-
Hi I have made a wall controller, but I'm using S_LIGHT as presentation. Is it possible to make it as S_SCENECONTROLLER1 insted. Then I only have one device and the node, insted of as now 4 devices and a node?
I dont know if it possible. What I want is to make is a MySensor device that acts like a scene controller.
Regards dalhoj
-
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.xmlDo you think these are able to be controlled by a mySensor device?
-
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.xmlDo you think these are able to be controlled by a mySensor device?
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.
-
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#L74But 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!
-
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#L74But 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!
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
-
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 -
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:
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; } } } -
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.
-
@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.
-
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.
@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)) thento:
if ((value ~= curValue) or (curValue == nil) or (serviceId == "urn:micasaverde-com:serviceId:SceneController1")) thenSo the sl_SceneActivated/sl_SceneDeactivated variables are updated unconditionally
-
@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)) thento:
if ((value ~= curValue) or (curValue == nil) or (serviceId == "urn:micasaverde-com:serviceId:SceneController1")) thenSo the sl_SceneActivated/sl_SceneDeactivated variables are updated unconditionally
-
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:

For button 1 the scene number is 0
for button 2 the scene number is 1 and so on.Hope is helps ;-)
-
@Dalhoj is it possible to have one button stop/start the same scene, as an on/off switch for a light for example?