Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. drock1985
    3. Topics
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Topics created by drock1985

    • drock1985

      MySensors lights not functioning correctly since upgrade to 0.61.1
      Home Assistant • • drock1985  

      6
      0
      Votes
      6
      Posts
      1407
      Views

      pepson

      I have similary problem... https://forum.mysensors.org/topic/9046/mysensors-ethernet-2-2-0-problem-with-control-node-switches Anybody can help me please ?
    • drock1985

      Need help adding MySensors items to sitemap
      OpenHAB • • drock1985  

      2
      0
      Votes
      2
      Posts
      1507
      Views

      marceltrapman

      @drock1985 You may have guessed it by now but this is not the best place to ask how to use OpenHAB(2). I have lots of questions still myself so I can't help you but I am sure you can get your answers on the OpenHAB forum or here: http://docs.openhab.org/configuration/sitemaps.html...
    • drock1985

      Need some help with a Multi-Sensor Node
      My Project • • drock1985  

      2
      1
      Votes
      2
      Posts
      1323
      Views

      mfalkvidd

      @drock1985 the comparison for the tripped check is commented out, so it will send values every time. Uncomment it If that doesn't help, please post the debug output of the node.
    • drock1985

      Need a refresher on presentation and HA
      Home Assistant • • drock1985  

      5
      0
      Votes
      5
      Posts
      1788
      Views

      drock1985

      @martinhjelmare Thanks, i finally got it. I went to the example you have on home-assistant.io and removed the button and added a second actuator. Works like it should now. You are the king! Final code for anyone whom it may help/want it. /* * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * http://www.mysensors.org/build/relay * * *Holiday LED Lights MySensors Module, for MySensors v2.0 * Nothing fancy, just a two actuator (on/off) virtual switch for small * low powred LED strings that normally run from a battery pack. * * */ #define MY_DEBUG #define MY_RADIO_NRF24 #define MY_REPEATER_FEATURE #define MY_NODE_ID 24 // or comment out for auto #include <SPI.h> #include <MySensors.h> #define MULTI_PIN 3 // Pin that Multi-Coloured LED string is connected to #define WHITE_PIN 5 // Pin that White LED string is connected to #define CHILD_ID_MULTI 1 // Child ID for Multi-Coloured LED String #define CHILD_ID_WHITE 2 // Child ID for White LED String #define MULTI_ON 1 #define MULTI_OFF 0 #define WHITE_ON 1 #define WHITE_OFF 0 bool stateMULTI = false; // Place holders for the loop function to register nodes in Home-Assistant bool initialValueSentMULTI = false; bool stateWHITE = false; bool initialValueSentWHITE = false; MyMessage msgMULTI(CHILD_ID_MULTI, V_STATUS); //Presentation of Switch for Multi-Coloured LEDS MyMessage msgWHITE(CHILD_ID_WHITE, V_STATUS); //Presentation of Switch for White LEDS void setup() { // Make sure relays are off when starting up digitalWrite(MULTI_PIN, MULTI_OFF); pinMode(MULTI_PIN, OUTPUT); digitalWrite(WHITE_PIN, WHITE_OFF); pinMode(WHITE_PIN, OUTPUT); } void presentation() { sendSketchInfo("HolidayDeskLights", "1.0"); present(CHILD_ID_MULTI, S_LIGHT); present(CHILD_ID_WHITE, S_LIGHT); } void loop() { if (!initialValueSentMULTI) { Serial.println("Sending initial value"); send(msgMULTI.set(stateMULTI?MULTI_ON:MULTI_OFF)); Serial.println("Requesting initial value from controller"); request(CHILD_ID_MULTI, V_STATUS); wait(2000, C_SET, V_STATUS); } if (!initialValueSentWHITE) { Serial.println("Sending initial value"); send(msgWHITE.set(stateWHITE?WHITE_ON:WHITE_OFF)); Serial.println("Requesting initial value from controller"); request(CHILD_ID_WHITE, V_STATUS); wait(2000, C_SET, V_STATUS); } } void receive(const MyMessage &message) { if (message.isAck()) { Serial.println("This is an ack from gateway"); } if (message.type == V_STATUS && message.sensor == CHILD_ID_MULTI) { if (!initialValueSentMULTI) { Serial.println("Receiving initial value from controller"); initialValueSentMULTI = true; } // Change relay state stateMULTI = (bool)message.getInt(); digitalWrite(MULTI_PIN, stateMULTI?MULTI_ON:MULTI_OFF); send(msgMULTI.set(stateMULTI?MULTI_ON:MULTI_OFF)); } if (message.type == V_STATUS && message.sensor == CHILD_ID_WHITE) { if (!initialValueSentWHITE) { Serial.println("Receiving initial value from controller"); initialValueSentWHITE = true; } // Change relay state stateWHITE = (bool)message.getInt(); digitalWrite(WHITE_PIN, stateWHITE?WHITE_ON:WHITE_OFF); send(msgWHITE.set(stateWHITE?WHITE_ON:WHITE_OFF)); } }
    • drock1985

      Help with Switch/Case/Break statement
      Troubleshooting • • drock1985  

      11
      0
      Votes
      11
      Posts
      2571
      Views

      drock1985

      @tbowmo Thanks for the help. I see now where I was going wrong. I have everything working as expected. The only thing I needed to do was add some special commands to the message statement. For some reason, the relay would not turn off when the water low level was reached; used this below as a counter for now. Thanks again. /** * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * ******************************* * * REVISION HISTORY * Version 1.0 - Henrik Ekblad * * DESCRIPTION * Automated Sump-Pump for De-Humidifier * * PURPOSE: * To automatically when water is at a pre-set level, have small * sump pump engage and empty water until it hits the desired * level. Uses the NewPING Library with Ultrasonic Sensor HC-SR04 * */ // Enable debug prints #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #define MY_NODE_ID 22 //or comment out for automatic // #define MY_REPEATER_FEATURE // Enabled repeater feature for this node #include <SPI.h> #include <MySensors.h> #include <NewPing.h> #define RELAY_PIN 3 // To control the sump pump, define relay pin here. #define TRIGGER_PIN 4 //HC-SR04 Trgger Pin (Transmit) #define ECHO_PIN 5 //HC-SR04 Echo Pin (Receive) #define MAX_DISTANCE 100 //Maximum Distance for Sensor scan (tank depth) no more than 297f int LOW_WATER = 2; // int HIGH_WATER = 20; // int RADIUS = 15; //Radius of cylindrical bucket. Used for Flow calculations int bucketDepth = 30; int waterDepth = 5; unsigned long SEND_VOLUME = 0; // Trigger to send flow values to HA controller unsigned long WATER_VOLUME = 0; // Just a place holder.... unsigned long previousMillis = 0; //Tracks time list last depth report. unsigned long reportMillis = 10000; //How often to do depth report unsigned long manualWait = 20000; //Time for manual pump on action. 20 seconds default (to avoid pump dryout) long unsigned int Distance = 5; long unsigned int oldDepth = 0; //used to track transmission of water level on change only. #define CHILD_ID_RELAY 0 //To allow manual control of the sump pump from HA controller #define CHILD_ID_DEPTH 1 // Used to show water depth. #define CHILD_ID_VOLUME 2 // Sensor to send Water Volume info NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum depth // MySensors Message Initialization MyMessage msgRelay(CHILD_ID_RELAY, V_LIGHT); MyMessage msgDepth(CHILD_ID_DEPTH, V_DISTANCE); MyMessage msgPrefix(CHILD_ID_DEPTH, V_UNIT_PREFIX); //Adds SI unit (CM) for depth measurement. MyMessage msgVolume(CHILD_ID_VOLUME, V_VOLUME); // Water volume info. In Metres cubed unsigned long previousReport = 0; // For tracking report time void setup() { pinMode(RELAY_PIN, OUTPUT); digitalWrite(RELAY_PIN, LOW); send(msgPrefix.set("CM")); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("DeHumidifierSumpPump", "1.0"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID_RELAY, S_LIGHT); present(CHILD_ID_DEPTH, S_DISTANCE); present(CHILD_ID_VOLUME, S_WATER); send(msgPrefix.set("CM")); } void loop() { unsigned long currentMillis = millis(); Distance = sonar.ping_cm(); waterDepth = (bucketDepth - Distance); if (waterDepth >= HIGH_WATER && SEND_VOLUME == 0){ digitalWrite(RELAY_PIN, HIGH); send(msgRelay.set(1)); SEND_VOLUME = 1; } else if ( (waterDepth <= LOW_WATER) && SEND_VOLUME == 1 ) { digitalWrite(RELAY_PIN, LOW); send(msgRelay.set (0)); SEND_VOLUME = 0; } if ( (currentMillis - previousMillis) >= reportMillis) { send(msgDepth.set(Distance)); send(msgPrefix.set("CM")); WATER_VOLUME = ((((sq(RADIUS)) * 3.14) * (waterDepth)) / 1000); send(msgVolume.set(WATER_VOLUME)); previousMillis = currentMillis; } wait(reportMillis); } void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if ((message.type==V_LIGHT) && (waterDepth >= LOW_WATER)) { // Change pump state for 20 seconds. digitalWrite(RELAY_PIN, HIGH); send(msgRelay.set(1)); wait(manualWait); digitalWrite(RELAY_PIN, LOW); send(msgRelay.set(0)); } }
    • drock1985

      Basic question: Light sensors
      Home Assistant • • drock1985  

      3
      0
      Votes
      3
      Posts
      1757
      Views

      drock1985

      @martinhjelmare Thanks martin. I think I got the code handled properly, but i'm getting a compile error. /** * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * ******************************* * * REVISION HISTORY * Version 1.0 - Derrick Rockwell (@Drock1985) * * DESCRIPTION * * */ // Enable debug prints #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #define MY_NODE_ID 21 #define MY_REPEATER_FEATURE //Enables Repeater feature for non-battery powered nodes. #include <SPI.h> #include <MySensors.h> #include <DallasTemperature.h> #include <OneWire.h> #include <BH1750.h> #include <Wire.h> unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds) #define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!) #define COMPARE_TEMP 1 // Send temperature only if changed? 1 = Yes 0 = No #define ONE_WIRE_BUS 4 // Pin where dallase sensor is connected OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature. int lastTemperature = 0; boolean receivedConfig = false; boolean metric = true; #define CHILD_ID_MOTION 1 // Id of the sensor child #define CHILD_ID_TEMP 2 // ID of Temperature Sensor #define CHILD_ID_LUX 3 // ID of Lux Sensor BH1750 lightSensor; // Initialize messages MyMessage msgMotion(CHILD_ID_MOTION, V_TRIPPED); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); MyMessage msgLux(CHILD_ID_LUX, V_LEVEL); //Sets up custom units (this case LUX for Light) MyMessage msgPrefix(CHILD_ID_LUX, V_UNIT_PREFIX); // Sends controller the LUX value instead of % uint16_t lastlux = 0; void setup() { pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input lightSensor.begin(); // Startup up the OneWire library sensors.begin(); // requestTemperatures() will not block current thread sensors.setWaitForConversion(false); send(msgPrefix.set("Lux")); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("LuxMotionTempSensor", "1.0"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID_MOTION, S_MOTION); present(CHILD_ID_TEMP, S_TEMP); present(CHILD_ID_LUX, S_LIGHT_LEVEL); } void loop() { { uint16_t lux = lightSensor.readLightLevel();// Get Lux value Serial.println(lux); if (lux != lastlux) { send(msgLux.set(lux)); send(msgPrefix.set("Lux")); lastlux = lux; }} // Fetch temperatures from Dallas sensors sensors.requestTemperatures(); // Fetch and round temperature to one decimal int temperature = (((sensors.getTempCByIndex(0)) * 10.)) / 10.; #if COMPARE_TEMP == 1 if (lastTemperature != temperature && temperature != -127.00 && temperature != 85.00) { #else if (temperature != -127.00 && temperature != 85.00) { #endif // Send in the new temperature send(msgTemp.set(temperature,1)); // Save new temperatures for next compare lastTemperature = temperature; }} // Read digital motion value boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; // Serial.println(tripped); send(msgMotion(tripped?"1":"0")); // Send tripped value to gw // Sleep until interrupt comes in on motion sensor. Send update every two minute. sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME); } I'll try it again tomorrow. Thank you again for pointing me in the right direction on custom units.
    • drock1985

      {DEV} Multi-Sensor Node goes into boot loop
      Development • • drock1985  

      21
      0
      Votes
      21
      Posts
      5194
      Views

      joachim

      I found out that adding a sleep(10) between 2 consecutive 'send' does help a lot
    • drock1985

      Is it possible to connect an Ethernet Gateway to Node-Red and share it?
      Node-RED • • drock1985  

      2
      0
      Votes
      2
      Posts
      2320
      Views

      mfalkvidd

      Yes it can be done. There are some cases described in the forum. You could start with these https://forum.mysensors.org/topic/1965/nodered-injected-between-domoticz-and-mysensors https://forum.mysensors.org/topic/3150/use-node-red-to-allow-multiple-connections-to-ethernet-gateway/ https://forum.mysensors.org/topic/700/node-red-as-controller/
    • drock1985

      Is it possible to connect a Pro Mini directly to Raspberry Pi GPIO for Gateway?
      Hardware • • drock1985  

      5
      0
      Votes
      5
      Posts
      3215
      Views

      drock1985

      @ToniA Thanks for the info. I tried playing around with it last night and like you mention, unless I invoked root, I could not get the port to work. I'm trying to see if there is another way to do it. Might have to just chmod 775 /dev/ttyAMA0 on boot. I'll try it again later tonight when i'm home. Thanks for the help.
    • drock1985

      Is it possible to delete specific nodes?
      Home Assistant • • drock1985  

      3
      1
      Votes
      3
      Posts
      2294
      Views

      drock1985

      Thanks @danivalencia
    • drock1985

      Does Domoticz Support scene controllers?
      Domoticz • • drock1985  

      7
      0
      Votes
      7
      Posts
      4900
      Views

      alexsh1

      @Nca78 I have not seen your sketch, but assuming you have a standard scene controller sketch, there will be new switches coming up in Domoticz under "Devices" as soon as the connection is made. Say, you have four switches and you can switch them on/off. How do you switch a light in the living room then? One of the ways to do that is to have a Blockly script stating if Switch 1(scene controller) is on, switch on the living room light, if Switch 1 (scene controller) is off, switch off the living room light.
    • drock1985

      Ideas to detect car traffic in a driveway?
      General Discussion • • drock1985  

      10
      1
      Votes
      10
      Posts
      4465
      Views

      drock1985

      @mfalkvidd Thanks. That explains it all pretty perfectly.
    • drock1985

      Need some help on how to burn a sketch with SlimNode and 1MHz Bootloader
      Troubleshooting • • drock1985  

      12
      0
      Votes
      12
      Posts
      2617
      Views

      drock1985

      Hi @GertSanders Thanks for the help. Finally had some time yesterday to mess around and started fresh with the .zip you included. Works like a dream now. I had to disable BOD to flash @ 1MHz; but it works flawlessly. Thank you so much again.
    • drock1985

      Is it possible to turn 5v pro mini into unregulated for low power use?
      Troubleshooting • pro mini low power regulator • • drock1985  

      4
      0
      Votes
      4
      Posts
      1764
      Views

      drock1985

      @mfalkvidd
    • drock1985

      Is it possible to run more than one pin to an interrupt for sleep/wake purposes?
      Troubleshooting • • drock1985  

      55
      0
      Votes
      55
      Posts
      14192
      Views

      AWI

      @karl261 it looks good to me. Try to get your connections stable.
    • drock1985

      Need a little help to set up a switch initially
      Home Assistant • • drock1985  

      18
      0
      Votes
      18
      Posts
      5682
      Views

      martinhjelmare

      @drock1985
    • drock1985

      Why can't I assign a static NODE_ID in one sketch; but not the other?
      Troubleshooting • • drock1985  

      7
      0
      Votes
      7
      Posts
      1916
      Views

      mfalkvidd

      In your first sketch, the node accepts incoming messages. The second sketch does not have a function for incoming messages, so you have no function to give gw.begin as argument. You tried giving ge.begin a message instead, but that's not what gw.begin expects so you got a warning. When you don't want to use incoming messages you simply give NULL to gw.begin, as ericvdb suggested.
    • drock1985

      REQUEST: Tutorial/Step-by-step to install MySys bootloader
      Troubleshooting • • drock1985  

      6
      1
      Votes
      6
      Posts
      3144
      Views

      niccodemi

      @drock1985 once you flashed node with mysbootloader you cannot use Arduino IDE to upload sketches anymore. You have to do it via Myscontroller app (OTA).
    • drock1985

      Need some minor help with MQTT strings
      Troubleshooting • mqtt relay home-assistant mosquitto binary • • drock1985  

      6
      0
      Votes
      6
      Posts
      3547
      Views

      jkandasa

      @drock1985 I guess your switch string should be as follows, #Switches (Lights) switch 1: platform: mqtt state_topic: "mygateway1-out/2/1/1/0/2" command_topic: "mygateway1-in/2/1/1/0/2" name: "test1" payload_on: "1" payload_off: "0"
    • drock1985

      Help with 2 LED Dimmer Sketch. Can't compile, not sure why exactly
      Development • • drock1985  

      5
      0
      Votes
      5
      Posts
      2231
      Views

      drock1985

      Ok, figured out and it's my stupid. Didn't put the second LED on a PWM pin, therefore, no modulation!
    • drock1985

      MySensors and Arduino IDE is not mixing anymore....
      Troubleshooting • • drock1985  

      3
      0
      Votes
      3
      Posts
      965
      Views

      drock1985

      Ahh, that's what it was. Stupid me. Thanks again!
    • drock1985

      {QUESTION} Battery Sensor example
      Hardware • arduino nano battery monitor voltage divider • • drock1985  

      3
      0
      Votes
      3
      Posts
      1658
      Views

      m26872

      @drock1985 Maybe some hints here.
    • drock1985

      REQUEST: Anyone have a sketch for temp/humidity logging?
      Development • • drock1985  

      10
      0
      Votes
      10
      Posts
      3159
      Views

      hek

      IMHO, DHT sensors isn't exactly famous for being accurate.
    • drock1985

      Can't get switch closed signal due to length of wire - anyway to compensate?
      Troubleshooting • • drock1985  

      7
      0
      Votes
      7
      Posts
      1912
      Views

      drock1985

      @Dirk_H Hi, Thanks for all your help. I got it to work using an external pull-up resistor. I did a check on all my wiring just to make sure all was ok, and it was. The one thing I did get was a resistance on my front doorbell on what I thought was an open circuit; then I realized there was a lamp in the button. This video helped explain why it works, in a way that I understand at least. https://youtu.be/wxjerCHCEMg Thanks again @Dirk_H
    • drock1985

      How To: 2 Door Chime Automation Hack (Thanks @petewill)
      My Project • • drock1985  

      9
      3
      Votes
      9
      Posts
      9763
      Views

      drock1985

      Update 17-July-2016 Sensor v2.2 MySensors 2.0 Update I have updated the code in the latest post for the release of MySensors 2.0! Not much has changed, just the calls. All of the same functionality is kept. Since MySensors 2.0 does not include any external libraries, you will need to manually add the debounce 2 library to your Arduino IDE/MySensors2 setup. The official GitHub repo is located here. Install it the same as any Arduino Library. Any comments or questions please ask. V2.2 Sketch: /* * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * ******************************* * * REVISION HISTORY * Version 2.2 - Removed MySensors 1.5 code and replaced with MySensors 2.0 * Version 2.1 - Derrick Rockwell (Drock1985) * - Complete Re-write of code to provide better flow/structure. * Version 2.0 - ResentedPoet * * Based on original concept/code by @petewill for 1 Door bell chime. See original thread * http://forum.mysensors.org/topic/2064/how-to-doorbell-automation-hack * This sketch is used to control a front and back doorbell ring with relays as well as send an * alert when the buttons are pressed. For front door, Connect the button to ground and digital * pin 3. The relay controlling the doorbell is conntected to pin 4. For rear door bell * connect second button to ground and digital pin 5. The relay controlling that pin goes * to pin 6. */ // Enable debug prints // #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #define MY_NODE_ID 2 //or use AUTO to have your home controller assign it for you. #define MY_REPEATER_FEATURE // Enabled repeater feature for this node. Comment out if you do not want repeater function #include <MySensors.h> #include <SPI.h> #include <Bounce2.h> #define FRONT_DOOR_BUTTON 3 // Arduino Digital I/O pin number for the front doorbell button #define FRONT_CHIME_RELAY 4 // Aduino Digital I/O pin number for the front door chime relay #define CHILD_ID_FRONT 0 // Child ID for the front doorbell sensor #define BACK_DOOR_BUTTON 5 // Arduino Digital I/O pin number for the back doorbell button #define BACK_CHIME_RELAY 6 // Aduino Digital I/O pin number for the back door chime relay #define CHILD_ID_BACK 1 // Child ID for the back doorbell sensor #define CHILD_ID_MUTE 2 // Child ID for the mute option #define CHIME_MUTE_STATE // Used to hold value of door chime mute funtion. #define CHIME_OFF 0 // Variable to define ring the chime #define CHIME_ON 1 #define FRONT_CHIME_RELAY_ON LOW // Variable for front chime. Reverse low/high if relay pin set different #define FRONT_CHIME_RELAY_OFF HIGH // Variable for front chime. Reverse low/high if relay pin set different #define BACK_CHIME_RELAY_ON LOW // Variable for front chime. Reverse low/high if relay pin set different #define BACK_CHIME_RELAY_OFF HIGH // Variable for front chime. Reverse low/high if relay pin set different Bounce debouncerF = Bounce(); Bounce debouncerB = Bounce(); boolean CHIME_MUTE = 1; MyMessage msg(CHILD_ID_MUTE, CHIME_MUTE); MyMessage frontDoorbell(CHILD_ID_FRONT, V_TRIPPED); MyMessage backDoorbell(CHILD_ID_BACK, V_TRIPPED); MyMessage chimeMute(CHILD_ID_MUTE, V_LIGHT); int pestTimeout = 4000; // Delay between registered button presses. Stops button mashers ;) Set to whatever delay you want. unsigned long previousMillis=0; // Tracks time since last door chime button press void setup() { // Setup the button and activate internal pull-up pinMode(FRONT_DOOR_BUTTON, INPUT); pinMode(BACK_DOOR_BUTTON, INPUT); digitalWrite(FRONT_DOOR_BUTTON, HIGH); digitalWrite(BACK_DOOR_BUTTON, HIGH); // After setting up the button, setup debouncer debouncerF.attach(FRONT_DOOR_BUTTON); debouncerB.attach(BACK_DOOR_BUTTON); debouncerF.interval(5); debouncerB.interval(5); // Make sure relays are off when starting up digitalWrite(FRONT_CHIME_RELAY, FRONT_CHIME_RELAY_OFF); digitalWrite(BACK_CHIME_RELAY, BACK_CHIME_RELAY_OFF); // Then set relay pins in output mode pinMode(FRONT_CHIME_RELAY, OUTPUT); pinMode(BACK_CHIME_RELAY, OUTPUT); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("2 Door Chime Sensor", "2.2"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID_FRONT, S_MOTION); present(CHILD_ID_BACK, S_MOTION); present(CHILD_ID_MUTE, S_LIGHT); send(chimeMute.set(1)); } void loop() { unsigned long currentMillis = millis(); debouncerF.update(); debouncerB.update(); int valueF = debouncerF.read(); int valueB = debouncerB.read(); //Front Doorbell if ( ((unsigned long)(currentMillis - previousMillis) >= pestTimeout) && valueF != HIGH && CHIME_MUTE == 1) { digitalWrite(FRONT_CHIME_RELAY, FRONT_CHIME_RELAY_ON); send(frontDoorbell.set(1)); wait(50); digitalWrite(FRONT_CHIME_RELAY, FRONT_CHIME_RELAY_OFF); send(frontDoorbell.set(0)); previousMillis = currentMillis; } if ( ((unsigned long)(currentMillis - previousMillis) >= pestTimeout) && valueF != HIGH && CHIME_MUTE == 0) { send(frontDoorbell.set(1)); wait(50);; send(frontDoorbell.set(0)); previousMillis = currentMillis; } //Back Doorbell if ( ((unsigned long)(currentMillis - previousMillis) >= pestTimeout) && valueB != HIGH && CHIME_MUTE == 1) { digitalWrite(BACK_CHIME_RELAY, BACK_CHIME_RELAY_ON); send(backDoorbell.set(1)); wait(450); digitalWrite(BACK_CHIME_RELAY, BACK_CHIME_RELAY_OFF); send(backDoorbell.set(0)); previousMillis = currentMillis; } if ( ((unsigned long)(currentMillis - previousMillis) >= pestTimeout) && valueB != HIGH && CHIME_MUTE == 0) { send(backDoorbell.set(1)); wait(50); send(backDoorbell.set(0)); previousMillis = currentMillis; } } void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.isAck()) { Serial.println("This is an ack from gateway"); } if (message.type == V_LIGHT) { // Change relay state CHIME_MUTE = message.getBool(); send(msg.set(CHILD_ID_MUTE, CHIME_MUTE?CHIME_ON:CHIME_OFF)); // Store state in eeprom saveState(CHILD_ID_MUTE, CHIME_MUTE); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } }
    • drock1985

      Looking for a 12-24v DC to 5vDC converter
      Hardware • • drock1985  

      13
      0
      Votes
      13
      Posts
      2844
      Views

      TRS-80

      @monte said in Looking for a 12-24v DC to 5vDC converter: don't expect 3A from those exact small modules No, I don't need it. Only a little bit (far less than 1A) for the uC + radio. In this case I am just looking to power the uC off the same power supply as LEDs which have already reduced the mains down to 24VDC. I just thought it would be silly to have yet another power supply for the uC (coming from mains I mean), in addition to the one that's already there for the LEDs. So I plan to "piggy back" off that one, getting the 24VDC down finally to the 5VDC or whatever is needed for the uC + radio. But it is very nice to have such a wide range of inputs (and adjustable output!) available, for as yet unknown future projects / needs. Especially when finding nice and inexpensive module like this, and order some 10s of them from China and just keep them on hand!
    • drock1985

      Is there anyway to have Ethernet Gateway set to DHCP for IP address?
      Troubleshooting • • drock1985  

      13
      0
      Votes
      13
      Posts
      5797
      Views

      drock1985

      Back up and running temporarily when Arduino uno and serial gateway. Looking forward to the update for DHCP.
    • drock1985

      Future PIR Enclosure or existing PIR modification, not sure yet :)
      Enclosures / 3D Printing • • drock1985  

      1
      1
      Votes
      1
      Posts
      2473
      Views

      No one has replied

    • drock1985

      Error setting up Ethernet gateway. Radio won't initialize
      Troubleshooting • • drock1985  

      4
      0
      Votes
      4
      Posts
      1793
      Views

      drock1985

      Well, some more good news. I have the Ethernet gateway connected to OpenHab2, and it's reading my temperature sensor perfectly and registering it in OpenHab after auto discovery! It also registered the humidity sensor, but it's not updating that for some reason. WooHoo! getting there slowly (but surely).
    • drock1985

      Is it possible to build a Serial Gateway for Domoticz using Nano and ESP8266 module?
      Troubleshooting • • drock1985  

      9
      0
      Votes
      9
      Posts
      4463
      Views

      drock1985

      @Moshe-Livne said: @drock1985 if you got it from the link on the store (A+A+A+ or some other funny name) they actually send very quickly. I got mine within a week. But mail from China moves in mysterious ways.... Remember: Patience comes for those who wait! Lol, that's what people always tell me. But how does one with no patience first wait to learn the value of patience And thanks for the hope at the end of the tunnel, I did go through the links here on the site, crossing fingers