How To: Make a Simple/Cheap Scene Controller (with video)
-
@Maciej-Kulawik
I found it as 'Scene' switch but this example send only V_SCENE_ON the first time (the switch is still ON later)@Michal-Mormon
Yes, exactly! It looks like without scene_off sent from scene controller in domoticz it will be one-time action (since if this scene switch is switched on you cannot switch it on again). You can try to setup automatic switching it off in domoticz. -
I added 2 lines and works perfect with Domoticz:
MyMessage scene(KEYPAD_CHILD_ID, V_SCENE_ON);
MyMessage scene2(KEYPAD_CHILD_ID, V_SCENE_OFF); //added linegw.send(scene.set(keyInt));
gw.send(scene2.set(keyInt)); //added line -
I added 2 lines and works perfect with Domoticz:
MyMessage scene(KEYPAD_CHILD_ID, V_SCENE_ON);
MyMessage scene2(KEYPAD_CHILD_ID, V_SCENE_OFF); //added linegw.send(scene.set(keyInt));
gw.send(scene2.set(keyInt)); //added line@Michal-Mormon awesome!
-
-
@petewill Any news about the 2.0 code? I am in the process of making scene controllers in the different rooms but can't get it to work.
@dvr123 No, not yet :grimacing:
My thermostat project has taken priority over everything because I need one in my house. I have a prototype working but I need to finish it. It is taking much longer than expected and I also haven't had much time lately. Sorry. -
Hi Guys,
I've been trying to compile this sketch without any success. I keep getting the following error when compiling
#error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.Can anyone help? thanks
-
Hi Guys,
I've been trying to compile this sketch without any success. I keep getting the following error when compiling
#error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.Can anyone help? thanks
@Matt-Pitts I still haven't had time to convert/test the sketch for version 2.0. If you want to take a shot at it there is info here: https://forum.mysensors.org/topic/4276/converting-a-sketch-from-1-5-x-to-2-0-x
I will get to it eventually I just have other projects that are consuming my time right now. Sorry.
-
This post is deleted!
-
Hi
I delated my post because it pasted wrong. I try to paste it correctly but don't know how:( (hek - maybe You as an administrator can paste it corectly?)dvr123 have right that this code recognize the buton only on the first click:(
Mayby someone knows how to modify the code to work like normal buton (not the scene controller)?Best regards
-
You could do that but it is not a great solution.
Add to Domoticz all 8 switches (4 when pressed and 4 when hold).
In first switch (pressed switch) add Slave device (first hold switch). Do it for all 4 switches.
To 5,6,7,8 switches add Slave Device (1,2,3,4 switch).
It works like that:
When You press First number on keyboard it change state to ON and 5 to OFF
When You Hold first number on keybord it change state of 5 switch to ON and first to OFF.
Next You have to make some events to trigger some scenes or lights
I have hope I managed to explain what I mean :)
Best regards -
The 2.0 version code:
#define MY_DEBUG #define MY_RADIO_NRF24 #include <SPI.h> #include <MySensors.h> #include <Keypad.h> #define NODE_ID 14 // or set to AUTO if you want gw to assign a NODE_ID for you. #define SN "Scene Controller" #define SV "1.0" #define KEYPAD_CHILD_ID 95 MyMessage scene(KEYPAD_CHILD_ID, V_SCENE_ON); MyMessage scene2(KEYPAD_CHILD_ID, V_SCENE_OFF); const byte ROWS = 4; //four rows const byte COLS = 1; //three columns char keys[ROWS][COLS] = { {'1'}, {'2'}, {'3'}, {'4'} }; byte rowPins[ROWS] = {6, 7, 4, 5}; //connect to the row pinouts of the keypad byte colPins[COLS] = {8}; //connect to the column pinouts of the keypad Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); byte lastState; void setup() { sendSketchInfo(SN, SV); present(KEYPAD_CHILD_ID, S_SCENE_CONTROLLER); keypad.addEventListener(keypadEvent); } void loop() { char key = keypad.getKey(); } void keypadEvent(KeypadEvent key) { switch (keypad.getState()) { case PRESSED: lastState = 1; break; case HOLD: lastState = 2; break; case RELEASED: int keyInt = key - '0'; //Quick way to convert Char to Int so it can be sent to controller if (lastState == 2) { keyInt = keyInt + 4; //If button is held, add 4. If using more than 4 buttons this number will need to be changed } send(scene.set(keyInt)); break; } }