@mfalkvidd so how do I change the title to reflect "SOLVED"?
Posts made by Eme
-
RE: [SOLVED] MySensors Raspberry Pi Gateway + Domotics Controller
-
RE: [SOLVED] MySensors Raspberry Pi Gateway + Domotics Controller
I have good news. I used a small prototype board for everything. made sure no line was more than 6 inches long. I soldered (My soldering sucks!) the capacitator right next to the radio and Bahm! Domoticz picked up all powered devices.
Lessons learnt, keep length of your wires short, nRf24 MUST have a decent capacitator to smoothen out power. Don't rely on GPIO pins to power it, use a regulator. Though help may come from all and sundry, its all up to you to check their suggestions... Thanks all for helping me.
I can finally retire my Nano-Serial Gateway! Wont be upgrading for a long time to come
-
RE: [SOLVED] MySensors Raspberry Pi Gateway + Domotics Controller
@eiten l think it's A+ it has Wifi and l run it "headless" with my old Nano Gateway connected to the 1 USB. But I'll looking forward to getting the Pi to work as both Gateway and Controller.
I want to use a prototype board and drop the long lines. Plus I'll also bring the cap closer to the nrf24 to see if that helps.
-
RE: [SOLVED] Stuck at I_FIND_PARENT_REQUEST presentation
@nono8223 I've this same problem... stock for days. I tried powering the radio directly with a 3.3volts regulator and capciator between GND and 3.3V pin of the nrf24 but still no luck.
I don't want to duplicate posts but the details of my issue can by found here
@Eme said in MySensors Raspberry Pi Gateway + Domotics Controller:Please someone help me...
-
RE: [SOLVED] MySensors Raspberry Pi Gateway + Domotics Controller
@eiten Don't know if the Pi model matters. I used a Pi Model A with wifi.
-
RE: [SOLVED] MySensors Raspberry Pi Gateway + Domotics Controller
@eiten Yes what does that mean in English:
-
RE: [SOLVED] MySensors Raspberry Pi Gateway + Domotics Controller
@eiten based on the suggestions "leaning towards" powering the rf24 from you and @mfalkvidd l fed the radio a regulated 3.3 with LD33V and l also brought the capacitator near the radio... yet I still cant register the nodes.
Pls what does "TSF:CKU:OK:FCTRL" mean?
-
RE: [SOLVED] MySensors Raspberry Pi Gateway + Domotics Controller
Thanks @eiten I thought I already shared that. I just hooked Node 5 to the laptop to get its log...
__ __ ____ | \/ |_ _/ ___| ___ _ __ ___ ___ _ __ ___ | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __| | | | | |_| |___| | __/ | | \__ \ _ | | \__ \ |_| |_|\__, |____/ \___|_| |_|___/\___/|_| |___/ |___/ 2.3.2 16 MCO:BGN:INIT REPEATER,CP=RNNRA---,FQ=16,REL=255,VER=2.3.2 27 MCO:BGN:BFR 28 TSM:INIT 29 TSF:WUR:MS=0 36 TSM:INIT:TSP OK 38 TSM:INIT:STATID=5 40 TSF:SID:OK,ID=5 41 TSM:FPAR 46 ?TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 764 TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 770 TSF:MSG:BC 1880 TSF:MSG:READ,7-7-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 1884 TSF:MSG:BC 2053 !TSM:FPAR:NO REPLY 2055 TSM:FPAR 2059 ?TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 2810 TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 2816 TSF:MSG:BC 3924 TSF:MSG:READ,7-7-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 3930 TSF:MSG:BC 4066 !TSM:FPAR:NO REPLY 4068 TSM:FPAR 4072 ?TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 4845 TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 4850 TSF:MSG:BC 5971 TSF:MSG:READ,7-7-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 5977 TSF:MSG:BC 6079 !TSM:FPAR:NO REPLY 6081 TSM:FPAR 6085 ?TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 6887 TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 6892 TSF:MSG:BC 8008 TSF:MSG:READ,7-7-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 8013 TSF:MSG:BC 8092 !TSM:FPAR:FAIL 8093 TSM:FAIL:CNT=1 8095 TSM:FAIL:DIS 8097 TSF:TDI:TSL 18099 TSM:FAIL:RE-INIT 18101 TSM:INIT 18107 TSM:INIT:TSP OK 18109 TSM:INIT:STATID=5 18112 TSF:SID:OK,ID=5 18114 TSM:FPAR 18118 ?TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 20059 TSF:MSG:READ,7-7-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 20064 TSF:MSG:BC 20125 !TSM:FPAR:NO REPLY 20127 TSM:FPAR 20131 ?TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 22094 TSF:MSG:READ,7-7-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 22099 TSF:MSG:BC 22140 !TSM:FPAR:NO REPLY 22142 TSM:FPAR 22147 ?TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 24135 TSF:MSG:READ,7-7-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 24140 TSF:MSG:BC 24155 !TSM:FPAR:NO REPLY 24157 TSM:FPAR 24161 ?TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 26169 !TSM:FPAR:FAIL 26170 TSM:FAIL:CNT=2 26172 TSM:FAIL:DIS 26174 TSF:TDI:TSL 36177 TSM:FAIL:RE-INIT 36179 TSM:INIT 36186 TSM:INIT:TSP OK 36188 TSM:INIT:STATID=5 36191 TSF:SID:OK,ID=5 36193 TSM:FPAR 36197 ?TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 38204 !TSM:FPAR:NO REPLY 38206 TSM:FPAR 38210 ?TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 38228 TSF:MSG:READ,7-7-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 38234 TSF:MSG:BC 40218 !TSM:FPAR:NO REPLY 40220 TSM:FPAR 40224 ?TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 40258 TSF:MSG:READ,7-7-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 40263 TSF:MSG:BC 42232 !TSM:FPAR:NO REPLY 42234 TSM:FPAR 42238 ?TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 42304 TSF:MSG:READ,7-7-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 42309 TSF:MSG:BC 44247 !TSM:FPAR:FAIL 44249 TSM:FAIL:CNT=3 44250 TSM:FAIL:DIS 44252 TSF:TDI:TSL 54255 TSM:FAIL:RE-INIT 54257 TSM:INIT 54263 TSM:INIT:TSP OK 54265 TSM:INIT:STATID=5 54268 TSF:SID:OK,ID=5 54270 TSM:FPAR 54275 ?TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 56282 !TSM:FPAR:NO REPLY 56284 TSM:FPAR 56288 ?TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 56393 TSF:MSG:READ,7-7-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 56398 TSF:MSG:BC 58296 !TSM:FPAR:NO REPLY 58298 TSM:FPAR 58302 ?TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 58434 TSF:MSG:READ,7-7-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 58439 TSF:MSG:BC 59362 TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: 59367 TSF:MSG:BC
It still cant find the Gateway, and I see it reads Node 7 and 2 request for registration too.
-
RE: [SOLVED] MySensors Raspberry Pi Gateway + Domotics Controller
Hello @mfalkvidd , l am a fan! I very honoured to have you look into my issue... to answer your questions...
No it's another Rf24 but from the same batch as the one on the nano Gateway and all my nodes. I still have a spare one lying around. I'll try it see if it makes any difference.
The Rf24 is powered directly from the Pi with a 220uf cap connected next to GPIO pins as described in the official Rasberry Pi Gateway guide. I'll post a picture of the setup.
Everything is still on the fly with Dupont cables and Leds on a bread board until everything works well.
Concerning proximity of nodes to Gateway and if I've moved them from their original place. Besides the Gateway now lying on my desk, all my nodes are still in their place around the hose. Node ID 2 is the Sprinkler from my kitchen downstairs (over 10 metres away between concrete walls) Node ID 7 is the Gate node outside the house (about 9 meters from my desk) and Node ID 5 which didn't show in the log (probably disconnected at the time) is right next to the PiGateway.
-
RE: [SOLVED] MySensors Raspberry Pi Gateway + Domotics Controller
Thanks for your response @Yveaux , l did notice 3 nodes at the time, but perhaps it didn't show on the portion of the log l shared. Yes l had been using a USB serial gateway attached to a Pi3 for over 2 years. I have tried my best to stay away from the "Bleeding Edge" of technology by staying with a stable version that has worked for me. I've been on MySenosors Ver 2.1.1 for a very long time. Just thought to update and Bahm! I'm in trouble. Can't connect to several nodes. Luckily MQTT still works, but all my MySensors nodes are down.
-
RE: [SOLVED] MySensors Raspberry Pi Gateway + Domotics Controller
Please someone help me...
-
[SOLVED] MySensors Raspberry Pi Gateway + Domotics Controller
I finally made up my mind to move from MySensors Ver 2.1.1 to the new 2.3.2 release. Before now, I had been using a Nano - Rf24 Gateway connected to USB of a Pi2 with Domoticz controller running. This had served me well over the years with minimal issues. I have several Nodes running 2.1 sketches scattered around my home.
From research, I noticed it was possible to run both Gateway & Controller off the Pi without need for additional hardware. I followed the step by step release notes at and also a procedue for building-a-raspberry-pi-gateway.
I used Cleareeprom Sketch to clear one Node (Node ID 5) and proceeded to biuld a new gateway on the Pi itself.My configuration values were
./configure --my-transport=rf24 --my-rf24-irq-pin=15 --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyUSB020 --my-controller-ip-address=127.0.0.1 --my-port=5003 --my-leds-err-pin=12 --my-leds-rx-pin=16 --my-leds-tx-pin=18
make
tested with sudo ./bin/mysgw
sudo make install
sudo systemctl enable mysgw.service
sudo systemctl start mysgw.servicemy "tail -f /var/log/syslog" revealed the following
/home/pi/MySensors$ tail -f /var/log/syslog Aug 21 11:57:54 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=2 Aug 21 11:57:54 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 21 11:57:54 IoTGateway mysgw: TSF:MSG:GWL OK Aug 21 11:57:55 IoTGateway mysgw: !TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 21 11:57:56 IoTGateway mysgw: TSF:MSG:READ,7-7-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 21 11:57:56 IoTGateway mysgw: TSF:MSG:BC Aug 21 11:57:56 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=7 Aug 21 11:57:56 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 21 11:57:56 IoTGateway mysgw: TSF:MSG:GWL OK Aug 21 11:57:56 IoTGateway mysgw: !TSF:MSG:SEND,0-0-7-7,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 21 11:57:58 IoTGateway mysgw: TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 21 11:57:58 IoTGateway mysgw: TSF:MSG:BC Aug 21 11:57:58 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=2 Aug 21 11:57:58 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 21 11:57:58 IoTGateway mysgw: TSF:MSG:GWL OK Aug 21 11:57:59 IoTGateway mysgw: !TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 21 11:57:59 IoTGateway mysgw: TSF:MSG:READ,7-7-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 21 11:57:59 IoTGateway mysgw: TSF:MSG:BC Aug 21 11:57:59 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=7 Aug 21 11:57:59 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 21 11:57:59 IoTGateway mysgw: TSF:MSG:GWL OK Aug 21 11:58:01 IoTGateway mysgw: !TSF:MSG:SEND,0-0-7-7,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 21 11:58:13 IoTGateway mysgw: TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 21 11:58:13 IoTGateway mysgw: TSF:MSG:BC Aug 21 11:58:13 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=2 Aug 21 11:58:13 IoTGateway mysgw: TSF:PNG:SEND,TO=0 Aug 21 11:58:13 IoTGateway mysgw: TSF:CKU:OK Aug 21 11:58:13 IoTGateway mysgw: TSF:MSG:GWL OK Aug 21 11:58:13 IoTGateway mysgw: !TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 21 11:58:17 IoTGateway mysgw: TSF:MSG:READ,7-7-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 21 11:58:17 IoTGateway mysgw: TSF:MSG:BC Aug 21 11:58:17 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=7 Aug 21 11:58:17 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 21 11:58:17 IoTGateway mysgw: TSF:MSG:GWL OK Aug 21 11:58:17 IoTGateway mysgw: !TSF:MSG:SEND,0-0-7-7,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 21 11:58:19 IoTGateway mysgw: TSF:MSG:READ,7-7-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 21 11:58:19 IoTGateway mysgw: TSF:MSG:BC Aug 21 11:58:19 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=7 Aug 21 11:58:19 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 21 11:58:19 IoTGateway mysgw: TSF:MSG:GWL OK Aug 21 11:58:19 IoTGateway mysgw: !TSF:MSG:SEND,0-0-7-7,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 21 11:58:31 IoTGateway mysgw: TSF:MSG:READ,7-7-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 21 11:58:31 IoTGateway mysgw: TSF:MSG:BC Aug 21 11:58:31 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=7 Aug 21 11:58:31 IoTGateway mysgw: TSF:PNG:SEND,TO=0 Aug 21 11:58:31 IoTGateway mysgw: TSF:CKU:OK Aug 21 11:58:31 IoTGateway mysgw: TSF:MSG:GWL OK Aug 21 11:58:31 IoTGateway mysgw: !TSF:MSG:SEND,0-0-7-7,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 21 11:58:31 IoTGateway mysgw: TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 21 11:58:31 IoTGateway mysgw: TSF:MSG:BC Aug 21 11:58:31 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=2 Aug 21 11:58:31 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 21 11:58:31 IoTGateway mysgw: TSF:MSG:GWL OK Aug 21 11:58:32 IoTGateway mysgw: !TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 21 11:58:33 IoTGateway mysgw: TSF:MSG:READ,7-7-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 21 11:58:33 IoTGateway mysgw: TSF:MSG:BC Aug 21 11:58:33 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=7 Aug 21 11:58:33 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 21 11:58:33 IoTGateway mysgw: TSF:MSG:GWL OK Aug 21 11:58:33 IoTGateway mysgw: !TSF:MSG:SEND,0-0-7-7,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 21 11:58:33 IoTGateway mysgw: TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 21 11:58:33 IoTGateway mysgw: TSF:MSG:BC Aug 21 11:58:33 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=2 Aug 21 11:58:33 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 21 11:58:33 IoTGateway mysgw: TSF:MSG:GWL OK Aug 21 11:58:34 IoTGateway mysgw: !TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 21 11:58:35 IoTGateway mysgw: TSF:MSG:READ,7-7-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 21 11:58:35 IoTGateway mysgw: TSF:MSG:BC Aug 21 11:58:35 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=7 Aug 21 11:58:35 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 21 11:58:35 IoTGateway mysgw: TSF:MSG:GWL OK Aug 21 11:58:35 IoTGateway mysgw: !TSF:MSG:SEND,0-0-7-7,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 21 11:58:35 IoTGateway mysgw: TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 21 11:58:35 IoTGateway mysgw: TSF:MSG:BC Aug 21 11:58:35 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=2 Aug 21 11:58:35 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 21 11:58:35 IoTGateway mysgw: TSF:MSG:GWL OK Aug 21 11:58:36 IoTGateway mysgw: !TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 21 11:58:37 IoTGateway mysgw: TSF:MSG:READ,7-7-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 21 11:58:37 IoTGateway mysgw: TSF:MSG:BC Aug 21 11:58:37 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=7 Aug 21 11:58:37 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 21 11:58:37 IoTGateway mysgw: TSF:MSG:GWL OK Aug 21 11:58:37 IoTGateway mysgw: !TSF:MSG:SEND,0-0-7-7,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
I can see 3 Nodes (Two Nodes running Ver 2.0 version sketches and one with the new Ver 2.3 sketch) trying to request for registration without luck. This tells me Transport with Rf24 is okay, but nothing else.
What must I do? How can I get the Domoticz to accept the new requests and create the devices? I have deleted the old MySensors hardware from Domoticz but it still wont register.
-
RE: MySensors 2.3.2 released
@skywatch Sorry I didn't respond to this question. I didnt change the sketch. I only updated the library and uploaded to the node with the new Library. DO I have to change the sketch altogether? My sketch is as follows...
// Example sketch showing how to control physical relays. // This example will remember relay state even after power failure. // Enable debug prints #define MY_DEBUG #define SLEEP_TIME 10000 //10 seconds // Enable and select radio type attached #define MY_RADIO_NRF24 #define MY_RF24_PA_LEVEL RF24_PA_HIGH // Options MAX to reach the furthest #define MY_NODE_ID 5 // Set this to fix your Radio ID or use AUTO or 1 #define MY_REPEATER_FEATURE #define MY_REGISTRATION_FEATURE // Forece registration #define MY_REGISTRATION_RETRIES 5 #include <Wire.h> #include <TimeLib.h> #include <SPI.h> #include <MySensors.h> // For Debug #ifdef DEBUG_ON #define DEBUG_PRINT(x) Serial.print(x) #define DEBUG_PRINTLN(x) Serial.println(x) #else #define DEBUG_PRINT(x) #define DEBUG_PRINTLN(x) #define SERIAL_START(x) #endif //#define SLEEP_TIME = 18000000 // Wait every 30 minutes #define RELAY_PIN 2 // Arduino Digital I/O pin number for first relay (second on pin+1 etc) #define NUMBER_OF_RELAYS 5 // Total number of attached relays #define RELAY_ON 1 // GPIO value to write to turn on attached relay #define RELAY_OFF 0 // GPIO value to write to turn off attached relay #define SKETCH_NAME "Water Tank Node" #define SKETCH_VERSION "0.3.2" #define CHILD_ID 0 MyMessage msg(1,V_LIGHT); void setup() { for (int sensor=1, pin=RELAY_PIN; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Then set relay pins to output mode pinMode(pin, OUTPUT); // Set relay to last known state (using eeprom storage) digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF); DEBUG_PRINT(F("Initialised Relay: ")); DEBUG_PRINT(F(sensor)); DEBUG_PRINT(F(" at pin ")); DEBUG_PRINT(F(pin)); DEBUG_PRINT(F(" (")); DEBUG_PRINT(F(loadState(pin))); DEBUG_PRINTLN(F(")")); } pinMode(A0, INPUT); // Then set etra sensor pins to input mode DEBUG_PRINTLN(F("Initialised additional Sensor: ")); } void presentation() { sendSketchInfo(SKETCH_NAME, SKETCH_VERSION); // Fetch relay status for (int sensor=1, pin=RELAY_PIN; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Register all sensors to gw (they will be created as child devices) present(sensor, S_BINARY); pinMode(pin, OUTPUT); // Then set relay pins in output mode boolean savedState = loadState(pin); // Set relay to last known state (using eeprom storage) digitalWrite(pin, savedState?RELAY_ON:RELAY_OFF); DEBUG_PRINT(F("Presented Relay at : ")); DEBUG_PRINTLN(F(pin)); send(msg.set(savedState? 0 : 1)); } DEBUG_PRINTLN(F("Sensor Presentation Complete")); } void loop() { // Alway process incoming messages whenever possible // Sleep until interrupt comes in on motion sensor. Send update every two minute. // sleep(digitalPinToInterrupt(RELAY_PIN), CHANGE, SLEEP_TIME); } void receive(const MyMessage &message){ // Change relay state if message is receieved //if (digitalRead(A0) == HIGH){ // // Sensor says tank is full do something // DEBUG_PRINTLN(F("Float Sensor High, 'Tank is Full'")); // digitalWrite(3, LOW); // Switch off tank pump // saveState(message.sensor, message.getBool()); // bool send(MyMessage &msg, bool ack); // // } if (message.type == V_STATUS){ // digitalWrite(message.sensor, !digitalRead(message.sensor)); if (message.getBool() == 0) { digitalWrite(message.sensor, LOW); // Store state in eeprom saveState(message.sensor, message.getBool()); } else //getBool() == 1 digitalWrite(message.sensor, HIGH); // Store state in eeprom saveState(message.sensor, message.getBool()); // digitalWrite(message.sensor-1+RELAY_PIN, message.getBool()?RELAY_ON:RELAY_OFF); // Write some debug info Serial.print("Incoming change for sensor ID: "); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } }
-
RE: MySensors 2.3.2 released
thanks @skywatch l took your advice cleared eeprom on only one node, and cloned my SD card before building a Rasberry Gateway/Controller since I was experiencing too much stress with the Nano-RPi gateway.
My Config was like:-
./configure --my-transport=rf24 --my-rf24-irq-pin=15 --my-gateway=serial --my-serial-is-pty --my-serial-port=/dev/ttyUSB020 --my-controller-ip-address=172.0.0.1 --my-leds-err-pin=12 --my-leds-rx-pin=16 --my-leds-tx-pin=18
I changed the Hardware on Domotics to point to the new virtual ttyUSB020 port that appeared on Domotics. but still no connection.
Rasberry Pi Gateway/Conmtroller Tail Log is asfollows
/home/pi/MySensors$ tail -f /var/log/syslog Aug 18 22:25:53 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 18 22:25:53 IoTGateway mysgw: TSF:MSG:GWL OK Aug 18 22:25:54 IoTGateway mysgw: !TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 18 22:25:55 IoTGateway systemd[1]: Started Session c4 of user pi. Aug 18 22:25:55 IoTGateway mysgw: TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 18 22:25:55 IoTGateway mysgw: TSF:MSG:BC Aug 18 22:25:55 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=2 Aug 18 22:25:55 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 18 22:25:55 IoTGateway mysgw: TSF:MSG:GWL OK Aug 18 22:25:56 IoTGateway mysgw: !TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 18 22:26:07 IoTGateway mysgw: TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 18 22:26:07 IoTGateway mysgw: TSF:MSG:BC Aug 18 22:26:07 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=2 Aug 18 22:26:07 IoTGateway mysgw: TSF:PNG:SEND,TO=0 Aug 18 22:26:07 IoTGateway mysgw: TSF:CKU:OK Aug 18 22:26:07 IoTGateway mysgw: TSF:MSG:GWL OK Aug 18 22:26:08 IoTGateway mysgw: !TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 18 22:26:09 IoTGateway mysgw: TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 18 22:26:09 IoTGateway mysgw: TSF:MSG:BC Aug 18 22:26:09 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=2 Aug 18 22:26:09 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 18 22:26:09 IoTGateway mysgw: TSF:MSG:GWL OK Aug 18 22:26:10 IoTGateway mysgw: !TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 18 22:26:12 IoTGateway mysgw: TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 18 22:26:12 IoTGateway mysgw: TSF:MSG:BC Aug 18 22:26:12 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=2 Aug 18 22:26:12 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 18 22:26:12 IoTGateway mysgw: TSF:MSG:GWL OK Aug 18 22:26:12 IoTGateway mysgw: !TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 18 22:26:14 IoTGateway mysgw: TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 18 22:26:14 IoTGateway mysgw: TSF:MSG:BC Aug 18 22:26:14 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=2 Aug 18 22:26:14 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 18 22:26:14 IoTGateway mysgw: TSF:MSG:GWL OK Aug 18 22:26:15 IoTGateway mysgw: !TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 18 22:26:26 IoTGateway mysgw: TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 18 22:26:26 IoTGateway mysgw: TSF:MSG:BC Aug 18 22:26:26 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=2 Aug 18 22:26:26 IoTGateway mysgw: TSF:PNG:SEND,TO=0 Aug 18 22:26:26 IoTGateway mysgw: TSF:CKU:OK Aug 18 22:26:26 IoTGateway mysgw: TSF:MSG:GWL OK Aug 18 22:26:26 IoTGateway mysgw: !TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 18 22:26:28 IoTGateway mysgw: TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 18 22:26:28 IoTGateway mysgw: TSF:MSG:BC Aug 18 22:26:28 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=2 Aug 18 22:26:28 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 18 22:26:28 IoTGateway mysgw: TSF:MSG:GWL OK Aug 18 22:26:28 IoTGateway mysgw: !TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 18 22:26:30 IoTGateway mysgw: TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 18 22:26:30 IoTGateway mysgw: TSF:MSG:BC Aug 18 22:26:30 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=2 Aug 18 22:26:30 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 18 22:26:30 IoTGateway mysgw: TSF:MSG:GWL OK Aug 18 22:26:30 IoTGateway mysgw: !TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 18 22:26:32 IoTGateway mysgw: TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 18 22:26:32 IoTGateway mysgw: TSF:MSG:BC Aug 18 22:26:32 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=2 Aug 18 22:26:32 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 18 22:26:32 IoTGateway mysgw: TSF:MSG:GWL OK Aug 18 22:26:32 IoTGateway mysgw: !TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 18 22:26:39 IoTGateway mysgw: TSF:MSG:READ,5-5-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 18 22:26:39 IoTGateway mysgw: TSF:MSG:BC Aug 18 22:26:39 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=5 Aug 18 22:26:39 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 18 22:26:39 IoTGateway mysgw: TSF:MSG:GWL OK Aug 18 22:26:39 IoTGateway mysgw: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 18 22:26:41 IoTGateway mysgw: TSF:MSG:READ,5-5-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 18 22:26:41 IoTGateway mysgw: TSF:MSG:BC Aug 18 22:26:41 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=5 Aug 18 22:26:41 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 18 22:26:41 IoTGateway mysgw: TSF:MSG:GWL OK Aug 18 22:26:41 IoTGateway mysgw: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 18 22:26:43 IoTGateway mysgw: TSF:MSG:READ,5-5-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 18 22:26:43 IoTGateway mysgw: TSF:MSG:BC Aug 18 22:26:43 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=5 Aug 18 22:26:43 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 18 22:26:43 IoTGateway mysgw: TSF:MSG:GWL OK Aug 18 22:26:43 IoTGateway mysgw: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 18 22:26:44 IoTGateway mysgw: TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 18 22:26:44 IoTGateway mysgw: TSF:MSG:BC Aug 18 22:26:44 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=2 Aug 18 22:26:44 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 18 22:26:44 IoTGateway mysgw: TSF:MSG:GWL OK Aug 18 22:26:44 IoTGateway mysgw: !TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 18 22:26:45 IoTGateway mysgw: TSF:MSG:READ,5-5-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 18 22:26:45 IoTGateway mysgw: TSF:MSG:BC Aug 18 22:26:45 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=5 Aug 18 22:26:45 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 18 22:26:45 IoTGateway mysgw: TSF:MSG:GWL OK Aug 18 22:26:45 IoTGateway mysgw: !TSF:MSG:SEND,0-0-5-5,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 18 22:26:46 IoTGateway mysgw: TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 18 22:26:46 IoTGateway mysgw: TSF:MSG:BC Aug 18 22:26:46 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=2 Aug 18 22:26:46 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 18 22:26:46 IoTGateway mysgw: TSF:MSG:GWL OK Aug 18 22:26:46 IoTGateway mysgw: !TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 18 22:26:48 IoTGateway mysgw: TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 18 22:26:48 IoTGateway mysgw: TSF:MSG:BC Aug 18 22:26:48 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=2 Aug 18 22:26:48 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 18 22:26:48 IoTGateway mysgw: TSF:MSG:GWL OK Aug 18 22:26:48 IoTGateway mysgw: !TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0 Aug 18 22:26:50 IoTGateway mysgw: TSF:MSG:READ,2-2-255,s=255,c=3,t=7,pt=0,l=0,sg=0: Aug 18 22:26:50 IoTGateway mysgw: TSF:MSG:BC Aug 18 22:26:50 IoTGateway mysgw: TSF:MSG:FPAR REQ,ID=2 Aug 18 22:26:50 IoTGateway mysgw: TSF:CKU:OK,FCTRL Aug 18 22:26:50 IoTGateway mysgw: TSF:MSG:GWL OK Aug 18 22:26:50 IoTGateway mysgw: !TSF:MSG:SEND,0-0-2-2,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
My Domoticz Log :-
2020-08-18 22:21:53.545 Sunrise: 06:22:00 SunSet: 18:47:00 2020-08-18 22:21:53.545 Day length: 12:25:00 Sun at south: 12:34:00 2020-08-18 22:21:53.545 Civil twilight start: 06:00:00 Civil twilight end: 19:08:00 2020-08-18 22:21:53.545 Nautical twilight start: 05:35:00 Nautical twilight end: 19:34:00 2020-08-18 22:21:53.545 Astronomical twilight start: 05:09:00 Astronomical twilight end: 19:59:00 2020-08-18 22:21:53.864 Active notification Subsystems: kodi (1/13) 2020-08-18 22:21:53.969 Starting shared server on: :::6144 2020-08-18 22:21:53.410 Status: Domoticz V2020.1 (c)2012-2020 GizMoCuz 2020-08-18 22:21:53.412 Status: Build Hash: 63fa969e4, Date: 2020-03-22 15:16:16 2020-08-18 22:21:53.413 Status: Startup Path: /home/pi/domoticz/ 2020-08-18 22:21:53.842 Status: PluginSystem: Started, Python version '3.7.3'. 2020-08-18 22:21:53.896 Status: WebServer(HTTP) started on address: :: with port 8080 2020-08-18 22:21:53.912 Status: WebServer(SSL) started on address: :: with port 443 2020-08-18 22:21:53.915 Status: Camera: settings (re)loaded 2020-08-18 22:21:53.969 Status: TCPServer: shared server started... 2020-08-18 22:21:53.970 Status: RxQueue: queue worker started... 2020-08-18 22:21:55.978 Status: MySensors: Worker started... 2020-08-18 22:21:55.979 Status: Hardware Monitor: Started 2020-08-18 22:21:56.979 MySensors: Gateway Ready... 2020-08-18 22:21:56.004 Status: NotificationSystem: thread started... 2020-08-18 22:21:56.005 Status: EventSystem: reset all events... 2020-08-18 22:21:56.010 Status: EventSystem: reset all device statuses... 2020-08-18 22:21:56.051 Status: PluginSystem: Entering work loop. 2020-08-18 22:21:56.159 Status: Python EventSystem: Initalizing event module. 2020-08-18 22:21:56.160 Status: EventSystem: Started 2020-08-18 22:21:56.160 Status: EventSystem: Queue thread started... 2020-08-18 22:21:56.979 Status: MySensors: Using serial port: /dev/ttyUSB020 2020-08-18 22:21:57.055 MySensors: Gateway Version: 2.3.2 2020-08-18 22:21:57.004 Status: MQTT: Connecting to 192.168.8.100:1883 2020-08-18 22:21:57.004 Error: MQTT: Failed to start, return code: 14 (Check IP/Port) 2020-08-18 22:22:49.016 Status: MQTT: Connecting to 192.168.8.100:1883 2020-08-18 22:22:49.218 Status: MQTT: connected to: 192.168.8.100:1883 2020-08-18 22:22:49.419 Status: MQTT: Subscribed 2020-08-18 22:24:00.705 Status: New sensors allowed for 5 minutes...
MySensor Node Serial Printout:
16 MCO:BGN:INIT REPEATER,CP=RNNRA---,FQ=16,REL=255,VER=2.3.2 27 TSM:INIT 28 TSF:WUR:MS=0 34 TSM:INIT:TSP OK 36 TSM:INIT:STATID=5 38 TSF:SID:OK,ID=5 40 TSM:FPAR 45 ?TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 2052 !TSM:FPAR:NO REPLY 2054 TSM:FPAR 2058 ?TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 4065 !TSM:FPAR:NO REPLY 4067 TSM:FPAR 4071 ?TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 6078 !TSM:FPAR:NO REPLY 6080 TSM:FPAR 6084 ?TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 8091 !TSM:FPAR:FAIL 8092 TSM:FAIL:CNT=1 8094 TSM:FAIL:DIS 8096 TSF:TDI:TSL 18098 TSM:FAIL:RE-INIT 18100 TSM:INIT 18106 TSM:INIT:TSP OK 18108 TSM:INIT:STATID=5 18111 TSF:SID:OK,ID=5 18113 TSM:FPAR 18117 ?TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 20124 !TSM:FPAR:NO REPLY 20126 TSM:FPAR 20130 ?TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 22138 !TSM:FPAR:NO REPLY 22140 TSM:FPAR 22145 ?TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 24153 !TSM:FPAR:NO REPLY 24155 TSM:FPAR 24159 ?TSF:MSG:SEND,5-5-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 26167 !TSM:FPAR:FAIL 26168 TSM:FAIL:CNT=2 26170 TSM:FAIL:DIS 26172 TSF:TDI:TSL
Still no luck. The node still wont present to the new gateway.
What am I doing wrong? All my devices are still down - 4 days on.
-
RE: MySensors 2.3.2 released
@Eme cleared eeprom with the sketch and loaded the Gateway Serial. I now have an error for an #include <nrf.h> I've updated boards and libraries but still can't get past the error
"NRFS Radio is not supported for this platform. " does this mean my Serial GW can't be upgraded since l use NRF24 radios? What am l fling wrong? All my nodes are down. Please help.
-
RE: MySensors 2.3.2 released
@skywatch thanks for the update. Should l write this sketch to the Gateway alone, on each node or on both? Are there any step by step guides to gracefully migrate with? I'm very cautious, I've nodes in faraway places, wouldn't want to have to start all over again.
-
RE: MySensors 2.3.2 released
Upgraded MS library and my my serial gateway sketch from 2.0.0 this evening - went well. Then noticed Nodes nolonger connect... Status LEDs no longer blick. Tried updating one node to 2.3.2 but it still won't conect. Is there a step by step guide? I have over 10 other nodes that Domotics can't find.
-
Pls Help: Sensor value shows in Domoticz Hardware TAB, but wont show on Switches
Please Help needed I have a Node with Sonar sensor and an digitalRead(A0) value from Node to Gateway. The value shows on Domoticz Hardware TAB, but wont show on Switches. I have stayed up all night looking for solutions without much luck. I sketch is as follows.
// Example sketch showing how to control physical relays. // This example will remember relay state even after power failure. // Enable debug prints #define MY_DEBUG ON // Enable and select radio type attached #define MY_RADIO_NRF24 #define MY_RF24_PA_LEVEL RF24_PA_HIGH // Options MAX to reach the furthest #define MY_NODE_ID 4 // Set this to fix your Radio ID or use AUTO or 1 #define MY_REGISTRATION_FEATURE // Force registration #define MY_REGISTRATION_RETRIES 5 #include <Wire.h> #include <TimeLib.h> #include <SPI.h> #include <MySensors.h> #include <NewPing.h> // For Debug #ifdef DEBUG_ON #define DEBUG_PRINT(x) Serial.print(x) #define DEBUG_PRINTLN(x) Serial.println(x) #else #define DEBUG_PRINT(x) #define DEBUG_PRINTLN(x) #define SERIAL_START(x) #endif #define RELAY_PIN 2 // Arduino Digital I/O pin number for first relay (second on pin+1 etc) #define NUMBER_OF_RELAYS 5 // Total number of attached relays #define RELAY_ON 1 // GPIO value to write to turn on attached relay #define RELAY_OFF 0 // GPIO value to write to turn off attached relay #define SKETCH_NAME "Generator Node" #define SKETCH_VERSION "1.3.1" #define CHILD_ID 0 MyMessage msgNEPA(0, V_STATUS); MyMessage msg(CHILD_ID, V_STATUS); MyMessage msgTank1(1, V_VOLUME); MyMessage msgTank2(8, V_VOLUME); boolean sensorState, lastSensorState; //constant for the sonar HC-SR04 sensor #define TRIGGER_PIN 8 #define ECHO_PIN 7 #define MAX_DISTANCE 300 //distance max measured //constant to calculate the volume of the tank #define high_water_level 30 //tank depth from the lowest point to the max water level #define distance_sensor 10 //was 30 = distance in cm between the max water level and the sensor #define tank_volume 1000 //tank volume (10000 default) when it is fitted to the max water level unsigned long SLEEP_TIME = 5000; // Sleep time between reads (in milliseconds) NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance. int lastDist; bool metric = true; void setup() { for (int sensor=1, pin=RELAY_PIN; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Then set relay pins to output mode pinMode(pin, OUTPUT); // Set relay to last known state (using eeprom storage) digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF); DEBUG_PRINT(F("Initialised Relay: ")); DEBUG_PRINT(F(sensor)); DEBUG_PRINT(F(" at pin ")); DEBUG_PRINT(F(pin)); DEBUG_PRINT(F(" (")); DEBUG_PRINT(F(loadState(sensor))); DEBUG_PRINTLN(F(")")); } pinMode(A0, INPUT); // Then set etra sensor pins to input mode pinMode(A1, INPUT); // Float Sensor for Gen fuel Tank pinMode(A2, INPUT); // Spare Sensor Readout DEBUG_PRINTLN(F("Initialize additional Sensor: ")); } void presentation() { sendSketchInfo(SKETCH_NAME, SKETCH_VERSION); // Manually present the additional 3 sensors present(0, S_BINARY); pinMode(A0, INPUT); // Then set relay pins in output mode boolean savedState = loadState(A0); // Set relay to last known state (using eeprom storage) digitalWrite(A0, savedState?RELAY_ON:RELAY_OFF); DEBUG_PRINT(F("Presented Relay at : ")); DEBUG_PRINTLN(F(A0)); send(msg.set(savedState? 0 : 1)); // Fetch relay status for (int sensor=1, pin=RELAY_PIN; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Register all sensors to gw (they will be created as child devices) present(sensor, S_BINARY); pinMode(pin, OUTPUT); // Then set relay pins in output mode savedState = loadState(pin); // Set relay to last known state (using eeprom storage) digitalWrite(pin, savedState?RELAY_ON:RELAY_OFF); DEBUG_PRINT(F("Presented Relay st : ")); DEBUG_PRINTLN(F(pin)); send(msg.set(savedState? 0 : 1)); } // DEBUG_PRINTLN(F("Sensor Presentation Complete")); // Manually present the additional 2 sensors present(6, S_WATER); pinMode(A1, INPUT); // Then set relay pins in output mode savedState = loadState(A1); // Set relay to last known state (using eeprom storage) digitalWrite(A1, savedState?RELAY_ON:RELAY_OFF); DEBUG_PRINT(F("Presented Relay at : ")); DEBUG_PRINTLN(F(A1)); send(msg.set(savedState? 0 : 1)); } void loop() { // Alway process incoming messages whenever possible // Sleep until interrupt comes in on motion sensor. Send update every two minute. // sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME); Serial.print("Fuel Level: "); Serial.print(tank_level("liters")); Serial.print("L"); Serial.print("("); Serial.print(tank_level("percent")); Serial.println("%)"); send(msgTank1.set(tank_level("liters"))); if(digitalRead(A0) == LOW){ DEBUG_PRINTLN(F("There is no Light")); Serial.println(sensorState? "Light On" : "Light Off"); send(msgNEPA.set(sensorState?"0":"0")); // Update gateway on change of state } else { DEBUG_PRINTLN(F("Up NEPA!")); Serial.println(sensorState? "Light Off" : "Light On"); send(msgNEPA.set(sensorState?"1":"1")); // Update gateway on change of state } wait(2000); // use for debuging } void receive(const MyMessage &message){ // Change relay state if message is received if (digitalRead(A0) == HIGH){ // Sensor says tank is full do something // DEBUG_PRINTLN(F("Float Sensor High, 'Tank is Full'")); // digitalWrite(3, LOW); // Switch off tank pump saveState(message.sensor, message.getBool()); bool send(MyMessage &msgNEPA, bool ack); } if (message.type == V_STATUS){ // digitalWrite(message.sensor, !digitalRead(message.sensor)); if (message.getBool() == 0) { digitalWrite(message.sensor, LOW); // Store state in eeprom saveState(message.sensor, message.getBool()); } else //getBool() == 1 digitalWrite(message.sensor, HIGH); // Store state in eeprom saveState(message.sensor, message.getBool()); // digitalWrite(message.sensor-1+RELAY_PIN, message.getBool()?RELAY_ON:RELAY_OFF); // Write some debug info Serial.print("Incoming change for sensor ID: "); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } } int tank_level(String unit) //function to measure and convert the tank volume { int level_liters = 0,level_percent = 0, echo_us = 0, echo_cm = 0, water_level_cm = 0; // int level_liters,level_percent, echo_us, echo_cm, water_level_cm; echo_us = sonar.ping_median(); //return the median time of 5measures between the ping and the echo in microseconds echo_cm = echo_us / US_ROUNDTRIP_CM; //convert the echo time to distance in cm. water_level_cm = high_water_level - (echo_cm - distance_sensor); level_liters = water_level_cm * (tank_volume / high_water_level); level_percent = (water_level_cm * 100) / high_water_level; if (unit == "liters") { return level_liters; } else if (unit == "percent") { return level_percent; } else { return 0; } }
-
RE: New to Domoticz, joining it with Vera and Mysensors question
@dbemowsk Yes you are right.
Domoticz (the Controller, just like Vera) is the one with the DB. The Gateway just sends messages to and from the controller. MySensors needs a gateway to communicate with all nodes. the Controller automates and facilitates the interactions with the nodes and gateways... -
RE: New to Domoticz, joining it with Vera and Mysensors question
@homer I have no experience with Vera, and only starting out with Domoticz like you, but your MS Gateway just relays the traffic from your nodes to your Controller (Domoticz). it wont have any details to remember or pass on ... its like a listening post for Nodes for onward transmission to controller, Subscribed Brokers or other nodes.
If I am wrong others would correct me.
-
RE: Error sending switch command at Gateway
@eme Okay I solved this by redoing the MySensors Gateway added 4.7uf cap and everything works fine now.
-
RE: 💬 Easy/Newbie PCB for MySensors
@mickecarlsson I found this out and wrote it above that D6 is not connected at all... but it was promptly swept aside cos nobody had reported it before now. I am glad someone else saw it, and that you had the notion to check. D4 is also not connected to the test area. I have been connecting directly to the Nano.
-
RE: 💬 Easy/Newbie PCB for MySensors
@sundberg84 Yes you are right I meant to say ProMini not Nano - I have 18 of these PCB - not so happy I have to solder directly to the Arduino - that's exactly what I was avoiding in the first place. Do you have a good relay block sketch that works? Much appreciated if you can help.
One last thing, I am trying to run a node off a 12Volts battery, can you explain this image below again?
- Will this work for a 5V Promini?
- What are the blue lines? and
- what are the red lines?
-
Error sending switch command at Gateway
Hello All...
I am having a problem with sending a 4 relay block code to Domoticz Gateway … sometimes the relays switch without any problem, but other times, it breaks out to an "Error sending switch command".I saw an earlier post at https://forum.mysensors.org/topic/4658/solved-error-sending-switch-command with the same issue. The solution proffered there didn't have much impart. One second it's working fine and the next its breaking into errors.
I couldn't find a .1uf Capacitor, so I used an electrolytic 1uf instead. Worked fine in another Nfr+ radio Project, but I don't know if that's the problem here. My sketch is a follows:-
// Example sketch showing how to control physical relays. // This example will remember relay state even after power failure. // Enable debug prints #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 #define MY_NODE_ID 6 // Set this to fix your Radio ID or use AUTO or 1 #define MY_REGISTRATION_FEATURE // Forece registration #define MY_REGISTRATION_RETRIES 5 #include <Wire.h> #include <TimeLib.h> #include <SPI.h> #include <MySensors.h> #include <LCD.h> #include <LiquidCrystal.h> #include <LiquidCrystal_I2C.h> // For Debug #ifdef DEBUG_ON #define DEBUG_PRINT(x) Serial.print(x) #define DEBUG_PRINTLN(x) Serial.println(x) #else #define DEBUG_PRINT(x) #define DEBUG_PRINTLN(x) #define SERIAL_START(x) #endif #define RELAY_PIN 2 // Arduino Digital I/O pin number for first relay (second on pin+1 etc) #define NUMBER_OF_RELAYS 4 // Total number of attached relays #define RELAY_ON 0 // GPIO value to write to turn on attached relay #define RELAY_OFF 1 // GPIO value to write to turn off attached relay #define SKETCH_NAME "Swimming Pool Node" #define SKETCH_VERSION "0.1.4" #define CHILD_ID 0 MyMessage msg(1,V_LIGHT); unsigned long SLEEP_TIME = 5000; // Sleep time inbetween reads in milliseconds void setup() { for (int sensor=1, pin=RELAY_PIN; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Then set relay pins in output mode pinMode(pin, OUTPUT); // Set relay to last known state (using eeprom storage) // digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF); // to remember last state digitalWrite(pin, loadState? 0 : 0); // Keep everything off after power failure } } void presentation() { sendSketchInfo(SKETCH_NAME, SKETCH_VERSION); // Fetch relay status for (int sensor=1, pin=RELAY_PIN; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Register all sensors to gw (they will be created as child devices) present(sensor, S_BINARY); pinMode(pin, OUTPUT); // Then set relay pins in output mode // boolean savedState = loadState(sensor); // Set relay to last known state (using eeprom storage) // digitalWrite(pin, savedState?RELAY_ON:RELAY_OFF); // send(msg.set(savedState? 0 : 1)); } DEBUG_PRINTLN(F("Sensor Presentation Complete")); } void loop() { // Alway process incoming messages whenever possible // Sleep until interrupt comes in on motion sensor. Send update every two minute. // sleep(digitalPinToInterrupt(msg.sensor-1+RELAY_PIN), CHANGE, SLEEP_TIME); wait(SLEEP_TIME); } void receive(const MyMessage &message){ // Change relay state if message is receieved if (message.type == V_STATUS){ digitalWrite(message.sensor-1+RELAY_PIN, message.getBool()?RELAY_ON:RELAY_OFF); // Store state in eeprom saveState(message.sensor-1+RELAY_PIN, message.getBool()); // Write some debug info Serial.print("Incoming change for sensor ID: "); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } }
I hear tagging this trio solves problems, so here goes... @tekka, @kk02067 and @hek to help me with this one. So sorry guys.
-
RE: 💬 Easy/Newbie PCB for MySensors
@Sunberg84 I bought them off Ebay via this very site... The Packing List reads Shipped by Abdera's Sundberg Ostra Gransgatan 2, Lonsboda, Sverige 28070, SE. I believe that's you.
Well I am forced to solder directly to the Nano pins, and so far so good. I think you should help with a 4 relay sketch that works. My appears to be a hit and run, works in the morning and fails after a while. but I am learning as I go. -
RE: [SOLVED] Error sending switch command
Hello @TheoL I am having the same problem with a slightly similar sketch. the delay didn't have much impart. One second its working fine and the next its breaking into errors. I couldn't find a .1uf Capacitor, so I used electrolytic 1uf instead. Worked fine in the Sprinkler Project, but I don't know if that's the problem here. My sketch is a follows:-
// Example sketch showing how to control physical relays. // This example will remember relay state even after power failure. // Enable debug prints #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 #define MY_NODE_ID 6 // Set this to fix your Radio ID or use AUTO or 1 #define MY_REGISTRATION_FEATURE // Forece registration #define MY_REGISTRATION_RETRIES 5 #include <Wire.h> #include <TimeLib.h> #include <SPI.h> #include <MySensors.h> #include <LCD.h> #include <LiquidCrystal.h> #include <LiquidCrystal_I2C.h> // For Debug #ifdef DEBUG_ON #define DEBUG_PRINT(x) Serial.print(x) #define DEBUG_PRINTLN(x) Serial.println(x) #else #define DEBUG_PRINT(x) #define DEBUG_PRINTLN(x) #define SERIAL_START(x) #endif #define RELAY_PIN 2 // Arduino Digital I/O pin number for first relay (second on pin+1 etc) #define NUMBER_OF_RELAYS 4 // Total number of attached relays #define RELAY_ON 0 // GPIO value to write to turn on attached relay #define RELAY_OFF 1 // GPIO value to write to turn off attached relay #define SKETCH_NAME "Swimming Pool Node" #define SKETCH_VERSION "0.1.4" #define CHILD_ID 0 MyMessage msg(1,V_LIGHT); unsigned long SLEEP_TIME = 5000; // Sleep time inbetween reads in milliseconds void setup() { for (int sensor=1, pin=RELAY_PIN; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Then set relay pins in output mode pinMode(pin, OUTPUT); // Set relay to last known state (using eeprom storage) // digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF); // to remember last state digitalWrite(pin, loadState? 0 : 0); // Keep everything off after power failure } } void presentation() { sendSketchInfo(SKETCH_NAME, SKETCH_VERSION); // Fetch relay status for (int sensor=1, pin=RELAY_PIN; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Register all sensors to gw (they will be created as child devices) present(sensor, S_BINARY); pinMode(pin, OUTPUT); // Then set relay pins in output mode // boolean savedState = loadState(sensor); // Set relay to last known state (using eeprom storage) // digitalWrite(pin, savedState?RELAY_ON:RELAY_OFF); // send(msg.set(savedState? 0 : 1)); } DEBUG_PRINTLN(F("Sensor Presentation Complete")); } void loop() { // Alway process incoming messages whenever possible // Sleep until interrupt comes in on motion sensor. Send update every two minute. // sleep(digitalPinToInterrupt(msg.sensor-1+RELAY_PIN), CHANGE, SLEEP_TIME); wait(SLEEP_TIME); } void receive(const MyMessage &message){ // Change relay state if message is receieved if (message.type == V_STATUS){ digitalWrite(message.sensor-1+RELAY_PIN, message.getBool()?RELAY_ON:RELAY_OFF); // Store state in eeprom saveState(message.sensor-1+RELAY_PIN, message.getBool()); // Write some debug info Serial.print("Incoming change for sensor ID: "); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } }
-
RE: 💬 Easy/Newbie PCB for MySensors
I eventually got it to work. I am not using the EasyNewbie to power the load (its for 24volts swimming pool light). Couldn't get the 4th relay to work - not sure why its not responding to the controller. but I noticed some bug with my batch of 16 PCB -
Okay I think I have seen some bugs... my batch of EasyNewbie Rev 10 has some hardware issues - The provisions to attach sensors are not correctly marked. D6 doesn't actually connect to D6 pin on the Arduino (must have failed a via somewhere). I am not sure how many pins are used for the radio and other components, but if you intend to use this for a small project, I will avoid D8 - D13 as they appears to be taken. D1 and D2 are used for the TX & RX so you only have D2 - D6 to play with (more than enough pins for a newbie if you ask me).
-
RE: 💬 Easy/Newbie PCB for MySensors
@sundberg84 I have the Domoticz log below. but just incase it doesn't reveal much, do you have a working sketch for EasyNewbie and a 4-relay module block?
2019-04-05 22:28:20.172 (My Sensors Gateway) Light/Switch (Light) 2019-04-05 22:28:21.229 (My Sensors Gateway) Light/Switch (Light) 2019-04-05 22:28:22.169 (My Sensors Gateway) Light/Switch (Light) 2019-04-05 22:28:55.333 Status: MySensors: Node: 3, Sketch Name: Base Relay Node 2019-04-05 22:28:56.459 (My Sensors Gateway) Light/Switch (Light) 2019-04-05 22:29:00.141 Status: LUA: All based event fired 2019-04-05 22:29:53.736 Status: User: Eme initiated a switch command (29/Light/On) 2019-04-05 22:29:54.297 (My Sensors Gateway) Light/Switch (Light) 2019-04-05 22:29:57.701 Status: User: Eme initiated a switch command (29/Light/Off) 2019-04-05 22:29:58.206 (My Sensors Gateway) Light/Switch (Light) 2019-04-05 22:30:00.533 Status: User: Eme initiated a switch command (28/Light/On) 2019-04-05 22:30:00.534 Status: LUA: All based event fired 2019-04-05 22:30:01.729 (My Sensors Gateway) Light/Switch (Light) 2019-04-05 22:30:07.427 (My Sensors Gateway) Light/Switch (Light) 2019-04-05 22:30:07.095 Status: User: Eme initiated a switch command (27/Light/On) 2019-04-05 22:30:13.674 Status: User: Eme initiated a switch command (29/Light/On) 2019-04-05 22:30:15.706 (My Sensors Gateway) Light/Switch (Light) 2019-04-05 22:30:19.773 Status: User: Eme initiated a switch command (26/Light/On) 2019-04-05 22:30:20.138 (My Sensors Gateway) Light/Switch (Light) 2019-04-05 22:30:55.858 (My Sensors Gateway) Light/Switch (Light) 2019-04-05 22:30:55.427 Status: User: Eme initiated a switch command (26/Light/Off) 2019-04-05 22:30:59.611 (My Sensors Gateway) Light/Switch (Light) 2019-04-05 22:30:59.256 Status: User: Eme initiated a switch command (29/Light/Off) 2019-04-05 22:31:00.280 Status: LUA: All based event fired 2019-04-05 22:31:02.813 Status: User: Eme initiated a switch command (27/Light/Off) 2019-04-05 22:31:03.242 (My Sensors Gateway) Light/Switch (Light) 2019-04-05 22:31:06.944 Status: User: Eme initiated a switch command (28/Light/Off) 2019-04-05 22:31:07.393 (My Sensors Gateway) Light/Switch (Light) 2019-04-05 22:31:22.892 (My Sensors Gateway) Light/Switch (Light) 2019-04-05 22:31:22.527 Status: User: Eme initiated a switch command (26/Light/On) 2019-04-05 22:32:00.351 Status: LUA: All based event fired ```
-
RE: 💬 Easy/Newbie PCB for MySensors
Hello Sundberg84 et al,
I purchased Easy Newbie PCB (Rev 10) with the hope of jumping into the IoT rave... I tried to create the Gateway - and it works perfectly. I also found and created an advanced Water Sprinkler MyS project by Pete and Co!... that also worked perfectly.However, I cant seem to get simpler beginner sketches to work with EasyNewbie. I have soldered the need components (the regulated version). I plan to connect to a 4 relay module, but for now, I am simulating the relay with a simple LED attached to D2. I have uploaded the following sketch which was originally written for version 1.0 MySensors - but have been corrected using guidelines I found for converting 1.0 - 2.0 version. but still no cheese - the controller (Domoticz) displays the Node, but not the complete child nodes, - the LED connected to pin D2 (or D3, D5..) on the Easy Newbie doesn't light up even when I toggle the switches and devices on controller. Don't know what I might be doing wrong, please help.
// Example sketch showing how to control physical relays. // This example will remember relay state even after power failure. // Enable debug prints #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 #define MY_NODE_ID 4 // Set this to fix your Radio ID or use AUTO or 1 #define MY_REGISTRATION_FEATURE // Forece registration #define MY_REGISTRATION_RETRIES 5 #include <Wire.h> #include <TimeLib.h> #include <SPI.h> #include <MySensors.h> #include <LCD.h> #include <LiquidCrystal.h> #include <LiquidCrystal_I2C.h> // For Debug #ifdef DEBUG_ON #define DEBUG_PRINT(x) Serial.print(x) #define DEBUG_PRINTLN(x) Serial.println(x) #else #define DEBUG_PRINT(x) #define DEBUG_PRINTLN(x) #define SERIAL_START(x) #endif //#define RELAY_1 2 // Arduino Digital I/O pin number for first relay (second on pin+1 etc) #define RELAY_PIN 3 #define NUMBER_OF_RELAYS 4 // Total number of attached relays #define RELAY_ON 0 // GPIO value to write to turn on attached relay #define RELAY_OFF 1 // GPIO value to write to turn off attached relay #define SKETCH_NAME "Base Relay Node" #define SKETCH_VERSION "0.1.2" #define CHILD_ID 0 MyMessage msg(1,V_LIGHT); //void before() void setup() { for (int sensor=1, pin=RELAY_PIN; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Then set relay pins in output mode pinMode(pin, OUTPUT); // Set relay to last known state (using eeprom storage) digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF); } } void presentation() { sendSketchInfo(SKETCH_NAME, SKETCH_VERSION); // Fetch relay status for (int sensor=1, pin=RELAY_PIN; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Register all sensors to gw (they will be created as child devices) // present(sensor, S_BINARY); present(sensor, S_LIGHT); // Then set relay pins in output mode pinMode(pin, OUTPUT); // Set relay to last known state (using eeprom storage) boolean savedState = loadState(sensor); digitalWrite(pin, savedState?RELAY_ON:RELAY_OFF); send(msg.set(savedState? 1 : 0)); } DEBUG_PRINTLN(F("Sensor Presentation Complete")); } void loop() { // Alway process incoming messages whenever possible // Sleep until interrupt comes in on motion sensor. Send update every two minute. // sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME); // update Relays; for (int sensor=1, pin=RELAY_PIN; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Register all sensors to gw (they will be created as child devices) // present(sensor, S_BINARY); send(msg.set(sensor).set(false), false); wait(50); } } void incomingMessage(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (msg.type==V_STATUS) { // Change relay state digitalWrite(msg.sensor-1+RELAY_PIN, msg.getBool()?RELAY_ON:RELAY_OFF); // Store state in eeprom saveState(msg.sensor, msg.getBool()); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(msg.sensor); Serial.print(", New status: "); Serial.println(msg.getBool()); } }
-
RE: relay motion domoticz help
@floris can you post the final sketch you used? I am having the same issue.