V_UP and V_DOWN are a great suggestion. I use a distance sensor on my garage door for the state. This will let me know when a button push occurred or a remote open was used.
mikeones
Posts
-
Automated garage door -
Relay Outlet + Button + OpenHab + Tasker + Android Wear = Freaking Awesome!I like that you were able to keep all the electronics inside the gang box. I would like to do something similar for my light switches but I not worked out how to power the components via the mains. Stuffing a charger in the box seems like overkill but it is one solution.
Any other options for powering that node? Any safety issues with having a charge stuffed in a gang box and left inside the drywall?
Thanks in advance
-
smoke/lightlevel/humidty/temp/smoketestIs that a hardwired smoke detector? I am looking for a hardwired solution that utilizes/runs off the power from a hardwired connection. Not sure if I would have access to 3.3 volts to run the Pro Mini and radio.
-
What is wrong with this node?If you have the hardware, hook up a sniffer and see what is happening with wireshark at the network layer. I had similar issues and found with the help of the sniffer, my node was having resend/timeout issues even being a couple of feet away. Playing with the channel and data rate, I was able to get a better signal and those st fail messages have stopped. This node is normally in the garage so the interference I had on the default channel was causing issues. Use the sniffer to see what is happening at the network layer.
-
Multi Binary SwitchesIt forces a status update at a predefined interval.
Alarm.timerRepeat(720, updateState); // update relay status every 2 hrs -
Multi Binary SwitchesHere is one example with a few extras.
// Simple binary switch example // Connect button or door/window reed switch between // digitial I/O pin 3 (BUTTON_PIN below) and GND. #include <MySensor.h> #include <SPI.h> #include <Bounce2.h> #include <Time.h> //http://playground.arduino.cc/Code/Time #include <TimeAlarms.h> //http://playground.arduino.cc/Code/Time MySensor gw; #define RADIO_ID 12 #define noReeds 5 const int BUTTON_PIN[] = {14, 15, 16, 17, 18}; // Arduino Digital I/O pin for button/reed switch, A0 - A4 boolean reedState[] = {HIGH, HIGH, HIGH, HIGH, HIGH}; Bounce debouncer[noReeds]; MyMessage msg[noReeds]; void setup(){ Serial.println("Starting setup" ); gw.begin(NULL, RADIO_ID, true); //stattc RADIO_ID an enable repeater Alarm.delay(250); gw.sendSketchInfo("Alarm Pannel", "1.0"); Alarm.delay(250); gw.requestTime(receiveTime); // initialize Relays with corresponding buttons for (int i = 0; i < noReeds; i++){ msg[i].sensor = i; // initialize messages msg[i].type = V_TRIPPED; debouncer[i] = Bounce(); // initialize debouncer debouncer[i].attach(BUTTON_PIN[i]); debouncer[i].interval(5); // Setup the button pinMode(BUTTON_PIN[i],INPUT); // Activate internal pull-up digitalWrite(BUTTON_PIN[i],HIGH); gw.present(i, S_DOOR); // present sensor to gateway Serial.print("setup for switch: "); Serial.print(BUTTON_PIN[i]); Serial.println(" complete" ); Alarm.timerRepeat(720, updateState); // update relay status every 2 hrs Alarm.delay(250); } Serial.println("Setup complete" ); } // Check if digital input has changed and send in new value void loop() { gw.process(); for (int i = 0; i < noReeds; i++){ debouncer[i].update(); // Get the update value int value = debouncer[i].read(); if (value != reedState[i]) { // Send in the new value gw.send(msg[i].set(value==HIGH ? 1 : 0), false); reedState[i] = value; Serial.print("updating state for swicth: "); Serial.print(BUTTON_PIN[i]); Serial.print(" state: "); Serial.println(reedState[i]); } } } void updateState(){ Serial.println("Start state info"); for (int i = 0; i < noReeds; i++) { Serial.print("sending update for switch: "); Serial.println(BUTTON_PIN[i]); gw.present(i, S_DOOR); Alarm.delay(250); //MyMessage msg(relayPin[pin],V_LIGHT); gw.send(msg[i].set(reedState[i]), false); // Send last state from eprom to GW Alarm.delay(250); } } // This is called when a new time value was received void receiveTime(unsigned long time) { setTime(time); }``` -
Motion & Relay Sensor issueYou should check if the value changed and only send updates when true. Something like this.
if (lastTripped != tripped ) { -
Interfacing nasty stuff with MySensorsThat usb housing is pretty sweet. A nice shell for a PIR and Temp sensors.
-
Data collectionYou may look at the node js controller. It has database support. https://github.com/mysensors/Arduino/tree/master/NodeJsController Also check out the controller section of the form. http://forum.mysensors.org/category/3/controllers
-
Can't tell if time is set with TimeAwareSensor SketchThanks, changing type from 4 to 1 fixed it.
-
Can't tell if time is set with TimeAwareSensor SketchI am running the TimeAwareSensor.ino sketch and I can't tell if the time ever gets set. I added a couple of serial print lines to the receiveTime function and they never get logged to my serial monitor. Also, timeReceived never gets set to true.
// Example sketch showing how to request time from controller. // Created by Henrik Ekblad <henrik.ekblad@mysensors.org> #include <SPI.h> #include <MySensor.h> #include <Time.h> MySensor gw; boolean timeReceived = false; unsigned long lastUpdate=0, lastRequest=0; void setup() { gw.begin(); // Send the sketch version information to the gateway and Controller gw.sendSketchInfo("Clock", "1.0"); // Request time from controller. gw.requestTime(receiveTime); } // This is called when a new time value was received void receiveTime(unsigned long time) { // Ok, set incoming time Serial.print("Got Time"); Serial.println(time); setTime(time); timeReceived = true; } void loop() { unsigned long now = millis(); gw.process(); // If no time has been received yet, request it every 10 second from controller // When time has been received, request update every hour if ((!timeReceived && now-lastRequest > 20*100) || (timeReceived && now-lastRequest > 60*1000*60)) { // Request time from controller. Serial.println("requesting time"); gw.requestTime(receiveTime); lastRequest = now; } // Print time every second if (timeReceived && now-lastUpdate > 1000) { Serial.print(hour()); printDigits(minute()); printDigits(second()); Serial.print(" "); Serial.print(day()); Serial.print(" "); Serial.print(month()); Serial.print(" "); Serial.print(year()); Serial.println(); lastUpdate = now; } } void printDigits(int digits){ // utility function for digital clock display: prints preceding colon and leading 0 Serial.print(":"); if(digits < 10) Serial.print('0'); Serial.print(digits); }Here is the serial monitor output.
sensor started, id 5 send: 5-5-0-0 s=255,c=0,t=17,pt=0,l=3,st=ok:1.4 send: 5-5-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0 read: 0-0-5 s=255,c=3,t=6,pt=0,l=1:I send: 5-5-0-0 s=255,c=3,t=11,pt=0,l=5,st=ok:Clock send: 5-5-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0 send: 5-5-0-0 s=255,c=3,t=1,pt=0,l=3,st=ok:1.0 requesting time send: 5-5-0-0 s=255,c=3,t=1,pt=0,l=3,st=ok:1.0 read: 0-0-5 s=255,c=3,t=4,pt=0,l=10:1411246677 requesting time send: 5-5-0-0 s=255,c=3,t=1,pt=0,l=10,st=ok:1411246677 read: 0-0-5 s=255,c=3,t=4,pt=0,l=10:1411246679 requesting time send: 5-5-0-0 s=255,c=3,t=1,pt=0,l=10,st=ok:1411246679 read: 0-0-5 s=255,c=3,t=4,pt=0,l=10:1411246681It seems like the sensor starts sending the time back to the controller but timeReceived never gets set to true so the current time is not printed to the serial monitor every second. Any suggestions?
-
Relay Actuator SketchI got hung up today working on a relay sketch. I believe the example in GIT is for a repeater node and not a relay.
// Initialize library and add callback for incoming messages gw.begin(incomingMessage, AUTO, true);Is this really for a relaying node or is it for a sensor that controls a relay?
// Initialize library and add callback for incoming messages gw.begin(incomingMessage, AUTO, false); -
Internal I_REBOOT commandDoes the 1.4 I_REBOOT command rely on having the OTA boot loader installed or can this be used to reboot a sensor node running 1.4 without having the OTA boot loader installed? I would like to reset my sensors on occasion without having to power cycle them. I have tried sending this via my GW but the node seems to ignore it.
11;1;3;0;13;1 -
MySensors 1.4 ReleasedWhat does st=fail represent? Is that stating the ack failed or sending failed? Would this error show up for all messages if debug is enabled on the sensor node and not the gateway.? Maybe this is a non issue? I am trying to confirm if gw.getConfig and gw.requestTime requests are reaching the GW since they don't seem to be set consistently in my environment.
sensor started, id 3 send: 3-3-0-0 s=255,c=0,t=17,pt=0,l=3,st=fail:1.4 send: 3-3-0-0 s=255,c=3,t=6,pt=1,l=1,st=fail:0 send: 3-3-0-0 s=255,c=3,t=11,pt=0,l=8,st=ok:Humidity send: 3-3-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0 send: 3-3-0-0 s=0,c=0,t=7,pt=0,l=3,st=fail:1.4 send: 3-3-0-0 s=1,c=0,t=6,pt=0,l=3,st=fail:1.4 send: 3-3-0-0 s=1,c=1,t=0,pt=7,l=5,st=fail:25.8 T: 25.80 send: 3-3-0-0 s=0,c=1,t=1,pt=7,l=5,st=fail:50.4 H: 50.40 send: 3-3-0-0 s=1,c=1,t=0,pt=7,l=5,st=fail:25.8 T: 25.80 send: 3-3-0-0 s=0,c=1,t=1,pt=7,l=5,st=fail:50.4 H: 50.40 -
MySensors 1.4 ReleasedIt appears sending "255;255;3;0;4;1\r\n" fixes my issue.
send: 255-255-255-0 s=255,c=3,t=3,pt=0,l=0,st=fail: read: 0-0-255 s=255,c=3,t=4,pt=0,l=1:1 id=1 sensor started, id 1 -
MySensors 1.4 Released@hek After updating, I have tested this via the serial monitor and it seems ok.
send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=fail: read: 0-0-255 s=255,c=3,t=4,pt=0,l=1:1 id=1When I send this string via a (ago) controller, the node sets an id of 0 again. Do you see any issue with this string format?
255;255;3;0;4;1Serial monitor output. Does "l=0:" indicate there was an issue with the payload?
send: 255-255-255-0 s=255,c=3,t=3,pt=0,l=0,st=fail: read: 0-0-255 s=255,c=3,t=4,pt=0,l=0: id=0 -
MySensors 1.4 Released@hek I am having an issue assigning a node ID since the last update. I have cleared the eprom in one of my nodes and I am trying to assign a node id of 1 via the serial monitor on the GW. I am sending "255;255;3;0;4;1" in response to the node ID request of "255;255;3;0;3;".
This is the console log from the node with debug enabled.
send: 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail: read: 0-0-255 s=255,c=3,t=8,pt=1,l=1:0 new parent=0, d=1 req node id send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,st=ok: read: 0-0-255 s=255,c=3,t=4,pt=0,l=1:1 id=49 sensor started, id 49 send: 49-49-0-0 s=255,c=0,t=17,pt=0,l=3,st=ok:1.4 send: 49-49-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0Here is the console log from the GW.
0;0;3;0;14;Gateway startup complete. 255;255;3;0;3; 49;255;0;0;17;1.4 49;255;3;0;6;0What I don't understand is why the node would get assigned ID "49" when I sent "1" as the new node ID. Should the node get an ID of "1" or "49" for the command below?
255;255;3;0;4;1 -
EasyIoT server - Mysensors Raspberry Pi controllerInteresting. Is this project GPL or closed source/commercial?
-
Over the air updates@ToSa I use a Mini-B USB cable between my PRi and my gateway.
-
Over the air updatesOn my RPi, the serial gateway is detected as dev/ttyUSB0.