Damn; I think I may have just fixed it. Changed USB ports......
Posts made by drock1985
-
RE: MySensors lights not functioning correctly since upgrade to 0.61.1
-
RE: MySensors lights not functioning correctly since upgrade to 0.61.1
Is there any logs I can look through to find a solution?
-
RE: MySensors lights not functioning correctly since upgrade to 0.61.1
@martinhjelmare Hi,
The last version that worked correctly was 0.60.1; no issues at all. All other actuators seem to work fine too (Hue, ESP8266, Wemo, etc)
-
MySensors lights not functioning correctly since upgrade to 0.61.1
Hi,
I've been using MySensors for a while now in their present hardware/software configuration with no problems running lights (relays), temp sensors, etc up until recently. I upgrade my HASS.IO install of home-assistant to 0.61.1 and ever since then I have not been able to get any of my light actuators to respond to commands from the UI. I do not know what is going on; and having not changed anything I do not think it's on my end. Was wondering what it could be? I connect to MySensors using a USB-Serial gateway.
Thanks
-
RE: How to build an overridable MySensors relay based device (e.g. lamp with manual switch)
I know this may sound weird, but I would recommend just going with the basic Sonoff switch and skip the MySensors part.
I build a lamp controlled by MySensors a long time ago, has external Tact button for on/off. Works great, took a while to build and I have an ugly box screwed to my lamp now that houses it all.
I wanted to build another, but didn't want it be be aesthetically displeasing. I ended up using these (https://www.itead.cc/sonoff-wifi-wireless-switch.html) and they are everything in one small package. You have wifi, a tact button for manual on/off, and it will report to any home automation system using MQTT after flashing some customer firmware (https://github.com/arendst/Sonoff-Tasmota). Just cut the power cable, screw into appropriate terminals and it's all good to go.
As much as I love MySensors; for this type of project I think there is a better solution.
-
Need help adding MySensors items to sitemap
Hi,
I'm new to OpenHab2, and have a rather newbie question.
I have OpenHab2 installed on my Raspberry Pi 2 with the MySensors plug-in installed and working with an Wifi-Gateway. I can add devices easily using discovery, and have gotten things like relays and temperature to show in the Paper UI easily. I'm not trying to work on creating the .sitemap and .item files in Notepad so I can build the UI the way I want for the iOS app. I'm stuck now on trying to get any data taht displays form text or number in the Basic UI part. Ex. I have a temperature and barometic pressure sensor that works fine in PaperUI, but not when I try to add it manually to the Basic UI.
Here is my weather.items and default.sitemap file
Number temp_living "Living Room Temperature [%.1f]" <temperature> { mysensors:temperature:ca1e2cbb:Temperature_5_1:temp } Number baro_living "Living Room Pressure [%.1f]" <temperature> { mysensors:baro:ca1e2cbb:Baro_5_0:pressure } Number upstairs_humidity "Upstairs Humidity [%.1f %%]" <temperature> { mysensors:humidity:ca1e2cbb:Humidity_1_0:hum } Number upstairs_temp "Upstairs Temperature [%.1f °C]" <temperature> { mysensors:temperature:ca1e2cbb:Temperature_1_1:temp }
default.sitemap
sitemap default label="My first sitemap" { Switch item=light_mancave_1 label="Man Cave Lamp 1" Switch item=light_mancave_2 label="Man Cave Lamp 2" Text item=temp_living Text item=baro_living Switch item=NestSmoke_is_online label="Nest Online?" }
Thanks,
-
Need some help with a Multi-Sensor Node
Hi,
I'm working on making a multi-sensornode (PIR, Light, Temp and V_LIGHT (for night-light)), as well as a repeater node. So far though, I am having problems with the system reporting all the variables every second, instead of on change/every 10 seconds like I have in my sketch. I'm not sure where I am going wrong,. I need the device to only report changes, specifically on motion when it is detected, as well as to receive the V_STATUS message. Would someone please look over this and point me in the right direction? I've been looking at this off and on for a while now and I can't find anything that is majorly wrong.
/** * 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 #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 #define LED_ARRAY_1 5 // Pin that controls the LED Light array (does not need to be a PWM pin) #define LED_ARRAY_2 6 #define MAX_ATTACHED_DS18B20 2 // #define MY_REPEATER_FEATURE //Enables Repeater feature for non-battery powered nodes. 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; int numSensors=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 #define CHILD_ID_LIGHT 4 // ID of LED light array #define LIGHT_ON 1 #define LIGHT_OFF 0 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 % MyMessage msgLight(CHILD_ID_LIGHT, V_STATUS); uint16_t lastlux = 0; int compareMotion = LOW; bool stateLight = 0; // Place holders for the loop function to register nodes in Home-Assistant bool initialValueSentLight = 0; void setup() { pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input pinMode(LED_ARRAY_1, OUTPUT); // sets the LED Array as an output pinMode(LED_ARRAY_2, OUTPUT); // sets the LED Array as an output 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); wait(150); present(CHILD_ID_TEMP, S_TEMP); wait(150); present(CHILD_ID_LUX, S_LIGHT_LEVEL); wait(150); present(CHILD_ID_LIGHT, S_LIGHT); } void loop() { if (!initialValueSentLight) { Serial.println("Sending initial value"); send(msgLight.set(stateLight?LIGHT_ON:LIGHT_OFF)); Serial.println("Requesting initial value from controller"); request(CHILD_ID_LIGHT, V_STATUS); wait(2000, C_SET, V_STATUS); } { uint16_t lux = lightSensor.readLightLevel();// Get Lux value if (lux != lastlux) { Serial.println(lux); Serial.println("Sending lux value"); 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 (lastTemperature != temperature && temperature != -127.00 && temperature != 85.00) Serial.println(temperature); Serial.println("Sending temperature");{ // Send in the new temperature send(msgTemp.set(temperature)); // Save new temperatures for next compare lastTemperature = temperature; } // Read digital motion value boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; // if (compareMotion != tripped) { Serial.println("Sending motion status"); Serial.println(tripped); send(msgMotion.set(tripped?"1":"0")); // Send tripped value to gw // compareMotion = tripped; // } // sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME); } 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_LIGHT) { if (!initialValueSentLight) { Serial.println("Receiving initial value from controller"); initialValueSentLight = true; } // Change relay state stateLight = (bool)message.getInt(); digitalWrite(LED_ARRAY_1, stateLight?LIGHT_ON:LIGHT_OFF); digitalWrite(LED_ARRAY_2, stateLight?LIGHT_ON:LIGHT_OFF); send(msgLight.set(stateLight?LIGHT_ON:LIGHT_OFF)); } }
Thanks,
-
RE: Need a refresher on presentation and HA
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)); } }
-
RE: Need a refresher on presentation and HA
I added a wait into the presentation, and that got rid of the fail message. Now I am trying to send the initial value (so that HA will register it) and it does not seem to be working. I also added the sending of the status in the receive message, here is an updated sketch and my debug log. What could I be missing?
Thanks again!
Starting repeater (RNNRA-, 2.0.0) TSM:INIT TSM:RADIO:OK TSP:ASSIGNID:OK (ID=24) TSM:FPAR TSP:MSG:SEND 24-24-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSM:FPAR TSP:MSG:SEND 24-24-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSP:MSG:READ 4-4-24 s=255,c=3,t=8,pt=1,l=1,sg=0:1 TSP:MSG:FPAR RES (ID=4, dist=1) TSP:MSG:PAR OK (ID=4, dist=2) TSP:MSG:READ 0-0-24 s=255,c=3,t=8,pt=1,l=1,sg=0:0 TSP:MSG:FPAR RES (ID=0, dist=0) TSP:MSG:PAR OK (ID=0, dist=1) TSP:MSG:READ 2-2-24 s=255,c=3,t=8,pt=1,l=1,sg=0:1 TSP:MSG:FPAR RES (ID=2, dist=1) TSM:FPAR:OK TSM:ID TSM:CHKID:OK (ID=24) TSM:UPL TSP:PING:SEND (dest=0) TSP:MSG:SEND 24-24-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1 TSP:MSG:READ 0-0-24 s=255,c=3,t=25,pt=1,l=1,sg=0:1 TSP:MSG:PONG RECV (hops=1) TSP:CHKUPL:OK TSM:UPL:OK TSM:READY TSP:MSG:SEND 24-24-0-0 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100 TSP:MSG:SEND 24-24-0-0 s=255,c=0,t=18,pt=0,l=5,sg=0,ft=0,st=ok:2.0.0 TSP:MSG:SEND 24-24-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=ok:0 TSP:MSG:READ 0-0-24 s=255,c=3,t=15,pt=6,l=2,sg=0:0100 TSP:MSG:READ 0-0-24 s=255,c=3,t=6,pt=0,l=1,sg=0:M TSP:MSG:SEND 24-24-0-0 s=255,c=3,t=11,pt=0,l=18,sg=0,ft=0,st=ok:Holiday Desk Light TSP:MSG:SEND 24-24-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=ok:1.0 TSP:MSG:SEND 24-24-0-0 s=1,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=ok: TSP:MSG:SEND 24-24-0-0 s=2,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=ok: NODE:!REG NODE:!REG Request registration... TSP:MSG:SEND 24-24-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=ok:2 TSP:MSG:READ 0-0-24 s=255,c=3,t=27,pt=1,l=1,sg=0:1 Node registration=1 Init complete, id=24, parent=0, distance=1, registration=1 TSP:SANCHK:OK TSP:MSG:READ 1-1-255 s=255,c=3,t=7,pt=0,l=0,sg=0: TSP:MSG:BC TSP:MSG:FPAR REQ (sender=1) TSP:PING:SEND (dest=0) TSP:MSG:SEND 24-24-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1 TSP:MSG:READ 0-0-24 s=255,c=3,t=25,pt=1,l=1,sg=0:1 TSP:MSG:PONG RECV (hops=1) TSP:CHKUPL:OK TSP:MSG:GWL OK TSP:MSG:SEND 24-24-1-1 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=ok:1 TSP:SANCHK:OK
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 1.0 - Henrik Ekblad * * DESCRIPTION * Example sketch showing how to control physical relays. * This example will remember relay state after power failure. * http://www.mysensors.org/build/relay */ // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 // Enable repeater functionality for this node #define MY_REPEATER_FEATURE #include <SPI.h> #include <MySensors.h> #define LIGHTS_MULTI 3 #define LIGHTS_WHITE 5 #define CHILD_ID_MULTI 1 #define CHILD_ID_WHITE 2 #define LIGHTS_MULTI_ON 1 // GPIO value to write to turn on attached relay #define LIGHTS_MULTI_OFF 0 // GPIO value to write to turn off attached relay #define LIGHTS_WHITE_ON 1 // GPIO value to write to turn on attached relay #define LIGHTS_WHITE_OFF 0 // GPIO value to write to turn off attached relay MyMessage msgMULTI(CHILD_ID_MULTI, V_LIGHT); MyMessage msgWHITE(CHILD_ID_WHITE, V_LIGHT); void before() { // Then set relay pins in output mode pinMode(LIGHTS_MULTI, OUTPUT); pinMode(LIGHTS_WHITE, OUTPUT); // Set relay to last known state (using eeprom storage) digitalWrite(LIGHTS_MULTI, loadState(CHILD_ID_MULTI)?LIGHTS_MULTI_ON:LIGHTS_MULTI_OFF); digitalWrite(LIGHTS_WHITE, loadState(CHILD_ID_WHITE)?LIGHTS_WHITE_ON:LIGHTS_WHITE_OFF); } void setup() { // present(255, 18); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Holiday Desk Light", "1.0"); present(CHILD_ID_MULTI, S_LIGHT); wait(150); present(CHILD_ID_WHITE, S_LIGHT); wait(150); send(msgMULTI.set(1)); wait(150); send(msgWHITE.set(1)); } void loop() { } void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.type==V_LIGHT && message.sensor == CHILD_ID_MULTI) { // Change relay state digitalWrite(LIGHTS_MULTI, message.getBool()?LIGHTS_MULTI_ON:LIGHTS_MULTI_OFF); send(msgMULTI, message.getBool()?LIGHTS_MULTI_ON:LIGHTS_MULTI_OFF); // Store state in eeprom saveState(message.sensor, message.getBool()); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } if (message.type==V_LIGHT && message.sensor == CHILD_ID_WHITE) { // Change relay state digitalWrite(LIGHTS_WHITE, message.getBool()?LIGHTS_WHITE_ON:LIGHTS_WHITE_OFF); send(msgWHITE, message.getBool()?LIGHTS_WHITE_ON:LIGHTS_WHITE_OFF); // Store state in eeprom saveState(message.sensor, message.getBool()); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } }
-
Need a refresher on presentation and HA
Hi,
I took a bit of a hiatus from this site/Arduino and now can't for the life of me debug a presentation on a node with two LED lights.
Here is the errors I am getting during presentation:
Starting repeater (RNNRA-, 2.0.0) TSM:INIT TSM:RADIO:OK TSP:ASSIGNID:OK (ID=24) TSM:FPAR TSP:MSG:SEND 24-24-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSP:MSG:READ 4-4-24 s=255,c=3,t=8,pt=1,l=1,sg=0:1 TSP:MSG:FPAR RES (ID=4, dist=1) TSP:MSG:PAR OK (ID=4, dist=2) TSP:MSG:READ 0-0-24 s=255,c=3,t=8,pt=1,l=1,sg=0:0 TSP:MSG:FPAR RES (ID=0, dist=0) TSP:MSG:PAR OK (ID=0, dist=1) TSP:MSG:READ 2-2-24 s=255,c=3,t=8,pt=1,l=1,sg=0:1 TSP:MSG:FPAR RES (ID=2, dist=1) TSM:FPAR:OK TSM:ID TSM:CHKID:OK (ID=24) TSM:UPL TSP:PING:SEND (dest=0) TSP:MSG:SEND 24-24-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1 TSP:MSG:READ 0-0-24 s=255,c=3,t=25,pt=1,l=1,sg=0:1 TSP:MSG:PONG RECV (hops=1) TSP:CHKUPL:OK TSM:UPL:OK TSM:READY TSP:MSG:SEND 24-24-0-0 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100 TSP:MSG:SEND 24-24-0-0 s=255,c=0,t=18,pt=0,l=5,sg=0,ft=0,st=ok:2.0.0 TSP:MSG:SEND 24-24-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=ok:0 TSP:MSG:READ 0-0-24 s=255,c=3,t=15,pt=6,l=2,sg=0:0100 TSP:MSG:READ 0-0-24 s=255,c=3,t=6,pt=0,l=1,sg=0:M TSP:MSG:SEND 24-24-0-0 s=255,c=3,t=11,pt=0,l=18,sg=0,ft=0,st=ok:Holiday Desk Light TSP:MSG:SEND 24-24-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=ok:1.0 TSP:MSG:SEND 24-24-0-0 s=1,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=ok: !TSP:MSG:SEND 24-24-0-0 s=2,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=fail: NODE:!REG NODE:!REG Request registration... TSP:MSG:SEND 24-24-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=1,st=ok:2 TSP:MSG:READ 0-0-24 s=255,c=3,t=27,pt=1,l=1,sg=0:1 Node registration=1 Init complete, id=24, parent=0, distance=1, registration=1
and here is my 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 1.0 - Henrik Ekblad * * DESCRIPTION * Example sketch showing how to control physical relays. * This example will remember relay state after power failure. * http://www.mysensors.org/build/relay */ // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 // Enable repeater functionality for this node #define MY_REPEATER_FEATURE #include <SPI.h> #include <MySensors.h> #define LIGHTS_MULTI 3 #define LIGHTS_WHITE 5 #define CHILD_ID_MULTI 1 #define CHILD_ID_WHITE 2 #define LIGHTS_MULTI_ON 1 // GPIO value to write to turn on attached relay #define LIGHTS_MULTI_OFF 0 // GPIO value to write to turn off attached relay #define LIGHTS_WHITE_ON 1 // GPIO value to write to turn on attached relay #define LIGHTS_WHITE_OFF 0 // GPIO value to write to turn off attached relay MyMessage msgMULTI(CHILD_ID_MULTI, V_LIGHT); MyMessage msgWHITE(CHILD_ID_WHITE, V_LIGHT); void before() { // Then set relay pins in output mode pinMode(LIGHTS_MULTI, OUTPUT); pinMode(LIGHTS_WHITE, OUTPUT); // Set relay to last known state (using eeprom storage) digitalWrite(LIGHTS_MULTI, loadState(1)?LIGHTS_MULTI_ON:LIGHTS_MULTI_OFF); digitalWrite(LIGHTS_WHITE, loadState(2)?LIGHTS_WHITE_ON:LIGHTS_WHITE_OFF); } void setup() { // present(255, 18); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Holiday Desk Light", "1.0"); present(CHILD_ID_MULTI, S_LIGHT); present(CHILD_ID_WHITE, S_LIGHT); send(msgMULTI.set(1)); send(msgWHITE.set(1)); } void loop() { } void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.type==V_LIGHT && message.sensor == CHILD_ID_MULTI) { // Change relay state digitalWrite(LIGHTS_MULTI, message.getBool()?LIGHTS_MULTI_ON:LIGHTS_MULTI_OFF); // Store state in eeprom saveState(message.sensor, message.getBool()); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } if (message.type==V_LIGHT && message.sensor == CHILD_ID_WHITE) { // Change relay state digitalWrite(LIGHTS_WHITE, message.getBool()?LIGHTS_WHITE_ON:LIGHTS_WHITE_OFF); // Store state in eeprom saveState(message.sensor, message.getBool()); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } }
Anyone help a born-again newb? :{
Thanks
-
RE: 💬 MySensors Stable Node V2
Loving the addons.
Would it be possible to add an optional hole mount and amplifier to make this the equivalent of the PA+LNA version?
-
RE: Alternative to ArduinoIDE
This is a good thread; been recently contemplating changing IDE's myself.
Visual Studio seems to be the most complete - I think I will give this one a try. Anyone have any tips for how to use this coming from the Arduino IDE (with no previous programming experience?)
Thanks,
-
RE: Help with Switch/Case/Break statement
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)); } }
-
RE: Help with Switch/Case/Break statement
Ok, did a bit more digging. I think I finally got this.
Mixed up in my mind how I wanted to measure the water level. Think I have the logic finally figured out in my illogical head.
Thanks for all the help guys; good to network brains every once in while
/** * 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_FLOW = 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 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_FLOW 2 // Sensor to send flow/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_FLOW, V_VOLUME); // Water flow info. In METRES! 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_FLOW, S_WATER); send(msgPrefix.set("CM")); } void loop() { unsigned long currentMillis = millis(); Distance = sonar.ping_cm(); waterDepth = (bucketDepth - Distance); if (waterDepth >= HIGH_WATER && SEND_FLOW == 0){ digitalWrite(RELAY_PIN, HIGH); send(msgRelay.set(1)); SEND_FLOW = 1; } else if ( (waterDepth <= LOW_WATER) && SEND_FLOW == 1) { digitalWrite(RELAY_PIN, LOW); send(msgRelay.set (0)); WATER_VOLUME = ((((sq(RADIUS)) * 3.14) * (bucketDepth - waterDepth)) / 1000); send(msgVolume.set(WATER_VOLUME)); SEND_FLOW = 0; } else if ( (currentMillis - previousMillis) >= reportMillis) { send(msgDepth.set(Distance)); send(msgPrefix.set("CM")); previousMillis = currentMillis; } else if ((RELAY_PIN == HIGH) && (waterDepth <= LOW_WATER)) { digitalWrite(RELAY_PIN, LOW); send(msgRelay.set (0)); Distance = sonar.ping_cm(); waterDepth = (bucketDepth - Distance); WATER_VOLUME = ((((sq(RADIUS)) * 3.14) * (bucketDepth - waterDepth)) / 1000); send(msgVolume.set(WATER_VOLUME)); } wait(100); } 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 relay state digitalWrite(RELAY_PIN, HIGH); send(msgRelay.set(1)); // Store state in eeprom // saveState(message.sensor, message.getBool()); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } }
-
RE: Help with Switch/Case/Break statement
I think i've got it; but for some reason my sensor is a lot more sensitive when using my sketch versus the example one that came with the library. I can go to a reliable resolution of up to 2-5CM using the example sketch; and only ~10 (the cutoff limit I was using in the sketch) when all combined.
/** * 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 RELAY_ON HIGH // #define RELAY_OFF LOW #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; // Distance from face of sensor to top of water at low level (where pump will disengage) int HIGH_WATER = 30; // Distance from face of sensor to top of water at high point (when pump will engage) int RADIUS = 15; //Radius of cylindrical bucket. Used for Flow calculations int bucketDepth = 30; int waterDepth = 5; unsigned long SEND_FLOW = 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 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_FLOW 2 // Sensor to send flow/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_FLOW, V_VOLUME); // Water flow info. In METRES! 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_FLOW, S_WATER); send(msgPrefix.set("CM")); } void loop() { unsigned long currentMillis = millis(); Distance = sonar.ping_cm(); waterDepth = (bucketDepth - Distance); if (waterDepth == HIGH_WATER && SEND_FLOW == 0){ digitalWrite(RELAY_PIN, HIGH); send(msgRelay.set(1)); SEND_FLOW = 1; } else if ( (waterDepth <= LOW_WATER) && SEND_FLOW == 1) { digitalWrite(RELAY_PIN, LOW); send(msgRelay.set (0)); WATER_VOLUME = ((((sq(RADIUS)) * 3.14) * (bucketDepth - waterDepth)) / 1000); send(msgVolume.set(WATER_VOLUME)); SEND_FLOW = 0; } else if ( (currentMillis - previousMillis) >= reportMillis) { send(msgDepth.set(Distance)); send(msgPrefix.set("CM")); previousMillis = currentMillis; } else if ((RELAY_PIN == HIGH) && (waterDepth == LOW_WATER)) { digitalWrite(RELAY_PIN, LOW); send(msgRelay.set (0)); WATER_VOLUME = ((((sq(RADIUS)) * 3.14) * (bucketDepth - waterDepth)) / 1000); send(msgVolume.set(WATER_VOLUME)); } } 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 relay state digitalWrite(RELAY_PIN, HIGH); send(msgRelay.set(1)); // Store state in eeprom // saveState(message.sensor, message.getBool()); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } }
-
RE: Help with Switch/Case/Break statement
Yes, high stats it low stops it.
I have been working with the IF statements but I am still having an issue. I'm getting some weird behaviour with the code. When it first starts up and the ultrasonic sensor is more than ~5cm from an object, it works ok and the relay stays off. If I put something close in front of the sensor, the relay turns on but it keeps spamming the message to the gateway (even when it should not). Also, if you move that object away from the front of the ultrasonic sensor, the relay stays on.
/** * 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 RELAY_ON HIGH // #define RELAY_OFF LOW #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 #define LOW_WATER 30 // Distance from face of sensor to top of water at low level (where pump will disengage) #define HIGH_WATER 5 // Distance from face of sensor to top of water at high point (when pump will engage) #define RADIUS 15 //Radius of cylindrical bucket. Used for Flow calculations unsigned long SEND_FLOW = 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 long unsigned int Depth = 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_FLOW 2 // Sensor to send flow/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_FLOW, V_VOLUME); // Water flow info. In METRES! 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_FLOW, S_WATER); send(msgPrefix.set("CM")); } void loop() { unsigned long currentMillis = millis(); Depth = sonar.ping_cm(); if (Depth == HIGH_WATER){ digitalWrite(RELAY_PIN, HIGH); send(msgRelay.set(1)); SEND_FLOW = 1; } if ( (Depth == LOW_WATER) && SEND_FLOW == 1) { digitalWrite(RELAY_PIN, LOW); send(msgRelay.set (0)); WATER_VOLUME = ((((sq(RADIUS)) * 3.14) * (LOW_WATER - Depth)) / 1000); send(msgVolume.set(WATER_VOLUME)); SEND_FLOW = 0; } if ( (currentMillis - previousMillis) >= reportMillis) { send(msgDepth.set(Depth)); send(msgPrefix.set("CM")); previousMillis = currentMillis; } } void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.type==V_LIGHT) { // Change relay state digitalWrite(RELAY_PIN, HIGH); send(msgRelay.set(1)); // Store state in eeprom // saveState(message.sensor, message.getBool()); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } }
-
RE: Help with Switch/Case/Break statement
I'm trying to set it up so that if the depth changes, it will report the new one back to the HA controller.
I was working with the IF/Else statemetns at first, but my Arduino kept running the code and clogging my serial console and sending reports to my HA controller. I was going to use a sleep command to make it only check once every X seconds/minutes, but I wanted to be able to add a manual empty switch for emergency use. Since the If/Else was clogging the console, thought Switch/Case would work better.
I'll keep looking into this. Thanks for the help.
-
Help with Switch/Case/Break statement
Hi,
I'm working on building a pump to empty my De-humidifier for me automatically. I have the components connected, but I cannot get the Switch/Case statement to work/compile for me. I'm not sure where i'm going wrong. The compiler complains about a duplicate case, but i'm not sure why. I know it's in the LOW_WATER statement. This is the first time i've used this form of statement; i'm probably missing something small. Any help is appreciated.
/** * 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> unsigned long REPORT_TIME = 60000; // Sleep time between sensor readings #define RELAY_PIN 3 // To control the sump pump, define relay pin here. #define RELAY_ON HIGH #define RELAY_OFF LOW #define TRIGGER_PIN 4 //HC-SR04 Trgger Pin (Transmit) #define ECHO_PIN 5 //HC-SR04 Echo Pin (Receive) #define MAX_DISTANCE 50 //Maximum Distance for Sensor scan (tank depth) no more than 297fu #define RADIUS 15 //Radius of cylindrical bucket. Used for Flow calculations unsigned long SEND_FLOW = 0; // Trigger to send flow values to HA controller unsigned long WATER_VOLUME = 0; unsigned int Depth = 5; unsigned int HIGH_WATER = 5; // Distance from face of sensor to top of water at high point (when pump will engage) unsigned int LOW_WATER = 30; // Distance from face of sensor to top of water at low level (where pump will disengage) #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_FLOW 2 // Sensor to send flow/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 msgFlow(CHILD_ID_FLOW, V_VOLUME); // Water flow info. In METRES! unsigned long previousDepth = 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_FLOW, S_WATER); send(msgPrefix.set("CM")); } void loop() { // put your main code here, to run repeatedly: Depth = sonar.ping_cm(); switch (Depth) { case '= LOW_WATER': digitalWrite(RELAY_PIN. RELAY_OFF); send(msgRelay.set (0)); SEND_FLOW = 1; break; case '= HIGH_WATER': digitalWrite(RELAY_PIN, RELAY_ON); send(msgRelay.set(1)); break; case '!= Depth': send(msgDepth.set(Depth)); previousDepth = Depth; break; } if (RELAY_PIN == RELAY_OFF && Depth == LOW_WATER && SEND_FLOW == 1) { WATER_VOLUME = (((sq(RADIUS)) * 3.14) * (LOW_WATER - Depth) / 1000); send(msgFlow.set(WATER_VOLUME)); SEND_FLOW = 0; } } void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.type==V_LIGHT) { // Change relay state digitalWrite(RELAY_PIN, RELAY_ON); send(msgRelay.set(1)); // Store state in eeprom // saveState(message.sensor, message.getBool()); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } }
-
RE: unable to open USB port
No problem; just glad to hear you got it working. Everyone is new sometime.
FYI I made quite a few mistakes in the configuration.yaml file - took me a while to realize spaces were important
Let us know if you have any other problems.
-
RE: unable to open USB port
Not sure what else to tell you. Like Martin said, for a node to appear at all in HA; it must do two things. 1) send the full presentation on the node start. Easiest way to do that is to start HA, and after HA is fully started put power to your motion sensor. 2) It must send a valid sensor status. In the case of a motion sensor, I believe it is either 1 or 0 (1 being motion detected, 0 being none).
The only thing I can see is maybe the / needs to be in front of home. Can't see it causing this many issues though.
mysensors: gateways: - device: '/dev/ttyUSB0' persistence_file: '/home/pi/.homeassistant/mysensors.json' baud_rate: 115200 debug: false persistence: true
Other than that i'm not sure what else to suggest. If everything is configured right, it should see it. You may also want to check out the debug part of MySensors config and HA to better determine your issue. @martinhjelmare help me with that issue some time ago.
-
RE: unable to open USB port
@chilliman said:
mysensors:
gateways:
- device: '/dev/ttyUSB0'
persistence_file: 'home/pi/.homeassistant'
baud_rate: 115200
debug: false
persistence: trueMy bad, forgot to add the file at the end of the directory.
mysensors: gateways: - device: '/dev/ttyUSB0' persistence_file: 'home/pi/.homeassistant/mysensors.json' baud_rate: 115200 debug: false persistence: true
-
RE: unable to open USB port
Your path to the persistence file is wrong. You need to choose a directory that your user (in this case pi) has access to. I would recommend using /home/pi/.homeassistant so that your configuration.yaml flie would look like this:
mysensors: gateways: - device: '/dev/ttyUSB0' persistence_file: 'home/pi/.homeassistant' baud_rate: 115200 debug: false persistence: true
The entry in your configuration.yaml file is a direct copy/paste of the example; you have to change it to meet your setup. The one I posted above should work fine for your install, and you can enable debug and launch hass manually from a terminal if you need to debug any MySensors related issues.
-
RE: unable to open USB port
The error says it. You have persistence turned on, but the file location is invalid or you do not have read/write access to it.
What user are you using to turn on hass and what does the MySensors entry of configuration.yaml look like?
-
RE: MySensors 2.0.0 Released
Not really; depends on what your controller supports. Personally I have Home-Assistant running the latest MySensors 2.0 Wifi (ESP) gateway no problems.
-
RE: How To: 2 Door Chime Automation Hack (Thanks @petewill)
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()); } }
-
RE: MySensors 2.0.0 Released
I think that was someone who contributed it a while back. I remember going though the thread, and at one time someone was looking for anyone to update the 1.5 base for the signing; IIRC.
Probably best to switch to another Gateway for now.
-
RE: Custom node for USA wall switch module
Thanks @enterprised
Are you using any fuses in line with your power supply?
-
RE: Reuse old alarm system
Ok thanks, was hoping there was still a system board there; was hoping it would be as easy as this for you.
As for ideas, you could use an Arduino Uno, Nano, or Mega and have all your sensors connect via external pull-up resistors to deliver a good clean signal. You can just use the example ReedSwitch sketch and just modify it for how ever many binary/reed switches you want to have.
Also now that MySensors is on V2.0, you can use whatever method you choose to communicate to HA (NRF/RFM, Ethernet (Gateway and NODE on same Arduino), etc. I think even Wifi with the ESP8266 is an option.
How do you intend on communicating your sensors with HA? Do you have an existing MySensors network?
-
RE: unable to open USB port
Go with the latest LTS build of Ubuntu. LTS stands for Long Term Support and guarantees security updates to that version for 5 years(?); and can be easily updated to the latest if you wish.
Also depending on what you comfort level is with Linux in general. there are several other flavours/distributions of Ubuntu, including a Server edition that is completely text based and uses the least system resources.
-
RE: Laptop recommendation
@tbowmo said:
I've only got bad experience with acer aspire computers, the build quality is terrible, and usually they use outdated hw, and bloat it with unnecessary programs.
I used to sell Computers (first job) and Acer Laptops were out biggest seller - and largest warranty claims. Stay away from Acer unless you plan on buying the Cadillac of extended warranties. If you are looking for build quality, I would recommend IBM (Bit pricey) or HP. We have been using HP computers where I work now for a few years now, and our laptops and desktops all have little to no issues with the overall build quality. Sometimes components fail (ex. hard drives) but that can happen with any PC.
-
RE: Reuse old alarm system
Hi,
You may be able to integrate your old system into an existing Home Automation controller (ex. OpenHab). What brand and model do you have?
-
RE: Basic question: Light sensors
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.
-
RE: MySensors 2.0.0 Released
@Jason-Brunk
IMHO I would say yes. Keep in mind there are some differences in how the API works. I suggest going through the example scripts from 2.0, and compare that to the ones in 1.5 so you will get an idea of what I mean.
-
RE: {DEV} Multi-Sensor Node goes into boot loop
Ah, never thought about that. I do have a node/repeater still on 1.5 running. Thanks; now I know my next project.
-
RE: MySensors 2.0.0 Released
Thanks MySensors team. Can't wait to see what 2.0 will bring!
-
Basic question: Light sensors
V_LIGHT_LEVEL; does home-assistant support the SI unit LUX? I have a sketch for a LUX sensor I am trying to integrate into HA but it gives a value back in % in the GUI.
Thanks,
-
RE: {DEV} Multi-Sensor Node goes into boot loop
Getting there.... I had to re-add the OneWire, Wire and DallasTemperature sensor and make a few modifications to the sketch, but I have the beginnings now and it is showing up properly in Home-Assistant and responding nicely. I'm off to make supper, but the only thing I can see needing to modify big time is adding "send temp on change only" and getting the temp to show to a decimal place.
Here is the sketch for now:
/** * 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 * Motion Sensor example using HC-SR501 * http://www.mysensors.org/build/motion * */ // 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 #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 #define MAX_ATTACHED_DS18B20 16 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. float lastTemperature[MAX_ATTACHED_DS18B20]; int numSensors=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 motion message MyMessage msgMotion(CHILD_ID_MOTION, V_TRIPPED); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); MyMessage msgLux(CHILD_ID_LUX, V_LIGHT_LEVEL); uint16_t lastlux; 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); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("yes", "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() { // Read digital motion value boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; Serial.println(tripped); send(msgMotion.set(tripped?"1":"0")); // Send tripped value to gw { uint16_t lux = lightSensor.readLightLevel();// Get Lux value Serial.println(lux); if (lux != lastlux) { send(msgLux.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.; // Send in the new temperature send(msgTemp.set(temperature)); } // Sleep until interrupt comes in on motion sensor. Send update every two minute. sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME); }
-
RE: {DEV} Multi-Sensor Node goes into boot loop
Thanks for looking into this with me. I had some more luck believe it or not after upgrading to 2.0.0 on my Gateway. Using the same sketch as I posted for my node, and updating my ESP8266 Gateway to the 2.0 sketch solved the reboot issue. Only problem now is the DallasTemperature sensor does not seem to be registering with the gateway.
Of curious notice, when I looked through the example sketches in the new MySensors 2.0 Library, i did not see an example sketch for the DallasTemperature sensors this time around.
-
{DEV} Multi-Sensor Node goes into boot loop
Hi,
I'm trying to make a multi-sensor node for my porch. I want the sensor to have a Temp/Motion/LUX sensors and have used the Dallas temp sensor and BH1750 Lux sensor for this project. I have tested the individual components on their own, and each of them works (not with the MySensors library but on their own).
I am using the 2.0 DEV branch and trying to combine the example sketches for the above sensors into one. I can compile fine, but when I try to boot, I go into a boot loop with the Arduino. This is the output from the Serial window after enabling Debug:
Starting sensor (RNNNA-, 2.0.0-beta) TSM:INIT TSM:RADIO:OK TSP:ASSIGNID:OK (ID=21) TSM:FPAR TSP:MSG:SEND 21-21-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSP:MSG:READ 4-4-21 s=255,c=3,t=8,pt=1,l=1,sg=0:2 TSP:MSG:FPAR RES (ID=4, dist=2) TSP:MSG:PAR OK (ID=4, dist=3) TSP:MSG:READ 0-0-21 s=255,c=3,t=8,pt=1,l=1,sg=0:0 TSP:MSG:FPAR RES (ID=0, dist=0) TSP:MSG:PAR OK (ID=0, dist=1) TSP:MSG:READ 2-2-21 s=255,c=3,t=8,pt=1,l=1,sg=0:2 TSP:MSG:FPAR RES (ID=2, dist=2) TSP:MSG:READ 14-14-21 s=255,c=3,t=8,pt=1,l=1,sg=0:1 TSP:MSG:FPAR RES (ID=14, dist=1) TSM:FPAR:OK TSM:ID TSM:CHKID:OK (ID=21) TSM:UPL TSP:PING:SEND (dest=0) TSP:MSG:SEND 21-21-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1 TSP:CHKUPL:FAIL (hops=255) !TSM:UPL:FAIL TSM:FPAR TSP:MSG:SEND 21-21-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSP:MSG:READ 4-4-21 s=255,c=3,t=8,pt=1,l=1,sg=0:2 TSP:MSG:FPAR RES (ID=4, dist=2) TSP:MSG:PAR OK (ID=4, dist=3) TSP:MSG:READ 0-0-21 s=255,c=3,t=8,pt=1,l=1,sg=0:0 TSP:MSG:FPAR RES (ID=0, dist=0) TSP:MSG:PAR OK (ID=0, dist=1) TSP:MSG:READ 2-2-21 s=255,c=3,t=8,pt=1,l=1,sg=0:2 TSP:MSG:FPAR RES (ID=2, dist=2) TSP:MSG:READ 14-14-21 s=255,c=3,t=8,pt=1,l=1,sg=0:1 TSP:MSG:FPAR RES (ID=14, dist=1) TSM:FPAR:OK TSM:ID TSM:CHKID:OK (ID=21) TSM:UPL TSP:PING:SEND (dest=0) TSP:MSG:SEND 21-21-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1 TSP:CHKUPL:FAIL (hops=255) !TSM:UPL:FAIL TSM:FPAR TSP:MSG:SEND 21-21-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSP:MSG:READ 4-4-21 s=255,c=3,t=8,pt=1,l=1,sg=0:2 TSP:MSG:FPAR RES (ID=4, dist=2) TSP:MSG:PAR OK (ID=4, dist=3) TSP:MSG:READ 0-0-21 s=255,c=3,t=8,pt=1,l=1,sg=0:0 TSP:MSG:FPAR RES (ID=0, dist=0) TSP:MSG:PAR OK (ID=0, dist=1) TSP:MSG:READ 2-2-21 s=255,c=3,t=8,pt=1,l=1,sg=0:2 TSP:MSG:FPAR RES (ID=2, dist=2) TSP:MSG:READ 14-14-21 s=255,c=3,t=8,pt=1,l=1,sg=0:1 TSP:MSG:FPAR RES (ID=14, dist=1) TSM:FPAR:OK TSM:ID TSM:CHKID:OK (ID=21) TSM:UPL TSP:PING:SEND (dest=0) TSP:MSG:SEND 21-21-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1 TSP:CHKUPL:FAIL (hops=255) !TSM:UPL:FAIL TSM:FPAR TSP:MSG:SEND 21-21-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSP:MSG:READ 4-4-21 s=255,c=3,t=8,pt=1,l=1,sg=0:2 TSP:MSG:FPAR RES (ID=4, dist=2) TSP:MSG:PAR OK (ID=4, dist=3) TSP:MSG:READ 2-2-21 s=255,c=3,t=8,pt=1,l=1,sg=0:2 TSP:MSG:FPAR RES (ID=2, dist=2) TSP:MSG:READ 14-14-21 s=255,c=3,t=8,pt=1,l=1,sg=0:1 TSP:MSG:FPAR RES (ID=14, dist=1) TSP:MSG:PAR OK (ID=14, dist=2) TSP:MSG:READ 0-0-21 s=255,c=3,t=8,pt=1,l=1,sg=0:0 TSP:MSG:FPAR RES (ID=0, dist=0) TSP:MSG:PAR OK (ID=0, dist=1) TSM:FPAR:OK TSM:ID TSM:CHKID:OK (ID=21) TSM:UPL TSP:PING:SEND (dest=0) TSP:MSG:SEND 21-21-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1 TSP:CHKUPL:FAIL (hops=255) !TSM:UPL:FAIL TSM:FPAR TSP:MSG:SEND 21-21-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSP:MSG:READ 2-2-21 s=255,c=3,t=8,pt=1,l=1,sg=0:2 TSP:MSG:FPAR RES (ID=2, dist=2) TSP:MSG:PAR OK (ID=2, dist=3) TSP:MSG:READ 14-14-21 s=255,c=3,t=8,pt=1,l=1,sg=0:1 TSP:MSG:FPAR RES (ID=14, dist=1) TSP:MSG:PAR OK (ID=14, dist=2) TSP:MSG:READ 4-4-21 s=255,c=3,t=8,pt=1,l=1,sg=0:2 TSP:MSG:FPAR RES (ID=4, dist=2) TSP:MSG:READ 0-0-21 s=255,c=3,t=8,pt=1,l=1,sg=0:0 TSP:MSG:FPAR RES (ID=0, dist=0) TSP:MSG:PAR OK (ID=0, dist=1) TSM:FPAR:OK TSM:ID TSM:CHKID:OK (ID=21) TSM:UPL TSP:PING:SEND (dest=0) TSP:MSG:SEND 21-21-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1 TSP:CHKUPL:FAIL (hops=255) !TSM:UPL:FAIL TSM:FPAR TSP:MSG:SEND 21-21-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSP:MSG:READ 2-2-21 s=255,c=3,t=8,pt=1,l=1,sg=0:2 TSP:MSG:FPAR RES (ID=2, dist=2) TSP:MSG:PAR OK (ID=2, dist=3) TSP:MSG:READ 14-14-21 s=255,c=3,t=8,pt=1,l=1,sg=0:1 TSP:MSG:FPAR RES (ID=14, dist=1) TSP:MSG:PAR OK (ID=14, dist=2) TSP:MSG:READ 4-4-21 s=255,c=3,t=8,pt=1,l=1,sg=0:2 TSP:MSG:FPAR RES (ID=4, dist=2) TSP:MSG:READ 0-0-21 s=255,c=3,t=8,pt=1,l=1,sg=0:0 TSP:MSG:FPAR RES (ID=0, dist=0) TSP:MSG:PAR OK (ID=0, dist=1) TSM:FPAR:OK TSM:ID TSM:CHKID:OK (ID=21) TSM:UPL TSP:PING:SEND (dest=0) TSP:MSG:SEND 21-21-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1 TSP:CHKUPL:FAIL (hops=255) !TSM:UPL:FAIL TSM:FPAR TSP:MSG:SEND 21-21-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSP:MSG:READ 2-2-21 s=255,c=3,t=8,pt=1,l=1,sg=0:2 TSP:MSG:FPAR RES (ID=2, dist=2) TSP:MSG:PAR OK (ID=2, dist=3) TSP:MSG:READ 14-14-21 s=255,c=3,t=8,pt=1,l=1,sg=0:1 TSP:MSG:FPAR RES (ID=14, dist=1) TSP:MSG:PAR OK (ID=14, dist=2) TSP:MSG:READ 4-4-21 s=255,c=3,t=8,pt=1,l=1,sg=0:2 TSP:MSG:FPAR RES (ID=4, dist=2) TSP:MSG:READ 0-0-21 s=255,c=3,t=8,pt=1,l=1,sg=0:0 TSP:MSG:FPAR RES (ID=0, dist=0) TSP:MSG:PAR OK (ID=0, dist=1) TSM:FPAR:OK TSM:ID TSM:CHKID:OK (ID=21) TSM:UPL TSP:PING:SEND (dest=0) TSP:MSG:SEND 21-21-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1 TSP:CHKUPL:FAIL (hops=255) !TSM:UPL:FAIL TSM:FPAR TSP:MSG:SEND 21-21-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSP:MSG:READ 2-2-21 s=255,c=3,t=8,pt=1,l=1,sg=0:2 TSP:MSG:FPAR RES (ID=2, dist=2) TSP:MSG:PAR OK (ID=2, dist=3) TSP:MSG:READ 14-14-21 s=255,c=3,t=8,pt=1,l=1,sg=0:1 TSP:MSG:FPAR RES (ID=14, dist=1) TSP:MSG:PAR OK (ID=14, dist=2) TSP:MSG:READ 4-4-21 s=255,c=3,t=8,pt=1,l=1,sg=0:2 TSP:MSG:FPAR RES (ID=4, dist=2) TSP:MSG:READ 0-0-21 s=255,c=3,t=8,pt=1,l=1,sg=0:0 TSP:MSG:FPAR RES (ID=0, dist=0) TSP:MSG:PAR OK (ID=0, dist=1) TSM:FPAR:OK TSM:ID TSM:CHKID:OK (ID=21) TSM:UPL TSP:PING:SEND (dest=0) TSP:MSG:SEND 21-21-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1 TSP:CHKUPL:FAIL (hops=255) !TSM:UPL:FAIL TSM:FPAR TSP:MSG:SEND 21-21-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc: TSP:MSG:READ 2-2-21 s=255,c=3,t=8,pt=1,l=1,sg=0:2 TSP:MSG:FPAR RES (ID=2, dist=2) TSP:MSG:PAR OK (ID=2, dist=3) TSP:MSG:READ 14-14-21 s=255,c=3,t=8,pt=1,l=1,sg=0:1 TSP:MSG:FPAR RES (ID=14, dist=1) TSP:MSG:PAR OK (ID=14, dist=2) TSP:MSG:READ 4-4-21 s=255,c=3,t=8,pt=1,l=1,sg=0:2 TSP:MSG:FPAR RES (ID=4, dist=2) TSP:MSG:READ 0-0-21 s=255,c=3,t=8,pt=1,l=1,sg=0:0 TSP:MSG:FPAR RES (ID=0, dist=0) TSP:MSG:PAR OK (ID=0, dist=1) TSM:FPAR:OK TSM:ID TSM:CHKID:OK (ID=21) TSM:UPL TSP:PING:SEND (dest=0) TSP:MSG:SEND 21-21-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1
And this is the 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 1.0 - Henrik Ekblad * * DESCRIPTION * Motion Sensor example using HC-SR501 * http://www.mysensors.org/build/motion * */ // 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 #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 #define MAX_ATTACHED_DS18B20 16 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. float lastTemperature[MAX_ATTACHED_DS18B20]; int numSensors=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 motion message MyMessage msgMotion(CHILD_ID_MOTION, V_TRIPPED); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); MyMessage msgLux(CHILD_ID_LUX, V_LIGHT_LEVEL); uint16_t lastlux; 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); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("yes", "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() { // Read digital motion value boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; Serial.println(tripped); send(msgMotion.set(tripped?"1":"0")); // Send tripped value to gw { uint16_t lux = lightSensor.readLightLevel();// Get Lux value Serial.println(lux); if (lux != lastlux) { send(msgLux.set(lux)); lastlux = lux; } // Fetch temperatures from Dallas sensors sensors.requestTemperatures(); // query conversion time and sleep until conversion completed int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution()); // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater) wait(conversionTime); // Read temperatures and send them to controller for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) { // Fetch and round temperature to one decimal float temperature = static_cast<float>(static_cast<int>((getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.; // Only send data if temperature has changed and no error #if COMPARE_TEMP == 1 if (lastTemperature[i] != temperature && temperature != -127.00 && temperature != 85.00) { #else if (temperature != -127.00 && temperature != 85.00) { #endif // Send in the new temperature send(msgTemp.setSensor(i).set(temperature,1)); // Save new temperatures for next compare lastTemperature[i]=temperature; } } // Sleep until interrupt comes in on motion sensor. Send update every two minute. sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME); } }
-
RE: Custom node for USA wall switch module
Love the project. Can't wait to see more. Please share your designs, would love to do this for my North American home as well.
Oh, and is it possible to get some high-resolution pictures of your project?
Thanks,
-
RE: Nice push buttons?
I like using the cheap tact/momentary switches. Like you said, you know when you press them, and they come in various sizes/lengths. The downside is, not so aesthetic to the eyes, and can be problematic to mount. The best use for them in practice (imho) is soldered onto PCB board projects. That being said, in a pinch I've used them for manual relay switching and they are held in cases with glue and tape and still serve their purpose.
I think the choice will come down to how you are applying it to your project. For example looking at the RGB button you posted. I imagine using the led as a status display for a temperature or water level node, and the push button a manual override. Would work well for small areas/enclosures.
-
RE: Adapter for RFM69 on NRF24L01+ pinout-header
Perfect, that answers that. Thanks again. Only complaint is the RFM is not as inexpensive as the NRF's. lol.
cheers,
-
RE: Adapter for RFM69 on NRF24L01+ pinout-header
More or less if there was any components to solder to the board (components). I know with the NRF you have to have a 4.7mf capacitor for the radio; wasn't sure if RFM was the same or not. The only component I see needing is the 2x4 pin header.
Thanks again.
-
RE: Adapter for RFM69 on NRF24L01+ pinout-header
Thanks @alexsh1, that answers that.
One other quick question. Other than ordering the PCB's from dirtypcb's; any other hardware for the board required? I know I will need wire for an antenna, but wasn't sure if there was any need for capacitors or resistors. I looked through the thread and found no parts list so i'm leaning towards no.
Thanks again,
-
RE: Adapter for RFM69 on NRF24L01+ pinout-header
very nice work. So the NRF2RFM69; will it work with the RFM69CHW chip at all? The reason I ask is, I have a lot of slimnodes on battery as well that I would like to switch radios for some better range (and hopefully, less failures on my network).
Thanks,
-
RE: OpenHAB, 230V Relays and external Switches
Seems like you are on the right track so far. Keep posting with updates/"fire calls" j/k, always enjoys seeing how other people's projects turn out.
-
RE: OpenHAB, 230V Relays and external Switches
hi @dgds
Sounds like a fun project you have ahead. I don't use Openhab personally but I do use the relay+actuator (button) sketch for a lamp that I made some time ago. The light switch will show up in your home automation controller as a binary device (on or off, 1/0) and you can send and receive messages from there. You can also connect to the same Arduino a push button switch (ex. Tact button) so that you can toggle the switch physically instead. Pressing the tact button will also update your Openhab status accordingly.
Also make sure for whatever relay you use to observe safe habits when working with mains voltage. I've seen some people have power supplies on this forum fry over time, and that would not be a good situation if you are doing a large amount of these.
Also check out the openhardware.io subforum and website. There are a few users who are already working on such projects like this, and many that will work in commercially available fixtures that you may want. Ex. https://www.openhardware.io/view/77/AC-DC-double-solid-state-relay-module
https://www.openhardware.io/view/13/In-Wall-ACDC-Pcb-for-MySensors
-
RE: How To - Doorbell Automation Hack
I know when I was playing with Domoticz the Doorbell sketch would show up as a security light and a light for me. The security light I changed to a motion sensor in Domoticz (click edit on your dashboard/switches tab). After that when I pressed the doorbell button, the motion sensor would switch on to show the button was pressed, then immediately back off. Although for it to turn off automatically, I may have had to tell domoticz to do that after xx seconds, can't remember for sure now.
And yes you are correct, the second switch is a 'mute' for the doorbell. If off, the doorbell won't sound (switch the relay).
-
RE: Can't see my nodes on HA web interface
Hey, I am going through and upgrading my nodes to 2.0 Beta; the same 'bug' exists there so I had to patch it to work with HA.
Use this code from the 2.0 Beta. Basically all you have to do is tell the node to broadcast its state on receipt of message. This works from both the button and the HA web interface.
/** * 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 * Example sketch for a "light switch" where you can control light or something * else from both HA controller and a local physical button * (connected between digital pin 3 and GND). * This node also works as a repeader for other nodes * http://www.mysensors.org/build/relay */ // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 // Enabled repeater feature for this node #define MY_REPEATER_FEATURE #define MY_NODE_ID 4 #include <SPI.h> #include <MySensor.h> #include <Bounce2.h> #define RELAY_PIN 3 // Arduino Digital I/O pin number for relay #define BUTTON_PIN 6 // Arduino Digital I/O pin number for button #define CHILD_ID 1 // Id of the sensor child #define RELAY_ON 1 #define RELAY_OFF 0 Bounce debouncer = Bounce(); int oldValue=0; bool state; MyMessage msg(CHILD_ID,V_LIGHT); void setup() { // Setup the button pinMode(BUTTON_PIN,INPUT); // Activate internal pull-up digitalWrite(BUTTON_PIN,HIGH); // After setting up the button, setup debouncer debouncer.attach(BUTTON_PIN); debouncer.interval(5); // Make sure relays are off when starting up digitalWrite(RELAY_PIN, RELAY_OFF); // Then set relay pins in output mode pinMode(RELAY_PIN, OUTPUT); // Set relay to last known state (using eeprom storage) state = loadState(CHILD_ID); digitalWrite(RELAY_PIN, state?RELAY_ON:RELAY_OFF); // send(msg.set(1)); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Lamp", "1.0"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID, S_LIGHT); } /* * Example on how to asynchronously check for new messages from gw */ void loop() { debouncer.update(); // Get the update value int value = debouncer.read(); if (value != oldValue && value==0) { send(msg.set(state?false:true), true); // Send new state and request ack back } oldValue = value; } 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 state = message.getBool(); digitalWrite(RELAY_PIN, state?RELAY_ON:RELAY_OFF); send(msg.set(state?RELAY_ON:RELAY_OFF)); // Store state in eeprom saveState(CHILD_ID, state); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } }
-
Is it possible to connect an Ethernet Gateway to Node-Red and share it?
Hi,
Is it possible to have Node-Red connect to an ethernet gateway, and then split the connection with multiple clients? I know I could do an MQTT Client/Server, but just curious if Node-red in general could do this. I know it can connect to a Serial Gateway; wasn't sure if Ethernet was supported or not.
-
RE: Humble book bundle for electronics
Thanks for the link @mfalkvidd , ordered. Should be some fun projects for the kid and I over the summer.
-
RE: Looking to switch automation controller software
Oh wow, going to have to look into this now. Any links to get a person started? Only ever heard of Node-Red so far.
-
RE: Help converting 24VAC to 5VDC
True. Could also down step the voltage twice. LM7812 to LM7805 for example.
-
RE: Help converting 24VAC to 5VDC
Buck Converter is definitely the easiest way to down-step your voltage. Just make sure you put a cap or two before and after the regulator to help with the power cycles on your bridge when converting the AC to DC current.
I have a rectifier bridge working to convert 16VAC to 5VDC using an LM7805 regulator. It has been working steadily non-stop since October of last year. Would have been much easier just to go with the buck converter but whatever method you use should work fine.
-
RE: Is it possible to connect a Pro Mini directly to Raspberry Pi GPIO for Gateway?
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.
-
RE: My best nRF24L01+PA+LNa node (gateway/ repeater) so far
Nice case @AWI
Any tips for getting a repeater working? Tried the example sketch from 1.5.4 but the repeater seems to freeze when trying to boot. Using a nano with normal NRF radio. -
RE: Is it possible to connect a Pro Mini directly to Raspberry Pi GPIO for Gateway?
Awesome. What port would it be? I have tried to access the /dev/ttyAMA0 but the pi user has no access. Can connect as root, but that's overkill.
-
Is it possible to connect a Pro Mini directly to Raspberry Pi GPIO for Gateway?
Hi,
I'm wondering if it is possible to connect a Arduino Pro Mini directly to a Raspberry Pi's GPIO pins for running a serial gateway? I am trying to avoid using the USB bus for a Gateway and a direct connection of the NRF to the Pi is not preferred just so I don't have to compile update scripts/drivers/kernel modules/etc.
Is it possible?
Thanks!
-
RE: Looking to switch automation controller software
Domoticz. Domoticz offers floorplan setup (just upload a .jpg of the plan) and has manual switches you can set up. As well, the automation uses blocky - an easy to use GUI way of automating. Or LUA; if you are feeling brave.
-
RE: How To - Doorbell Automation Hack
Not really. You could try uploading at a slower speed. Slower speed over serial usually equals less chance of missed data.
Have you tried running this connected to your PC and viewing the data from serial console/window? Copy/paste the output from the serial monitor so we can see what's going on.
-
RE: How To - Doorbell Automation Hack
The sketch I use doesn't use internal pull ups; external only.
As for the relay clicking, could be either the jumper on the relay, or not enough current to power it properly.
Not sure why you are having issues with either of the scripts. What type of gateway do you use?
-
Is it possible to delete specific nodes?
Hi,
I'm having some issues with one of the nodes in my network. I want to start over from scratch with this node (name, ID, etc) but I dont want to delete my entire sensor database. Is it possible to remove just the one entry? If so, anything special I should keep in mind?
-
RE: Can't see my nodes on HA web interface
I looked for the sketch the other night and I must have not backed it up on my laptop. I'll see if I can find it in a backup on the weekend/recreate it.
-
RE: DHT22 generates off scale values
You could try this. Solder your 4.7uf cap right to the GND+VCC pins on the NRF radio. That would at least isolate that.
IF not, you may have a bad radio too.
-
RE: Can't see my nodes on HA web interface
I've got an updated relay+button script at home that fixes this issue. I'll post it after work for anyone else who may need it.
-
RE: DHT22 generates off scale values
The DHT22 temperature sensor requires a minimum of 3.3v to operate; any less and if fluctuates. The only luck I have ever had with the DHT22 is powered from a stable 5v supply; forget about 3.3v.
The SI7021 and BMP 180 /BME 280 do operatore @ 3.3v though, and quite well on battery power.
-
RE: How To - Doorbell Automation Hack
Try this code and see if it works.
/* * 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.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. */ #include <MySensor.h> #include <SPI.h> #include <Bounce2.h> #define NODE_ID 2 // or set to AUTO if you want gw to assign a NODE_ID for you. #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_0 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_1 1 // Child ID for the back doorbell sensor #define CHILD_ID_2 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; MySensor gw; MyMessage msg(CHILD_ID_2, CHIME_MUTE); MyMessage frontDoorbell(CHILD_ID_0, V_TRIPPED); MyMessage backDoorbell(CHILD_ID_1, V_TRIPPED); MyMessage chimeMute(CHILD_ID_2, V_STATUS); 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() { gw.begin(incomingMessage, NODE_ID); // Send the sketch version information to the gateway and Controller gw.sendSketchInfo("2 Door bell/chime Monitor", "2.1"); // 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); // Register all sensors to gw (they will be created as child devices) gw.present(CHILD_ID_0, S_MOTION); gw.present(CHILD_ID_1, S_MOTION); gw.present(CHILD_ID_2, S_LIGHT); gw.send(msg.set(CHILD_ID_2, CHIME_MUTE)); // 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 loop() { gw.process(); 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); gw.send(frontDoorbell.set(1)); gw.wait(50); digitalWrite(FRONT_CHIME_RELAY, FRONT_CHIME_RELAY_OFF); gw.send(frontDoorbell.set(0)); previousMillis = currentMillis; } if ( ((unsigned long)(currentMillis - previousMillis) >= pestTimeout) && valueF != HIGH && CHIME_MUTE == 0) { gw.send(frontDoorbell.set(1)); gw.wait(50);; gw.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); gw.send(backDoorbell.set(1)); gw.wait(450); digitalWrite(BACK_CHIME_RELAY, BACK_CHIME_RELAY_OFF); gw.send(backDoorbell.set(0)); previousMillis = currentMillis; } if ( ((unsigned long)(currentMillis - previousMillis) >= pestTimeout) && valueB != HIGH && CHIME_MUTE == 0) { gw.send(backDoorbell.set(1)); gw.wait(50); gw.send(backDoorbell.set(0)); previousMillis = currentMillis; } } void incomingMessage(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_STATUS) { // Change relay state CHIME_MUTE = message.getBool(); gw.send(msg.set(CHILD_ID_2, CHIME_MUTE?CHIME_ON:CHIME_OFF)); // Store state in eeprom gw.saveState(CHILD_ID_2, CHIME_MUTE); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } }
-
RE: Looking to switch automation controller software
Hi @dbemowsk
I don't think it would be too hard to adapt the code over to MySensors. Check out the Library and Serial API pages to get an idea of how the messages can be constructed.
As for making them talk to each other, there may already be someone doing this, or has done it in the past with an Arduino. it would be worth Googling for things like "Arduino thermostat (insert your brand/model here)" and see what comes up. If not, backwards engineering should be ok too (serial read maybe?)
In any event good luck and have fun! If you ever get stuck, post in the forums and if you are new to Arduino in general, there are a lot of great tutorials on the internet/YouTube or my personal favourite, a course from a place like Udemy can be useful.
-
RE: Looking to switch automation controller software
Hi @dbemowsk , welcome to MySensors.
I don't think anything is currently written for the RS485 in regards to thermostat control. A quick Google did reveal there are modules available for Arduino that make the RS485 communication possible, so i'm sure writing a MySensors sketch/Node would be more that possible. Check out this link for an example.
As for Controller software. I suggest shopping around. The easiest to start with would be Domoticz as most of the configuration (if not all) is GUI based via the Web Interface. A very close second would be Home-Assistant as they literally support almost all popular sensors/hardware/home components. It's a little bit more programming based, having configuration files written with YAML, but can be more rewarding.
-
RE: nRf24L01+ connection quality meter
Thanks @awi for this, might have to build one myself to test a potential bad batch of radios i have.
Do you need the LCD for this or is the data also print in serial?
Thanks,
-
RE: Notification platform
You might be able to get away with S_CUSTOM and V_VAR instead..... not sure if that would work or not.
-
RE: Does Domoticz Support scene controllers?
Ok, so from what I am understanding the sketch I would make would just be an array of switches for the sketch on the 16 keypad I have? Or is there a way to link the scene controller to the swtich/group?
sorry for the newbish question. So far Scene Controllers have been the hardest thing for me to implement (for some strange reason).
-
Does Domoticz Support scene controllers?
Hi,
I've been thinking about coming back to Domoticz as my home controller recently and have setup a couple of test devices on a spare PC I have running right now. I have a scene controller built from here https://forum.mysensors.org/topic/3128/slim-node-scene-controller-keypad/17 that I want to use. Domoticz sees the device under the Hardware---->Setup area but doesn't let me add it to my system. Does Domoticz support scene controllers or is it something special with this system?
Thanks,
-
RE: Solar powered observation nesting box network
Really fascinating stuff. Might have to look into this in the future sometime for my backyard.
-
RE: Ideas to detect car traffic in a driveway?
Thanks. That explains it all pretty perfectly.
-
RE: An HASS service to send messages to nodes
Not sure if this would help you or not but, V2.0 will feature direct Node to Node communication. Then, HA could receive the status update easily (assuming the NODE is set to send status updates).
-
RE: Ideas to detect car traffic in a driveway?
Ok, I think i'm going to go with the HB100 Radar modules (run on 3.3/5V, so perfect) and run direct node to gateway communications for alerts by adding a piezzo buzzer to a all in one gateway (maybe, if not another node) using the 2.0 beta branch.
Now my last thing to solve is power since this will be outside. I remember seeing somewhere online (not on this forum) there is a module that you can connect a 3.7v Li-Ion battery pack to that has a charger and 5v booster on board the same chip with USB to charge it with. Does anyone know if I can connect a solar panel to this and charge it? @Yveaux @sundberg84
-
RE: Microwave Radar Module as PIR replacement.
hi @danta
Did you have any luck removing the 30 second delay/counter from the radar module?
-
RE: Ideas to detect car traffic in a driveway?
The width I have to cover is roughly 1.5 cars wide from what I can remember. I didn't take any exact measurements yet. The Radar and laserbeam ideas sound like good ideas to me. And the fact you use it as a counter sundberg gives me another idea to count customers.
I'll look into both and probably order some parts for both. I have read the thread about the radar module and that sounds good if the 30 second timer could be somehow removed from the system (maybe adding a POT?).
Another thing I need to figure out yet how to do is add a siren to the system for outside. I can use MySensors and direct node to node for inside if need be; but still a nice audible speaker for outside as well.
Thanks again!
-
RE: Ideas to detect car traffic in a driveway?
Would a PIR work fine in all weather types? I thought that a PIR sensor outside would be next to useless in bright sun days.
-
Ideas to detect car traffic in a driveway?
Hi,
I have a friend who owns a couple of greenhouses as a business. If no one is around in the greenhouse, he usually likes to sit inside until he sees someone down near them from his window, but he doesn't always hear/see people go in. He was asking me if there was any way I could think of to alert him to a car that would enter/exit his driveway. Mind you, he doesn't want to spend too much money on it and would rather do it himself since he has a farm and would have most of the tools on hand if needed.
After doing some research, the only things I can think of that would reliably work would be either a induction-loop system similar to what traffic systems use to detect car rims (https://en.wikipedia.org/wiki/Induction_loop) but this would require running power to the source of the box/loop and don't really want to do that if possible. (http://hackaday.com/2014/04/04/building-an-inductive-loop-vehicle-detector/)
So I was wondering if anyone was already doing such a project or was maybe looking into it? If not, I will probably recommend him the Open Hardware/Source induction loop and see what he thinks. It would be a fun project to do anyways :).
-
RE: Slim Node scene controller/ keypad
Sure, would love to Been finding reasons to build SlimNodes all day.
-
RE: Slim Node scene controller/ keypad
Hi @AWI
I decided to try and build your keypad but I am running into some compile errors with the code you have listed above. I see that in the description you moved to 1.6; but do you still have the code for 1.5? Haven't made the switch over yet and would like to see if these 16 key keypads I have will do what I am hoping.
Thanks,
-
RE: Need some help on how to burn a sketch with SlimNode and 1MHz Bootloader
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.
-
RE: Might have bricked 60 WS2811 RGB leds
I'm not 100% sure on this but I think the LED's are ran at 12v (as described on Page 5) but the IC that controls the signal is 6-7v (see page 2 Absolute Maximum Ratings).
Again, i'm still new and could be wrong.
-
RE: Any plan to implement Ethernet GW?
I see HA got released early, and that the ethernetgateway was added. I'll check it out later on tonight but, thanks again for all the work you do on the MySensors project.
-
RE: Need some help on how to burn a sketch with SlimNode and 1MHz Bootloader
Hi,
I actually downloaded that package and am (attempting) to use it. I had to create a couple of folders for it to compile the sketches (can't remember their names, on a different computer).
I'll keep checking into it. Any ideas?
-
RE: Need some help on how to burn a sketch with SlimNode and 1MHz Bootloader
I'll have to look into it a little bit more then. First time ever using a bare Atmega chip and the Optibootloader. Thanks again.
-
RE: Need some help on how to burn a sketch with SlimNode and 1MHz Bootloader
Hi @sundberg84
The bootloader burned just fine using an Arduino as the ICSP. I am using a 3.3v ftdi to program the sketch, but that is what's giving me the sync errors.
-
RE: Need some help on how to burn a sketch with SlimNode and 1MHz Bootloader
Well, I got the sketch to compile. Had some folders I needed to make and put some files in.
Not I can't seem to get the sketch to flash to the chip. I'm using a FTDI232 adapter but get sync errors.
-
RE: [Tutorial] How to burn 1Mhz & 8Mhz bootloader using Arduino IDE 1.6.5-r5
Hi,
Maybe someone in here can help me. I can't seem to compile any sketches on my Arduino IDE and keep getting errors spit at me. I can burn the bootloader with no problem but not any sketches. Any advice/ideas please? I'm running out of things to try.
C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware "C:\Program Files (x86)\Arduino\hardware" -hardware "C:\Users\derri\AppData\Local\Arduino15\packages" -hardware "F:\Users.New\Derrick\Documents\Arduino\hardware" -tools "C:\Program Files (x86)\Arduino\tools-builder" -tools "C:\Program Files (x86)\Arduino\hardware\tools\avr" -tools "C:\Users\derri\AppData\Local\Arduino15\packages" -built-in-libraries "C:\Program Files (x86)\Arduino\libraries" -libraries "F:\Users.New\Derrick\Documents\Arduino\libraries" -fqbn=MySensors:avr:apm96 -ide-version=10608 -build-path "C:\Users\derri\AppData\Local\Temp\build782cd686753c1d06c6f3cef0b1b5a173.tmp" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "C:\Users\derri\AppData\Local\Temp\untitled808982838.tmp\sketch_apr18a\sketch_apr18a.ino" C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware "C:\Program Files (x86)\Arduino\hardware" -hardware "C:\Users\derri\AppData\Local\Arduino15\packages" -hardware "F:\Users.New\Derrick\Documents\Arduino\hardware" -tools "C:\Program Files (x86)\Arduino\tools-builder" -tools "C:\Program Files (x86)\Arduino\hardware\tools\avr" -tools "C:\Users\derri\AppData\Local\Arduino15\packages" -built-in-libraries "C:\Program Files (x86)\Arduino\libraries" -libraries "F:\Users.New\Derrick\Documents\Arduino\libraries" -fqbn=MySensors:avr:apm96 -ide-version=10608 -build-path "C:\Users\derri\AppData\Local\Temp\build782cd686753c1d06c6f3cef0b1b5a173.tmp" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "C:\Users\derri\AppData\Local\Temp\untitled808982838.tmp\sketch_apr18a\sketch_apr18a.ino" Board MySensors:avr:apm96 doesn't define a 'build.board' preference. Auto-set to: AVR_APM96 WARNING: Category '' in library UIPEthernet is not valid. Setting to 'Uncategorized' Warning: platform.txt from core 'MySensors AVR based boards' contains deprecated recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/{archive_file}" "{object_file}", automatically converted to recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}". Consider upgrading this core. "C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -DF_CPU=1000000L -DARDUINO=10608 -DARDUINO_AVR_APM96 -DARDUINO_ARCH_AVR "-IF:\Users.New\Derrick\Documents\Arduino\hardware\MySensors\avr\cores\arduino" "-IF:\Users.New\Derrick\Documents\Arduino\hardware\MySensors\avr\variants\standard" "C:\Users\derri\AppData\Local\Temp\build782cd686753c1d06c6f3cef0b1b5a173.tmp\sketch\sketch_apr18a.ino.cpp" -o "nul" "C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -DF_CPU=1000000L -DARDUINO=10608 -DARDUINO_AVR_APM96 -DARDUINO_ARCH_AVR "-IF:\Users.New\Derrick\Documents\Arduino\hardware\MySensors\avr\cores\arduino" "-IF:\Users.New\Derrick\Documents\Arduino\hardware\MySensors\avr\variants\standard" "C:\Users\derri\AppData\Local\Temp\build782cd686753c1d06c6f3cef0b1b5a173.tmp\sketch\sketch_apr18a.ino.cpp" -o "C:\Users\derri\AppData\Local\Temp\build782cd686753c1d06c6f3cef0b1b5a173.tmp\preproc\ctags_target_for_gcc_minus_e.cpp" C:\Users\derri\AppData\Local\Temp\build782cd686753c1d06c6f3cef0b1b5a173.tmp\sketch\sketch_apr18a.ino.cpp:1:21: fatal error: Arduino.h: No such file or directory #include <Arduino.h> ^ compilation terminated. exit status 1 Error compiling for board APM Optiboot internal 1MHz noBOD 9600baud.
-
Need some help on how to burn a sketch with SlimNode and 1MHz Bootloader
Hi,
I purchased the components to make a few v3.0 SlimNodes and have sucessfully burnt the bootloader files to the Atmega chips. The problem I am having now is trying to compile my sketches for this bootloader/chip now. I am getting these error messages whenever i try and compile:
Board MySensors:avr:apm96 doesn't define a 'build.board' preference. Auto-set to: AVR_APM96 WARNING: Category '' in library UIPEthernet is not valid. Setting to 'Uncategorized' Warning: platform.txt from core 'MySensors AVR based boards' contains deprecated recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/{archive_file}" "{object_file}", automatically converted to recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}". Consider upgrading this core. sketch/Blink.ino.cpp:1:21: fatal error: Arduino.h: No such file or directory #include <Arduino.h> ^ compilation terminated. exit status 1 Error compiling for board APM Optiboot internal 1MHz noBOD 9600baud.
WoWould anyone have any ideas that I could try to fix this?
Thanks,
-
RE: Any plan to implement Ethernet GW?
out of curiosity, did you try a different name for the persistence file after deleting your first one, or did you use the same name?
-
RE: Any plan to implement Ethernet GW?
Haven't had any issues with the sensors I have on my Dev unit; so far so good.
Are you thinking of releasing the ethernet GW code in this weeks update?
-
RE: How To: 2 Door Chime Automation Hack (Thanks @petewill)
Here is an updated code for the doorbell. Still for two door chime system, updated for API version 1.5.4 and re-wrote from scratch.
Let me know if there are any issues.
Version 2.1 of the code:
/* * 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.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. */ #include <MySensor.h> #include <SPI.h> #include <Bounce2.h> #define NODE_ID 2 // or set to AUTO if you want gw to assign a NODE_ID for you. #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_0 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_1 1 // Child ID for the back doorbell sensor #define CHILD_ID_2 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; MySensor gw; MyMessage msg(CHILD_ID_2, CHIME_MUTE); MyMessage frontDoorbell(CHILD_ID_0, V_TRIPPED); MyMessage backDoorbell(CHILD_ID_1, V_TRIPPED); MyMessage chimeMute(CHILD_ID_2, V_STATUS); 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() { gw.begin(incomingMessage, NODE_ID); // Send the sketch version information to the gateway and Controller gw.sendSketchInfo("2 Door bell/chime Monitor", "2.1"); // 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); // Register all sensors to gw (they will be created as child devices) gw.present(CHILD_ID_0, S_MOTION); gw.present(CHILD_ID_1, S_MOTION); gw.present(CHILD_ID_2, S_LIGHT); gw.send(msg.set(CHILD_ID_2, CHIME_MUTE)); // 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 loop() { gw.process(); 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); gw.send(frontDoorbell.set(1)); gw.wait(50); digitalWrite(FRONT_CHIME_RELAY, FRONT_CHIME_RELAY_OFF); gw.send(frontDoorbell.set(0)); previousMillis = currentMillis; } if ( ((unsigned long)(currentMillis - previousMillis) >= pestTimeout) && valueF != HIGH && CHIME_MUTE == 0) { gw.send(frontDoorbell.set(1)); gw.wait(50);; gw.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); gw.send(backDoorbell.set(1)); gw.wait(450); digitalWrite(BACK_CHIME_RELAY, BACK_CHIME_RELAY_OFF); gw.send(backDoorbell.set(0)); previousMillis = currentMillis; } if ( ((unsigned long)(currentMillis - previousMillis) >= pestTimeout) && valueB != HIGH && CHIME_MUTE == 0) { gw.send(backDoorbell.set(1)); gw.wait(50); gw.send(backDoorbell.set(0)); previousMillis = currentMillis; } } void incomingMessage(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_STATUS) { // Change relay state CHIME_MUTE = message.getBool(); gw.send(msg.set(CHILD_ID_2, CHIME_MUTE?CHIME_ON:CHIME_OFF)); // Store state in eeprom gw.saveState(CHILD_ID_2, CHIME_MUTE); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } }