@johnr great idea! i have spent a few days considering this myself. Have you put any thought in to how it will be integrated to the socket? My concern is that I'd like to re-use the existing mechanical buttons in the house, connecting the arduino as a multi-way connection (swedish: trapp-koppling) to be able to use both mechanical buttons and non-mechanical. For existing multi-way connections I was thinking of adding the arduino as a "cross" (Swedish: korskoppling) in between to facilitate that but that would require two relays
viking
@viking
Best posts made by viking
Latest posts made by viking
-
RE: Relay for PCB relay node
-
RE: Custom Interrupt routine for door sensor
I built a trip wire for the post box that I'm connecting. It's however based on a mercury tilt sensor so I'm really not sure whether I think it's a great idea putting it to use (at least not with a sturdy case...). However, I can share my code:
#define DIGITAL_INPUT_SENSOR 2 // 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)MyMessage msgTripped(CHILD_ID_TRIPPED, V_TRIPPED);
void setup()
{
gw.sendSketchInfo("Postal", "1.0");
gw.present(CHILD_ID_TRIPPED, S_MOTION);pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input
}void loop()
{
boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == LOW;if(tripped) {
gw.send(msgTripped.set("1")); // Send tripped value to gw
}gw.sleep(INTERRUPT,FALLING, SLEEP_TIME);
} -
Self-configuring based on mqtt - considering building if it doesn't exist?
I'm gave a set of pro mini's and some radios to my father in law for Christmas, as a DYI present. He's an electrician and has great skills in that area however not on the software side. I use OpenHab but it's quite tedious to configure even if you're well versed in Linux and programming.
But since the sensors present themselves to the mqtt broker and I can listen in, shouldn't it be fairly easy to build a self-configuring controller based on the nodes? Simply pick out the sensor details and process the UI. At least listening would be fairly simple. It would be even better if this was integrated in to OpenHab or similar. I guess I can write a perl script to generate sitemap, rules and items but that feels like the "wrong" way around.
Any pointers?
-
RE: MQTT Broker gateway
Thanks for the mqtt broker. Just a tip to people who might fall in to the same pit as I:
The mqtt broker gateway doesn't distribute node ids unless you're connected to it using a mqtt client. I.e. if you did what I did, installed the gateway and wanted to test that the sensors found the gateway and was distributing the code then it doesn't work until you've connected to it. I had to go through the source code to figure it out.
If you don't have openhab or simply want to test, this is what I did on my raspberry (but should work similarly on others)
// install mosquitto client
sudo apt-get install mosquitto-clients// Start the client, replace the 10.0.0.200 with your ip. The port will default to 1883
mosquitto_sub -h 10.0.0.200 -d -t hello/world -v
You should be able to see messages:
Received PUBLISH (d0, q0, r0, m0, 'MyMQTT/20/0/V_LIGHT_LEVEL', ... (2 bytes))