Hi, is there any way to check the current gateway operating parameters? My purpose is to check the radio channel and power level set before compilation but I would be glad if I could check other configurable parameters. I looked at Makefile.inc and found some flags set, but not the information I was looking for (does it mean that the default values are set)? Debug logs neither provide these informations.
Damian
@Damian
Best posts made by Damian
-
RE: 💬 Building a Raspberry Pi Gateway
Latest posts made by Damian
-
RE: 💬 AC-DC double solid state relay module
Hi,
did you consider redesigning the PCB using mini nrf24l01+ like this:
It could compact the size of the whole device. Moreover it would be great to have GND and Vcc (3.3V or 5V), and 4 GPIO (ie. 2 analog, 2 digital) pins led out on the PCB (there are 6 holes on the edge not used as I understand?). It would be great to have an option to connect some additional sensors (I use 2 dht22 sensors for environment monitoring in some projects). -
RE: 💬 Security & Signing
@anticimex Yep, remodelling receive() function by adding variables and assigning values respectively message.sensor and message.getBool at the beginning got the job done. Now it works like a charm. Moreover, the whitelisting feature also works now - I had to do something wrong previously. Thank you once again for your help.
-
RE: 💬 Security & Signing
@anticimex Thank you, I'll test it and let you know if it helped. PS. debug prints sent before was created in cito, this is my original script. But you find it well, it was instead of:
Serial.print("\nRelay State: "); Serial.println(relayState[sensor]);
and
Serial.print("Relay state after if: "); Serial.println(relayState[message.sensor]);
So basically the sections that you've mentioned as a possibly buggy.
-
RE: 💬 Security & Signing
@anticimex Sure, here it is (still under development so there are some minor, I hope, bugs)
// Enable debug prints to serial monitor //#define MY_DEBUG #define MY_DEBUG_VERBOSE_SIGNING #define MY_SIGNING_SOFT #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7 #define MY_SIGNING_REQUEST_SIGNATURES #define MY_RADIO_NRF24 #define MY_TRANSPORT_WAIT_READY_MS 5000 #define MY_NODE_ID 3 #include <MySensors.h> #include <Bounce2.h> #include <DHT.h> /*ZMIENIAMY TYLKO TU*/ #define R_CHILD_ID 0 #define BUTTON_PIN A0 #define RELAY_PIN 3 #define NUMBER_OF_RELAYS 2 #define RELAY_ON 1 #define RELAY_OFF 0 #define T_CHILD_ID 10 #define H_CHILD_ID 11 #define DHT_PIN 8 #define SENSOR_TEMP_OFFSET 0 unsigned long waitDelay = 100; unsigned long connStatusCheckPeriod = 5*1000.; unsigned long tempHumCheckPeriod = 300*1000.; /*KONIEC ZMIAN*/ Bounce debouncer[NUMBER_OF_RELAYS]; DHT dht; bool metric = true; float temp = 0.0; float hum = 0.0; MyMessage msgTemp(T_CHILD_ID, V_TEMP); MyMessage msgHum(H_CHILD_ID, V_HUM); MyMessage msg[NUMBER_OF_RELAYS]; bool firstRun = true; bool relayState[NUMBER_OF_RELAYS] = {false}; bool connectionState = false; bool controllerState [NUMBER_OF_RELAYS] = {false}; bool wasOffline = true; unsigned long currentTime = 0; unsigned long oldTime = 0; unsigned long oldTimeSensor = 0; unsigned long receiveTimeOld = 0; unsigned long receiveTimeNew = 0; bool buttonValue[NUMBER_OF_RELAYS] = {0}; bool oldButtonValue[NUMBER_OF_RELAYS] = {0}; void before() { } void setup(){ for (int i=0, r_pin=RELAY_PIN, b_pin=BUTTON_PIN; i<NUMBER_OF_RELAYS; i++, r_pin++, b_pin++) { pinMode(b_pin, INPUT_PULLUP); debouncer[i].attach(b_pin); debouncer[i].interval(5); pinMode(r_pin, OUTPUT); digitalWrite(r_pin, RELAY_OFF); Serial.print("Setup b_pin:"); Serial.println(b_pin); } dht.setup(DHT_PIN); } void presentation() { sendSketchInfo("MultiRelay", "1.0"); for (int i=0, r_id=R_CHILD_ID; i<NUMBER_OF_RELAYS; i++, r_id++) { present(r_id, S_BINARY); msg[i] = MyMessage(r_id, V_STATUS); } present(H_CHILD_ID, S_HUM); present(T_CHILD_ID, S_TEMP); metric = getControllerConfig().isMetric; } void loop() { currentTime = millis(); if (firstRun) { firstRunFunc(); } if (currentTime - oldTime >= connStatusCheckPeriod) { oldTime = currentTime; connectionState = checkConnection(); if (connectionState && wasOffline){ for(int i=0;i<NUMBER_OF_RELAYS;i++) { send(msg[i].set(relayState[i]), false); } } Serial.print("Temp / Hum: "); Serial.print(temp); Serial.print(" / "); Serial.println(hum); } if (currentTime - oldTimeSensor >= tempHumCheckPeriod) { oldTimeSensor = currentTime; dht.readSensor(true); temp = dht.getTemperature(); temp += SENSOR_TEMP_OFFSET; hum = dht.getHumidity(); send(msgTemp.set(temp, 1)); send(msgHum.set(hum, 1)); } for(int i=0;i<NUMBER_OF_RELAYS;i++) { debouncer[i].update(); buttonValue[i] = debouncer[i].read(); if (buttonValue[i] != oldButtonValue[i] && buttonValue[i]==0) { relayState[i] = !relayState[i]; switch (connectionState) { case 0: workOffline(); break; case 1: workOnline(); break; } } oldButtonValue[i] = buttonValue[i]; } } void receive(const MyMessage &message) { if (message.type==V_STATUS) { if (firstRun) { relayState[message.sensor] = message.getBool(); } else { controllerState[message.sensor] = message.getBool(); Serial.print("\nRelay State: "); Serial.println(relayState[message.sensor]); Serial.print("Switching to: "); Serial.println(controllerState[message.sensor]); if (controllerState[message.sensor] != relayState[message.sensor]) { relayState[message.sensor] = controllerState[message.sensor]; wait(waitDelay); send(msg[message.sensor].set(relayState[message.sensor]), false); } Serial.print("Relay state after if: "); Serial.println(relayState[message.sensor]); digitalWrite(RELAY_PIN+message.sensor, relayState[message.sensor] ? RELAY_ON : RELAY_OFF); } } } void firstRunFunc() { connectionState = checkConnection(); wait(500); for (int i=0, r_pin=RELAY_PIN, r_id=R_CHILD_ID ;i<NUMBER_OF_RELAYS;i++, r_pin++, r_id++){ switch (connectionState) { case 0: relayState[i] = false; Serial.print("First Run: Offline: "); Serial.println(relayState[i]); digitalWrite(r_pin, relayState[i] ? RELAY_ON : RELAY_OFF); break; case 1: request(r_id, V_STATUS); wait(waitDelay); Serial.print("First Run: Online: "); Serial.println(relayState[i]); digitalWrite(r_pin, relayState[i] ? RELAY_ON : RELAY_OFF); send(msg[i].set(relayState[i]), false); break; } } firstRun = !firstRun; } void workOffline() { wasOffline = true; for (int i=0, r_pin=RELAY_PIN;i<NUMBER_OF_RELAYS;i++, r_pin++){ Serial.print("Pracujemy offline: "); Serial.println(relayState[i]); digitalWrite(r_pin, relayState[i] ? RELAY_ON : RELAY_OFF); } } void workOnline() { wasOffline = false; for (int i=0, r_pin=RELAY_PIN;i<NUMBER_OF_RELAYS;i++, r_pin++){ Serial.print("Pracujemy online. Stan przekaznika ktory wysylamy do HA: "); Serial.println(relayState[i]); digitalWrite(r_pin, relayState[i] ? RELAY_ON : RELAY_OFF); wait(waitDelay); send(msg[i].set(relayState[i]), false); Serial.println(""); } } void receiveTime(unsigned long ts) { if (firstRun) { receiveTimeNew = ts; Serial.print("Receive time first run old / new: "); Serial.print(receiveTimeOld); Serial.print(" / "); Serial.println(receiveTimeNew); } else { Serial.print("Received time:"); Serial.println(ts); receiveTimeNew = ts; } } bool checkConnection() { bool rt = requestTime(false); wait(100); if ((receiveTimeNew != receiveTimeOld)) { Serial.print("Online, odebrany czas: "); Serial.println(receiveTimeNew); receiveTimeOld = receiveTimeNew; return true; } Serial.print("Offline, received time: "); Serial.println(receiveTimeNew); return false; }
-
RE: 💬 Security & Signing
@anticimex here are some logs from the node:
- Actions without signing - relay 0 on -> off -> relay 1 on -> off
message.getBool: 1 message.sensor: 0 message.getBool: 0 message.sensor: 0 message.getBool: 1 message.sensor: 1 message.getBool: 0 message.sensor: 1```
- Actions with signing the same sequence as in the above:
message.getBool: 1 message.sensor: 255 message.getBool: 0 message.sensor: 255 message.getBool: 1 message.sensor: 255 message.getBool: 0 message.sensor: 255
- Same as the 2nd but with debug logs from the node start:
39 SGN:PER:OK 66 SGN:INI:BND OK 73 SGN:SGN:NREQ=255 117 SGN:SKP:MSG CMD=3,TYPE=8 2111 SGN:SKP:MSG CMD=3,TYPE=24 2124 SGN:SKP:MSG CMD=3,TYPE=25 2127 SGN:PRE:SGN REQ 2129 SGN:PRE:WHI NREQ 2131 SGN:SKP:MSG CMD=3,TYPE=15 2136 SGN:PRE:XMT,TO=0 2138 SGN:PRE:WAIT GW 2147 SGN:SKP:MSG CMD=3,TYPE=15 2150 SGN:PRE:SGN REQ,FROM=0 2153 SGN:SKP:MSG CMD=3,TYPE=16 2157 SGN:SGN:NCE REQ,TO=0 2160 SGN:SKP:MSG CMD=3,TYPE=17 2163 SGN:NCE:FROM=0 2165 SGN:BND:NONCE=492B8B82E7FDCE9EB7C9DA704A61C8A421FCE7A4641E2C407AAAAAAAAAAAAAAA 2252 SGN:BND:HMAC=59CC2807188FF377BB1F83CB2DA7BC10A645A87453318738B3CCCD736468BA8B 2259 SGN:SGN:SGN 2265 SGN:SKP:MSG CMD=3,TYPE=16 2270 SGN:SGN:NCE REQ,TO=0 2277 SGN:SKP:MSG CMD=3,TYPE=17 2280 SGN:NCE:FROM=0 2282 SGN:BND:NONCE=679C140E7BD7A10EDC27B23E57F06821E9349DB6AD7BC3D90BAAAAAAAAAAAAAA 2369 SGN:BND:HMAC=16F18AB2C520A05498608CC2BFBA42889B02A694A2565160084EACCBCD1B9F1C 2376 SGN:SGN:SGN 2394 SGN:SKP:MSG CMD=3,TYPE=16 2411 SGN:SKP:MSG CMD=3,TYPE=17 2416 SGN:NCE:XMT,TO=3 2438 SGN:BND:NONCE=5E4BB1EA3185F4401A4EF3D9874CC26C5D811D0D3F258BFDF4AAAAAAAAAAAAAA 2525 SGN:BND:HMAC=671770009DDF1D4F1CA94CF9F13071E003346CB8C56222692DA13ECD73DD2F68 2532 SGN:VER:OK 2534 SGN:SKP:MSG CMD=3,TYPE=16 2539 SGN:SGN:NCE REQ,TO=0 2543 SGN:SKP:MSG CMD=3,TYPE=17 2546 SGN:NCE:FROM=0 2548 SGN:BND:NONCE=A022D15873F1D5CAF7DE6F1804CCCE96DFD950A3B62D22BE08AAAAAAAAAAAAAA 2635 SGN:BND:HMAC=ECFD84CCB0B8FCCBE8E6D4501F3405E6CCE99018A13D5D2859F43E58050B9508 2642 SGN:SGN:SGN 2647 SGN:SKP:MSG CMD=3,TYPE=16 2653 SGN:SGN:NCE REQ,TO=0 2660 SGN:SKP:MSG CMD=3,TYPE=17 2663 SGN:NCE:FROM=0 2665 SGN:BND:NONCE=B1851645BDE44AEA6BC82790365E810A85C5AFD1C5DFBA6EB0AAAAAAAAAAAAAA 2752 SGN:BND:HMAC=D6DC1E4A5BC8BF47DEE26831C97F7B83E6C8C0CEBACA27BB7A79366686D2AE1F 2759 SGN:SGN:SGN 2763 SGN:SKP:MSG CMD=3,TYPE=16 2768 SGN:SGN:NCE REQ,TO=0 2776 SGN:SKP:MSG CMD=3,TYPE=17 2779 SGN:NCE:FROM=0 2781 SGN:BND:NONCE=B719DBCF17B1C626FB26B9460857C4F83ED3F2F09B0D8509B8AAAAAAAAAAAAAA 2868 SGN:BND:HMAC=693077E51746266A70C0D8C28A8A9707E585F27FB7717D18E985AA6EC52A538C 2876 SGN:SGN:SGN 2880 SGN:SKP:MSG CMD=3,TYPE=16 2885 SGN:SGN:NCE REQ,TO=0 2892 SGN:SKP:MSG CMD=3,TYPE=17 2895 SGN:NCE:FROM=0 2897 SGN:BND:NONCE=B6525A06EE88D0705ADF1E96C6E183C2C495C97D9F729BDC63AAAAAAAAAAAAAA 2984 SGN:BND:HMAC=B17C1213603F41C583F92A70DF4D6F5D83ADB41DBC812F022A5ED4FE46A0B7F2 2992 SGN:SGN:SGN 2997 SGN:SKP:MSG CMD=3,TYPE=16 3002 SGN:SGN:NCE REQ,TO=0 3009 SGN:SKP:MSG CMD=3,TYPE=17 3012 SGN:NCE:FROM=0 3014 SGN:BND:NONCE=FB23A24F06C2D2A87E36D048354D5A0A8C56BD15C54444D6D3AAAAAAAAAAAAAA 3101 SGN:BND:HMAC=737991E978781664A5B3FC188BECA847272541F2FE4C8B21E9E769D886C7644A 3108 SGN:SGN:SGN 3112 SGN:SKP:MSG CMD=3,TYPE=16 3119 SGN:SGN:NCE REQ,TO=0 3126 SGN:SKP:MSG CMD=3,TYPE=17 3129 SGN:NCE:FROM=0 3131 SGN:BND:NONCE=14517440F7E1361682BB145FE43624B7EEB5434C86F13B49CBAAAAAAAAAAAAAA 3218 SGN:BND:HMAC=D869103E10D562870FBA6E5AC62085B9F905921B8EDAE6156E4D161ADBAAFB10 3225 SGN:SGN:SGN 3229 SGN:SKP:MSG CMD=3,TYPE=26 3243 SGN:SKP:MSG CMD=3,TYPE=16 3260 SGN:SKP:MSG CMD=3,TYPE=17 3265 SGN:NCE:XMT,TO=3 3287 SGN:BND:NONCE=7025F04837E08FAA04A3A58239C1AAED9278F5C6B8DF197C68AAAAAAAAAAAAAA 3374 SGN:BND:HMAC=7A5F0817D6F53120AD81F2C2BDE5DFF223677C0C21AED391B73B35827665C33C 3382 SGN:VER:OK Setup b_pin:14 Setup b_pin:15 3389 SGN:SKP:MSG CMD=3,TYPE=16 3394 SGN:SGN:NCE REQ,TO=0 3402 SGN:SKP:MSG CMD=3,TYPE=17 3405 SGN:NCE:FROM=0 3407 SGN:BND:NONCE=5E16EC77B417638DBB3F43BDCA2735B6A1531082F59BF3800DAAAAAAAAAAAAAA 3494 SGN:BND:HMAC=71012A7427B1601C6D44EC925FFD8D5514A9165AC2D1CD0808EDDD1ABA9DED62 3502 SGN:SGN:SGN 3530 SGN:SKP:MSG CMD=3,TYPE=16 3548 SGN:SKP:MSG CMD=3,TYPE=17 3553 SGN:NCE:XMT,TO=3 3574 SGN:BND:NONCE=2718D9CD7DF4ABC41A0CCB0DCB34C4E1A66B96713667E2EF55AAAAAAAAAAAAAA 3662 SGN:BND:HMAC=EFDE9C7F1E12B34EDADDA2023F81516FD8874EBAF8B4F1D37326FA8DED62D5F9 3670 SGN:VER:OK 4171 SGN:SKP:MSG CMD=3,TYPE=16 4176 SGN:SGN:NCE REQ,TO=0 4179 SGN:SKP:MSG CMD=3,TYPE=17 4183 SGN:NCE:FROM=0 4185 SGN:BND:NONCE=8B545E858FA04E5A4727F1BF48B26EE26053A2CE8F5C7891A9AAAAAAAAAAAAAA 4272 SGN:BND:HMAC=5E5C4D1D6A3DFF01611E255672BB5400AD770CD2283A12513D3750D4BB6D2A62 4279 SGN:SGN:SGN 4312 SGN:SKP:MSG CMD=3,TYPE=16 4329 SGN:SKP:MSG CMD=3,TYPE=17 4334 SGN:NCE:XMT,TO=3 4356 SGN:BND:NONCE=6308AD00528416DA333EA85DDE684956B56223CDE6D11A5727AAAAAAAAAAAAAA 4443 SGN:BND:HMAC=0548D4EF289A5786E5406BCB77C7C890AD1AABE7A23481DD0C8B3F79165C74DF 4451 SGN:VER:OK 4452 SGN:SKP:MSG CMD=3,TYPE=16 4457 SGN:SGN:NCE REQ,TO=0 4461 SGN:SKP:MSG CMD=3,TYPE=17 4464 SGN:NCE:FROM=0 4466 SGN:BND:NONCE=3FB114975E4199204F9B011C209A9CEF8BBFFB4D4D60595449AAAAAAAAAAAAAA 4553 SGN:BND:HMAC=409A234B96D417FA1681C449A0C597B1FF907D25DE8758D534C0E77BEB3281E7 4560 SGN:SGN:SGN 4564 SGN:SKP:MSG CMD=3,TYPE=16 4571 SGN:SGN:NCE REQ,TO=0 4590 SGN:SKP:MSG CMD=3,TYPE=17 4593 SGN:NCE:FROM=0 4595 SGN:BND:NONCE=29AC0DDD57C989A0A03D0069DCFD1310199B6706DD8B1AE5F2AAAAAAAAAAAAAA 4682 SGN:BND:HMAC=723C8DFFA1C465D6694A5629D99EC4A09594830BABBA1A9CF6AE0156113BAEA3 4689 SGN:SGN:SGN 4717 SGN:SKP:MSG CMD=3,TYPE=16 4734 SGN:SKP:MSG CMD=3,TYPE=17 4740 SGN:NCE:XMT,TO=3 4761 SGN:BND:NONCE=5A53BA4D71C44DC0FFBE11D352EABD720804CDD9B286CE43BDAAAAAAAAAAAAAA 4848 SGN:BND:HMAC=758DAAA39E40F746690F6E02C6DE89310E936F57C493D5AC56097714A57D91FD 4855 SGN:VER:OK 4857 SGN:SKP:MSG CMD=3,TYPE=16 4862 SGN:SGN:NCE REQ,TO=0 4867 SGN:SKP:MSG CMD=3,TYPE=17 4870 SGN:NCE:FROM=0 4872 SGN:BND:NONCE=4D8B6539448F68BAB431858A0F77CB3C3FBF15E91AFB86D324AAAAAAAAAAAAAA 4959 SGN:BND:HMAC=9D408CB8DA13CFA94279EE0702E103781834A513C3F34AD717EFB5D14DB61F41 4966 SGN:SGN:SGN 5000 SGN:SKP:MSG CMD=3,TYPE=16 5005 SGN:SGN:NCE REQ,TO=0 5016 SGN:SKP:MSG CMD=3,TYPE=17 5019 SGN:NCE:FROM=0 5021 SGN:BND:NONCE=16862976C5196352B14CAE8F8A3B2E3CBFB4CE386634795AA3AAAAAAAAAAAAAA 5108 SGN:BND:HMAC=0378AC5CB5E8ABFAF33484182C562E07FF03E2912124B91A4B9C5F6F7F52EE5E 5115 SGN:SGN:SGN 5143 SGN:SKP:MSG CMD=3,TYPE=16 5160 SGN:SKP:MSG CMD=3,TYPE=17 5166 SGN:NCE:XMT,TO=3 5187 SGN:BND:NONCE=37EA5E4F0CD7D3D96781A987240DA4765244C8AFBFECC7E010AAAAAAAAAAAAAA 5274 SGN:BND:HMAC=7FCC823173527CABF27C64426A0D1AF07537FF15ABCB5028200F3DAA2BD07B2B 5281 SGN:VER:OK 5283 SGN:SKP:MSG CMD=3,TYPE=16 5288 SGN:SGN:NCE REQ,TO=0 5293 SGN:SKP:MSG CMD=3,TYPE=17 5296 SGN:NCE:FROM=0 5297 SGN:BND:NONCE=373E37CB72669C31D416237755EA68B89157428B655B6CC973AAAAAAAAAAAAAA 5385 SGN:BND:HMAC=9DA54DE18AF1CA6617FC43B0DDD01A2145326273DD74C22DDB6CCE1CD4E3F7AD 5392 SGN:SGN:SGN 5396 SGN:SKP:MSG CMD=3,TYPE=16 5401 SGN:SGN:NCE REQ,TO=0 5410 SGN:SKP:MSG CMD=3,TYPE=17 5413 SGN:NCE:FROM=0 5415 SGN:BND:NONCE=406A1D152B330A40A612A57D399559A8F47115693377E3B267AAAAAAAAAAAAAA 5502 SGN:BND:HMAC=5D1DA2557B3A97E62DF813F9541D7A127F8B438C5EB0196B1E76820B9C0F7D81 5510 SGN:SGN:SGN 10000 SGN:SKP:MSG CMD=3,TYPE=16 10005 SGN:SGN:NCE REQ,TO=0 10008 SGN:SKP:MSG CMD=3,TYPE=17 10011 SGN:NCE:FROM=0 10013 SGN:BND:NONCE=DDB151F944CFE259934F431F81CFC4CF91E60E26BBB2438D1EAAAAAAAAAAAAAA 10100 SGN:BND:HMAC=ADD52CA0428CB8A8903ECEF0A73F5CB38E20FED867B00D307A71F8E79789DCB4 10108 SGN:SGN:SGN 10135 SGN:SKP:MSG CMD=3,TYPE=16 10152 SGN:SKP:MSG CMD=3,TYPE=17 10158 SGN:NCE:XMT,TO=3 10179 SGN:BND:NONCE=146952F3EEDCA1473FF00A7D6D1E70DA2E3C912BFC6254116AAAAAAAAAAAAAAA 10266 SGN:BND:HMAC=20366FF89BB97D4CCBDCC50DF13AC8743B6A295CAC02250602C40EF3795325CA 10273 SGN:VER:OK 10275 SGN:SKP:MSG CMD=3,TYPE=16 10280 SGN:SGN:NCE REQ,TO=0 10285 SGN:SKP:MSG CMD=3,TYPE=17 10288 SGN:NCE:FROM=0 10290 SGN:BND:NONCE=A771EC7FE21219634A273E2DE06AB6AE55682BFCDEBCED2E8AAAAAAAAAAAAAAA 10377 SGN:BND:HMAC=BB4935918379CB79BBFB2A3D8F292E53B44E5FCB142922EE42C0E615DC525E2E 10384 SGN:SGN:SGN 10388 SGN:SKP:MSG CMD=3,TYPE=16 10394 SGN:SGN:NCE REQ,TO=0 10400 SGN:SKP:MSG CMD=3,TYPE=17 10403 SGN:NCE:FROM=0 10405 SGN:BND:NONCE=E99F224609C718E42AD2AC14EBFADF26950842F4CB063B2169AAAAAAAAAAAAAA 10492 SGN:BND:HMAC=866B4C8A5C1F8165A87BF84742EC952E05F743FC938CEF7B6D1B73A0885779F6 10501 SGN:SGN:SGN 15000 SGN:SKP:MSG CMD=3,TYPE=16 15005 SGN:SGN:NCE REQ,TO=0 15009 SGN:SKP:MSG CMD=3,TYPE=17 15012 SGN:NCE:FROM=0 15014 SGN:BND:NONCE=4061DC9EE0A1A503E978AA7EBFA14D7BC0A63C47FA77090DB7AAAAAAAAAAAAAA 15101 SGN:BND:HMAC=67DE95797F8E6CCC7B5309A8013705D4188BFC02A8674C7F2805268748108A25 15110 SGN:SGN:SGN 15136 SGN:SKP:MSG CMD=3,TYPE=16 15154 SGN:SKP:MSG CMD=3,TYPE=17 15159 SGN:NCE:XMT,TO=3 15180 SGN:BND:NONCE=8C36F618FA823CC1F3A58F0E66B7C017C17ECC76970A2F0190AAAAAAAAAAAAAA 15267 SGN:BND:HMAC=5AB3164CBB27647596B8D2B1B9F90117C6E08AADA353E2D34FED7F83778EE158 15275 SGN:VER:OK 15277 SGN:SKP:MSG CMD=3,TYPE=16 15282 SGN:SGN:NCE REQ,TO=0 15286 SGN:SKP:MSG CMD=3,TYPE=17 15289 SGN:NCE:FROM=0 15291 SGN:BND:NONCE=BCA87F3ABCCFC83E837335846C56ED229CBFC7006651F7DB38AAAAAAAAAAAAAA 15378 SGN:BND:HMAC=957C1BEC30090937D37D8A24FFC1BA14B555BD02EDD102604307AB13785252A0 15385 SGN:SGN:SGN 15389 SGN:SKP:MSG CMD=3,TYPE=16 15395 SGN:SGN:NCE REQ,TO=0 15411 SGN:SKP:MSG CMD=3,TYPE=17 15414 SGN:NCE:FROM=0 15416 SGN:BND:NONCE=56298BFDE86C4703C51543AE0871D81399B0E9145541409D9CAAAAAAAAAAAAAA 15503 SGN:BND:HMAC=7A6B3750629013E0BC83C10EC80AC1225FFA9A040FFBD3928241177AFAFA48DA 15511 SGN:SGN:SGN 20000 SGN:SKP:MSG CMD=3,TYPE=16 20005 SGN:SGN:NCE REQ,TO=0 20012 SGN:SKP:MSG CMD=3,TYPE=17 20015 SGN:NCE:FROM=0 20017 SGN:BND:NONCE=FF0556E0DFF7A13EF551B1B3E54AB9B13C63435CB48133C220AAAAAAAAAAAAAA 20104 SGN:BND:HMAC=5A9C54621EFF46E4C8A70EBA5F3B65FCE30B7796414FF42C4A3CC9FD7CA5DB3F 20112 SGN:SGN:SGN 20139 SGN:SKP:MSG CMD=3,TYPE=16 20156 SGN:SKP:MSG CMD=3,TYPE=17 20161 SGN:NCE:XMT,TO=3 20183 SGN:BND:NONCE=5F72D46B75A3E1BBEB0F81E932AA1A0E99A3D2E67059DB7356AAAAAAAAAAAAAA 20270 SGN:BND:HMAC=CDDB74748AB4E9D08125B8C52EE7D68BF1124ECC606CC130DBE3A678214393EE 20277 SGN:VER:OK 20279 SGN:SKP:MSG CMD=3,TYPE=16 20284 SGN:SGN:NCE REQ,TO=0 20288 SGN:SKP:MSG CMD=3,TYPE=17 20291 SGN:NCE:FROM=0 20293 SGN:BND:NONCE=CD06A773772E6B0B92A49BE56849DA60D7B454072899AAC3A6AAAAAAAAAAAAAA 20380 SGN:BND:HMAC=FF28B0DF2A3FB90C5B55C0CE2CCF33B8FD77D8BAA24A95BD4956A93449C8AE0F 20387 SGN:SGN:SGN 20392 SGN:SKP:MSG CMD=3,TYPE=16 20398 SGN:SGN:NCE REQ,TO=0 20404 SGN:SKP:MSG CMD=3,TYPE=17 20407 SGN:NCE:FROM=0 20409 SGN:BND:NONCE=6A915CB133C69C103E3DE553695780998995AD0BA05EA9DB5DAAAAAAAAAAAAAA 20497 SGN:BND:HMAC=BEB1AA435B6212CFFD7A67CE4B0A87AD94A132F9500DFFBAC101DAF6E4AF066D 20504 SGN:SGN:SGN 24542 SGN:SKP:MSG CMD=3,TYPE=16 24559 SGN:SKP:MSG CMD=3,TYPE=17 24564 SGN:NCE:XMT,TO=3 24586 SGN:BND:NONCE=16E64CA5D7019688D81965E587288B967D214AD5DE3567E064AAAAAAAAAAAAAA 24673 SGN:BND:HMAC=DB24231C4D79AC2CBDD8C1D9AD87103EC6B73ABD94F6E038BDE40406D929AF18 24680 SGN:VER:OK message.getBool: 1 24782 SGN:SKP:MSG CMD=3,TYPE=16 24787 SGN:SGN:NCE REQ,TO=0 24794 SGN:SKP:MSG CMD=3,TYPE=17 24797 SGN:NCE:FROM=0 24799 SGN:BND:NONCE=260E9FC73FF1B54D7559524400F589FFC658DE8AEC707D09CCAAAAAAAAAAAAAA 24886 SGN:BND:HMAC=FE572B069ECD3303C73700F543A87FCB8CB106515A76D35379711DBBAADAA437 24894 SGN:SGN:SGN message.sensor: 255 25000 SGN:SKP:MSG CMD=3,TYPE=16 25006 SGN:SGN:NCE REQ,TO=0 25015 SGN:SKP:MSG CMD=3,TYPE=17 25018 SGN:NCE:FROM=0 25020 SGN:BND:NONCE=285E2D30B1ECC8BF0625F022708E3FFC30D4831003BD358CDEAAAAAAAAAAAAAA 25108 SGN:BND:HMAC=D324AACB08FF60F71BFEE5747F7313FEF1C82CF2FE3455C350CB131F15C04EDB 25115 SGN:SGN:SGN 25148 SGN:SKP:MSG CMD=3,TYPE=16 25165 SGN:SKP:MSG CMD=3,TYPE=17 25170 SGN:NCE:XMT,TO=3 25192 SGN:BND:NONCE=931A1DE011E34E7D177D87295313CF9490FF5D42DF59B2A1CAAAAAAAAAAAAAAA 25280 SGN:BND:HMAC=CB7C16051F2CCA51A054FAE7327637DE3921A4C67D865F1859E21E763FB91698 25287 SGN:VER:OK 25289 SGN:SKP:MSG CMD=3,TYPE=16 25294 SGN:SGN:NCE REQ,TO=0 25297 SGN:SKP:MSG CMD=3,TYPE=17 25300 SGN:NCE:FROM=0 25303 SGN:BND:NONCE=08A188872AB23EA761709E2DB033898424A307D8019B42D048AAAAAAAAAAAAAA 25391 SGN:BND:HMAC=190D48C11DD42052CCBE6368EF48CB757B66E6E228247ECCCEA73680016C079F 25398 SGN:SGN:SGN 25402 SGN:SKP:MSG CMD=3,TYPE=16 25407 SGN:SGN:NCE REQ,TO=0 25427 SGN:SKP:MSG CMD=3,TYPE=17 25431 SGN:NCE:FROM=0 25433 SGN:BND:NONCE=40C6955CD073344B1624FEE815B91F31BE7AD215918727C1B5AAAAAAAAAAAAAA 25520 SGN:BND:HMAC=235D7ECC1516626F8BFF5F849FC6E3B9391549DC2BAD21694E55F734D3E3F676 25527 SGN:SGN:SGN 26334 SGN:SKP:MSG CMD=3,TYPE=16 26351 SGN:SKP:MSG CMD=3,TYPE=17 26357 SGN:NCE:XMT,TO=3 26379 SGN:BND:NONCE=4B62932D0B5AC2BF336C8D16E184503798CD3B5569D8872CC4AAAAAAAAAAAAAA 26466 SGN:BND:HMAC=30FC8A4DDFD59DAEFB11B1429A66A4AFE12E90BF9CD2E3B2673621536A1EAB84 26473 SGN:VER:OK message.getBool: 0 26575 SGN:SKP:MSG CMD=3,TYPE=16 26580 SGN:SGN:NCE REQ,TO=0 26587 SGN:SKP:MSG CMD=3,TYPE=17 26590 SGN:NCE:FROM=0 26592 SGN:BND:NONCE=4CD7D5705365FF6D5D54EBBB52D5D3284AC93DD34FF4868AADAAAAAAAAAAAAAA 26679 SGN:BND:HMAC=88CDBE83E92EA22CE06347744EE117F2D7E5DA3BB9A391073A4709B0FD5F60B4 26686 SGN:SGN:SGN message.sensor: 255 28345 SGN:SKP:MSG CMD=3,TYPE=16 28362 SGN:SKP:MSG CMD=3,TYPE=17 28368 SGN:NCE:XMT,TO=3 28381 SGN:BND:NONCE=3410F5DD4084EA0068B3F0C8F3A4D5DA7AC120762E5B606115AAAAAAAAAAAAAA 28468 SGN:BND:HMAC=8E073350CC53B595DA09FBF8A78450DFBDC3221014D3B4ECEB7ACD327BC4D61A 28475 SGN:VER:OK message.getBool: 1 28577 SGN:SKP:MSG CMD=3,TYPE=16 28582 SGN:SGN:NCE REQ,TO=0 28589 SGN:SKP:MSG CMD=3,TYPE=17 28592 SGN:NCE:FROM=0 28594 SGN:BND:NONCE=4F49C817A6B4A064689E304275F1DFB4F294C84E49DCF9BD34AAAAAAAAAAAAAA 28682 SGN:BND:HMAC=0D40969334248E05273CC27EC628090DA6BA701D05D3CFF0C2EF41EA494C4DF0 28689 SGN:SGN:SGN message.sensor: 255 29425 SGN:SKP:MSG CMD=3,TYPE=16 29443 SGN:SKP:MSG CMD=3,TYPE=17 29448 SGN:NCE:XMT,TO=3 29469 SGN:BND:NONCE=1A791FA57B8D29F02B6E90717970377F8BBC3BC91DF40AC63AAAAAAAAAAAAAAA 29557 SGN:BND:HMAC=8B41F3C94CB62376D5529C49A1B2E0C05E414149B087673570548A56949B8640 29564 SGN:VER:OK message.getBool: 0 29666 SGN:SKP:MSG CMD=3,TYPE=16 29671 SGN:SGN:NCE REQ,TO=0 29678 SGN:SKP:MSG CMD=3,TYPE=17 29681 SGN:NCE:FROM=0 29683 SGN:BND:NONCE=3A2EC10C8B0FC4C069443A94DD64FAF550E62F14D4288B2CFCAAAAAAAAAAAAAA 29770 SGN:BND:HMAC=A942BFA7D6AC7108F0AFADA0F7C36D89582F2421E2012962526DECADCB8B7A0E 29777 SGN:SGN:SGN message.sensor: 255 30000 SGN:SKP:MSG CMD=3,TYPE=16 30005 SGN:SGN:NCE REQ,TO=0 30009 SGN:SKP:MSG CMD=3,TYPE=17 30012 SGN:NCE:FROM=0 30014 SGN:BND:NONCE=64B61596FC3FDC279789EF4E74C2A833DA04EA7A5C0A36584BAAAAAAAAAAAAAA 30101 SGN:BND:HMAC=B7DE1CC94D2B2F889AD51703F0C314277FEFB23DF4DBAB0A169AC348E71D2D27 30108 SGN:SGN:SGN 30136 SGN:SKP:MSG CMD=3,TYPE=16 30153 SGN:SKP:MSG CMD=3,TYPE=17 30159 SGN:NCE:XMT,TO=3 30172 SGN:BND:NONCE=CFDE9FA70EA2C75F6D079E9DE8612B702DA8EFB444CA4697B0AAAAAAAAAAAAAA 30259 SGN:BND:HMAC=614DC54F0BCECADE45A0D32B1021FE4BDE17C70C61460DABDDFDA14039913A60 30267 SGN:VER:OK 30268 SGN:SKP:MSG CMD=3,TYPE=16 30274 SGN:SGN:NCE REQ,TO=0 30277 SGN:SKP:MSG CMD=3,TYPE=17 30280 SGN:NCE:FROM=0 30282 SGN:BND:NONCE=567D002CB82F6B8DEE82F874B97E5E31A51A8549345648C18BAAAAAAAAAAAAAA 30370 SGN:BND:HMAC=0AC28DBFBCF43A810C985DDD44E27752B681E22ADC6E95537B83D47BC2FF821C 30377 SGN:SGN:SGN 30382 SGN:SKP:MSG CMD=3,TYPE=16 30387 SGN:SGN:NCE REQ,TO=0 30394 SGN:SKP:MSG CMD=3,TYPE=17 30397 SGN:NCE:FROM=0 30399 SGN:BND:NONCE=DA8FD6EEA815AB4F503BE1B5EFA2C6081333740E05D38227AAAAAAAAAAAAAAAA 30486 SGN:BND:HMAC=A36CAC6FDD59A5E5D33E6E0FC49E0B5F52EB207EEC4B1A739C1572896534693B 30494 SGN:SGN:SGN 35000 SGN:SKP:MSG CMD=3,TYPE=16 35005 SGN:SGN:NCE REQ,TO=0 35012 SGN:SKP:MSG CMD=3,TYPE=17 35015 SGN:NCE:FROM=0 35017 SGN:BND:NONCE=2EE1A7C461A6D8FE724ED812906DFDF43D81A9D0FC6D43F743AAAAAAAAAAAAAA 35105 SGN:BND:HMAC=95B08DF42306303146921FAFBE413552BD5E759DD8E251BBAACA69F6C77B7677 35112 SGN:SGN:SGN 35139 SGN:SKP:MSG CMD=3,TYPE=16 35156 SGN:SKP:MSG CMD=3,TYPE=17 35163 SGN:NCE:XMT,TO=3 35184 SGN:BND:NONCE=CDB54E3F13BEDA3F9C7AF511D5BD80F71991E59A27CA61A62CAAAAAAAAAAAAAA 35271 SGN:BND:HMAC=5ABF9477680B454863769B902AD384002FAF779084FB1073DE82EFCD68150CBF 35278 SGN:VER:OK 35280 SGN:SKP:MSG CMD=3,TYPE=16 35286 SGN:SGN:NCE REQ,TO=0 35290 SGN:SKP:MSG CMD=3,TYPE=17 35293 SGN:NCE:FROM=0 35295 SGN:BND:NONCE=FA51A5E68AA1F62E7E1C172CDC07A96FDFC4407174BBB9BE9DAAAAAAAAAAAAAA 35382 SGN:BND:HMAC=E88AB002F0D6CFCADFF170B1DF79A703FF2D2EFF0B2E54D44B3BD53CADE1BCE8 35389 SGN:SGN:SGN 35393 SGN:SKP:MSG CMD=3,TYPE=16 35399 SGN:SGN:NCE REQ,TO=0 35405 SGN:SKP:MSG CMD=3,TYPE=17 35408 SGN:NCE:FROM=0 35410 SGN:BND:NONCE=428C535E657135E2F03563064E550BAEA922F19AE16CF4AB87AAAAAAAAAAAAAA 35499 SGN:BND:HMAC=4217532A927DEF4D1B0810B06EE32BC9BE3877C32CC3203B122576626A818E4A 35506 SGN:SGN:SGN 40000 SGN:SKP:MSG CMD=3,TYPE=16 40005 SGN:SGN:NCE REQ,TO=0 40013 SGN:SKP:MSG CMD=3,TYPE=17 40016 SGN:NCE:FROM=0 40018 SGN:BND:NONCE=8D65E89103046004EF7EC22E7D962F9ED3B687D509B2E4BA76AAAAAAAAAAAAAA 40105 SGN:BND:HMAC=3F900CD97363E50EE6B357613F769DAF886E048FFDA7C49151E2DEB21BF9F379 40114 SGN:SGN:SGN 40140 SGN:SKP:MSG CMD=3,TYPE=16 40158 SGN:SKP:MSG CMD=3,TYPE=17 40164 SGN:NCE:XMT,TO=3 40184 SGN:BND:NONCE=874FA416122E07E959949E7DE32BE457046122688B7977E971AAAAAAAAAAAAAA 40272 SGN:BND:HMAC=A7D7D8B4281C5F6F2C7B596928C5B109A177A90D376DBC64CC9824131BE5397D 40280 SGN:VER:OK 40282 SGN:SKP:MSG CMD=3,TYPE=16 40287 SGN:SGN:NCE REQ,TO=0 40290 SGN:SKP:MSG CMD=3,TYPE=17 40293 SGN:NCE:FROM=0 40295 SGN:BND:NONCE=B53BE35890A4BED128978360388906AC10959E2177B896F645AAAAAAAAAAAAAA 40383 SGN:BND:HMAC=37C7C6BF1B3E669444F0805DDB510954598E12AD1CB66D554B6F6F8860E341F1 40390 SGN:SGN:SGN 40394 SGN:SKP:MSG CMD=3,TYPE=16 40400 SGN:SGN:NCE REQ,TO=0 40407 SGN:SKP:MSG CMD=3,TYPE=17 40410 SGN:NCE:FROM=0 40412 SGN:BND:NONCE=F040D59227D7B10262574740CE5575419ABDADBF019EFEE09FAAAAAAAAAAAAAA 40499 SGN:BND:HMAC=6333224230F7EFFE3317FD7E139EDE907E0B2065F2C792AE9E8A59C74396426C 40507 SGN:SGN:SGN 45000 SGN:SKP:MSG CMD=3,TYPE=16 45005 SGN:SGN:NCE REQ,TO=0 45016 SGN:SKP:MSG CMD=3,TYPE=17 45019 SGN:NCE:FROM=0 45021 SGN:BND:NONCE=2AE090A7F9AAD1084FD641A5E8623D935F2FFC75CD16690AA8AAAAAAAAAAAAAA 45109 SGN:BND:HMAC=354D1FF390248F8870A76461996E9C6EC8C9B821470FDA6B6BD517B4D28AD054 45116 SGN:SGN:SGN 45143 SGN:SKP:MSG CMD=3,TYPE=16 45160 SGN:SKP:MSG CMD=3,TYPE=17 45165 SGN:NCE:XMT,TO=3 45187 SGN:BND:NONCE=BABCBF10FC16A16FE4DB3883A672D98DE9962E040F79F31DFDAAAAAAAAAAAAAA 45274 SGN:BND:HMAC=23843CEAE27BBE91CB06909B4C586289CFE6C44F568E337093D9025EF3FE786B 45282 SGN:VER:OK 45283 SGN:SKP:MSG CMD=3,TYPE=16 45289 SGN:SGN:NCE REQ,TO=0 45292 SGN:SKP:MSG CMD=3,TYPE=17 45295 SGN:NCE:FROM=0 45297 SGN:BND:NONCE=0EB891A61B11543A7790E05C52857CA3336974DD3A407E8783AAAAAAAAAAAAAA 45384 SGN:BND:HMAC=55A35830E7B6E445CFD2F37C49D893FAE25F03ED57AB651F765F877F8A1B7631 45392 SGN:SGN:SGN 45396 SGN:SKP:MSG CMD=3,TYPE=16 45402 SGN:SGN:NCE REQ,TO=0 45409 SGN:SKP:MSG CMD=3,TYPE=17 45411 SGN:NCE:FROM=0 45413 SGN:BND:NONCE=ACC5047C74CDE5746F7C174E6F6DAB7BEA032788B322C93660AAAAAAAAAAAAAA 45501 SGN:BND:HMAC=4DEAC30628039766C0B217A89F8A9F4B10C37CEB45529D04C108DE556541C17C 45508 SGN:SGN:SGN
I looked via log parser and it is not looking bad for me. Do you find any suspicious behaviour here? I didn't mention - I use MySensors 2.2. Should I switch to 2.3?
-
RE: 💬 Security & Signing
@anticimex
Should I look rather in gw logs or node's? Or both? -
RE: 💬 Security & Signing
@anticimex I will send logs, for now do not have access to hardware (I'm out of home). I am curious what could be the reason, as I said, I set all keys and the signing itself seems to work well. When I disable:
//#define MY_SIGNING_SOFT //#define MY_SIGNING_SOFT_RANDOMSEED_PIN 7 //#define MY_SIGNING_REQUEST_SIGNATURES
the sketch works fine. When they are enabled, I can see that the messages are received (I can see the change of the state of relay but I cannot read which relay should be change. Here's a part of my sketch, maybe there is a trivial mistake in it:
#define NUMBER_OF_RELAYS 2 #define R_CHILD_ID 0 #define RELAY_PIN 3 MyMessage msg[NUMBER_OF_RELAYS]; bool relayState[NUMBER_OF_RELAYS] = {false}; bool controllerState [NUMBER_OF_RELAYS] = {false}; void presentation() { for (int i=0, r_id=R_CHILD_ID; i<NUMBER_OF_RELAYS; i++, r_id++) { present(r_id, S_BINARY); msg[i] = MyMessage(r_id, V_STATUS); } } void receive(const MyMessage &message) { if (message.type==V_STATUS) { controllerState[message.sensor] = message.getBool(); if (controllerState[message.sensor] != relayState[message.sensor]) { relayState[message.sensor] = controllerState[message.sensor]; } Serial.print("Message Sensor id: "); Serial.println(message.sensor); digitalWrite(RELAY_PIN+message.sensor, relayState[message.sensor] ? RELAY_ON : RELAY_OFF); } }
when I dump to console controllerState[message.sensor] value I can see it changes, no matter the fact that it points on the table out of the range as I check it later when read message.sensor value. So it leads me to conclusion that message.getBool(); works OK (now I think I should Serial.println(message.getBool()) to get straight the value and make sure it really works fine... I will test it), however:
Serial.print("Message Sensor id: "); Serial.println(message.sensor);
gives me always the value of 255 instead of 0 or 1 in this case. Of course I gave here only the most important parts of my code which I think causes problems.
-
RE: 💬 Security & Signing
I've just applied signing to my own written sketch and hit a wall. Basically the signing works fine - I get time from controller and it works fine - any signed time packets from controller are read. However I've got issues with my receive(const MyMessage &message) function. The function gets the state change for the relay from the controller and to determine which relay should be changed it uses message.sensor method. When the signing is turned off it returns 0 or 1 (for 2 relays). However, when the signing is enabled it returns always 255. Any ideas why?
-
RE: 💬 Security & Signing
@anticimex Thank you so much for clarification I owe you a beer
So another question for future considerations - is it possible to read eeprom to get the keys? I suppose the answer is yes as the whitelisting feature is introduced, but is it a hard task or keys could be fetched by a simple script reading eeprom?
-
RE: 💬 Security & Signing
@anticimex thanks for the answer.
- I understand the idea. However, I think I might asked not clear enough. I would like to know how the mysgw daemon would work after the compilation depending on the flags I provide.
I understand that when I compile my gw with only --my-signing-request-signatures it will require all nodes in the network to sign messages. But if I want only some of them to sign messages and some not, do I have to compile the gw with both flags: --my-signing-request-signatures AND --my-signing-weak_security or only: --my-signing-weak_security ? - I think it might be an RPi issue, because the idea and setup seems to be correct. I'll try one day to test it in node-to-node communication or some test serial gw on Arduino. This is not so important to me as the signing itself works fine, just was curious.
- clear, hope it work. In the meantime I found: https://forum.mysensors.org/topic/2005/software-aes-encryption-for-nrf24 which looks worth testing as well. TL;DR carefully yet.
- I understand the idea. However, I think I might asked not clear enough. I would like to know how the mysgw daemon would work after the compilation depending on the flags I provide.