Hi rechin304
Thank You for Your code...It's working great!!!
Best regards
Posts made by Łukasz Kostrzewa
-
RE: How To: Make a Simple/Cheap Scene Controller (with video)
-
RE: How To: Make a Simple/Cheap Scene Controller (with video)
@Łukasz-Kostrzewa said:
send(scene.set(keyInt));
Hi
After
send(scene.set(keyInt));
Add
send(scene2.set(keyInt));
Write this code to arduino (now You can OFF all the switches) Next delete code You added and write it to Arduino once again but now in Domoticz make modifications I writed couple post higher. When You do that You will be able to control 4 scenes and another 4 will bo halpefull to OFF the first4 (when You hold the buttons) -
RE: How To: Make a Simple/Cheap Scene Controller (with video)
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; } }
-
RE: How To: Make a Simple/Cheap Scene Controller (with video)
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 -
RE: How To: Make a Simple/Cheap Scene Controller (with video)
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
-
RE: Humidity and Temp sensor problem
One hour ago Temp and humidity sensor stopped working
I'm not strong enough to use arduino and my sensors:( I need to buy another raspberry pi and set it as a slave (I have 4 in my house and I have no problem with them).
Best regards -
RE: Humidity and Temp sensor problem
Hi
Maybe it is broken. I don't know :(I have couple of DHT11 sensors and some of them are working sam of them are not
From yesterday (so far) everything works great
I report later if something will broke.
Best regards -
RE: Humidity and Temp sensor problem
Hi
Powers source - phone charger 5V 1Aand Yes...I use 4,7 capacitor at the radio. -
RE: Humidity and Temp sensor problem
Hi
After hour script back to the beginning and now it sends temp + hum values every second:)
I don't understand what is going on
Best regards -
RE: Humidity and Temp sensor problem
Hi again
I've done a simple test.
I grab my dht11 sensor in my hand and after some time values are being see my values being send in my serial debug. I don't know why yesterday values was sending all the time but...
Sketch is working and reports temp changes by 1 degree.
Best regards and thx for answers -
RE: Humidity and Temp sensor problem
Thx for quick answer.
I was thinking the same. But I have been using this sketch for about a month and temp values was sending to my raspberry pi Domoticz every second.
Suddenly sketch sends values at the beggining and dies:(I Wonder what means:
delay(dht.getMinimumSamplingPeriod());
in Humidity sketch from My sensors library.
When I use my serial debug log I see that my temp and humidity values are send but only once and script stops. Yesterday sketch send this values all the time.
This is weird -
Humidity and Temp sensor problem
Hi to all
I have arduino nano and Domoticz on raspberry pi.
Yesterday everything was working but today my sketch from Mysensor library (Humidyty sketch - I have DHT 11) sends data only once at begginning and stop sending anything.
My Domoticz see temp and humidity values only once when arduino starts. After that no new values are received
I don't know what is happenning
Any idea?
Best regards -
RE: Mi-Light controller for Mysensors
I have new problem.
I paired wrong bulb and now I can't unpair it.
How to do that?
Best regards -
RE: 3-in-1 Humidity Temp and Motion
Hi to all
I changed a little Konrad sketch and add to 3in1 Humidity Temp and Motion one more sensor (Door\Window)
Here is my code:
#include <SPI.h>
#include <MySensor.h>
#include <DHT.h>
#include <Bounce2.h>#define CHILD_ID_DOOR 3
#define BUTTON_PIN_DOOR 2
#define CHILD_ID_HUM 0
#define CHILD_ID_TEMP 1
#define CHILD_ID_MOT 2 // Id of the sensor child
#define HUMIDITY_SENSOR_DIGITAL_PIN 4#define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!)
#define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
MySensor gw;
Bounce debouncer = Bounce();
int oldValue=-1;DHT dht;
float lastTemp;
float lastHum;
boolean metric = true;
MyMessage msgHum(CHILD_ID_HUM, V_HUM);
MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
MyMessage msgMot(CHILD_ID_MOT, V_TRIPPED);
MyMessage msgDoor(CHILD_ID_DOOR,V_TRIPPED);void setup()
{
gw.begin();
dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN);pinMode(BUTTON_PIN_DOOR,INPUT);
digitalWrite(BUTTON_PIN_DOOR,HIGH);debouncer.attach(BUTTON_PIN_DOOR);
debouncer.interval(5);// Send the Sketch Version Information to the Gateway
gw.sendSketchInfo("4in1", "1.0");pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input
// Register all sensors to gw (they will be created as child devices)
gw.present(CHILD_ID_HUM, S_HUM);
gw.present(CHILD_ID_TEMP, S_TEMP);
gw.present(CHILD_ID_MOT, S_MOTION);
gw.present(CHILD_ID_DOOR, S_DOOR);metric = gw.getConfig().isMetric;
}void loop()
{
// Read digital motion value
boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH;Serial.println(tripped);
gw.send(msgMot.set(tripped?"1":"0")); // Send tripped value to gwdelay(dht.getMinimumSamplingPeriod());
float temperature = dht.getTemperature();
if (isnan(temperature)) {
Serial.println("Failed reading temperature from DHT");
} else if (temperature != lastTemp) {
lastTemp = temperature;
if (!metric) {
temperature = dht.toFahrenheit(temperature);
}
gw.send(msgTemp.set(temperature, 1));
Serial.print("T: ");
Serial.println(temperature);
}float humidity = dht.getHumidity();
if (isnan(humidity)) {
Serial.println("Failed reading humidity from DHT");
} else if (humidity != lastHum) {
lastHum = humidity;
gw.send(msgHum.set(humidity, 1));
Serial.print("H: ");
Serial.println(humidity);
}debouncer.update();
// Get the update value
int value = debouncer.read();if (value != oldValue) {
// Send in the new value
gw.send(msgDoor.set(value==HIGH ? 1 : 0));
oldValue = value;
}// Sleep until interrupt comes in on motion sensor. Send update every two minute.
//gw.sleep(INTERRUPT,CHANGE, SLEEP_TIME);
}Now it is 4in1
-
RE: 3-in-1 Humidity Temp and Motion
Hi Konrad
Thx for great code. It works like charm but...
I have a question... It is possible to add to Your code one more (Door/Window) sensor?
Mayby You can post that code on this forum?
Best regards -
RE: Mi-Light controller for Mysensors
Hi
Anyone have idea how to modify the code to pair domoticz to more than one bulb?
With actual code I am able to ON/OFF only one bulbAny idea?
Best regards
-
RE: Mi-Light controller for Mysensors
Thx for answer
I am noob in programming. Maybe You can post an example how to modify the code?
Best regards
-
RE: Mi-Light controller for Mysensors
Another question...
Is there possibility to add to this code another one to control DHT11 temp and humidity sensor (from my sensors library)
I wanted to have 2 thing in one:)
Best regards -
RE: Mi-Light controller for Mysensors
Hi Ted
I understand now:)
I changed remote id to diffrent values but now my first dummy switch paired to my first bulb doesn't work.
I need to have another arduino to control another bulb?
Best regards -
RE: Mi-Light controller for Mysensors
Thax for reply
But I don't understand
I don't have Milight bridge and I paired one Milight bulb to Dummy switch I have in my Domoticz My sensors.
And this works great but there is only one dummy switch.
When I add to arduino code one more (gw.present(0, S_LIGHT);) in Domoticz there is another Dummy switch but it controls the same lights then the first one. I don't know how to add (I don;t know it is possible) a second dummy to control another bulb without milight bridge. -
RE: Mi-Light controller for Mysensors
Thank You for this solutin. Everythin works great but...
I was able to pair with one bulb but I I do not know what to do to pair with others?
Any idea?
Best regard