Thank you, I managed to compile the program, by enabling whitelisting.
But I don't understand, since I copied the sketch above from [security] Introducing signing support to MySensors, from example without whitelisting.
And how can I tell if everything works fine (messages are properly signed). I receive messages on the Gateway, in debuuging i see:
send: 28-28-0-0 s=255,c=3,t=15,pt=2,l=2,sg=0,st=ok:1
send: 28-28-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,st=ok:1.5.1
send: 28-28-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
no sign
sensor started, id=28, parent=0, distance=1
send: 28-28-0-0 s=255,c=3,t=11,pt=0,l=8,sg=0,st=ok:Humidity
send: 28-28-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.0
send: 28-28-0-0 s=0,c=0,t=7,pt=0,l=0,sg=0,st=ok:
send: 28-28-0-0 s=1,c=0,t=6,pt=0,l=0,sg=0,st=ok:
send: 28-28-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,st=ok:21.0
T: 21.00
send: 28-28-0-0 s=0,c=1,t=1,pt=7,l=5,sg=0,st=ok:45.0
H: 45.00
send: 28-28-0-0 s=0,c=1,t=1,pt=7,l=5,sg=0,st=ok:44.0
H: 44.00
send: 28-28-0-0 s=0,c=1,t=1,pt=7,l=5,sg=0,st=ok:45.0
H: 45.00
bogdan
@bogdan
Best posts made by bogdan
Latest posts made by bogdan
-
RE: Can't create MySigningAtsha204Soft signer
-
RE: Can't create MySigningAtsha204Soft signer
@mfalkvidd I'm using 1.5.1 version of MySensors.
-
Can't create MySigningAtsha204Soft signer
I'm trying to introduce signing to my projects, but can't create the MySigningAtsha204Soft object. What did I miss here:
#include <SPI.h> #include <MySensor.h> #include <DHT.h> #include <MySigningAtsha204Soft.h> #define CHILD_ID_HUM 0 #define CHILD_ID_TEMP 1 #define HUMIDITY_SENSOR_DIGITAL_PIN 4 unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds) MyTransportNRF24 radio; // NRFRF24L01 radio driver MyHwATMega328 hw; // Select AtMega328 hardware profile // Change the soft_serial value to an arbitrary value for proper security uint8_t soft_serial[SHA204_SERIAL_SZ] = {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09}; MySigningAtsha204Soft signer(true, 0, NULL, soft_serial); // Select SW ATSHA signing backend MySensor gw(radio, hw, signer);
Compiler returns error: no matching function for call to 'MySigningAtsha204Soft::MySigningAtsha204Soft(bool, int, NULL, uint8_t [9])'
-
Can't get to call incomingMessageCallback function
I'm new to MySensors and I can't get it work right.
I try to send some information (temperature, humidity) from one node (Arduino Nano) to another (Arduino Uno).
First of all, no data is received by second node, if SerialGateway is on.
But that's only a half of a problem.
Even if I turn SerialGateway node off, data is sent and read between nodes, but I still can't get to call incomingMessageCallback function.- Node which is supposed to receive data:
#include <MySensor.h> #include <SPI.h> #define CAQ 10 #define BARO_CHILD 3 #define TEMP_CHILD 4 #define CHILD_ID_HUM 1 #define CHILD_ID_TEMP 2 #define CHILD_ID_MQ 0 float mq=0, pressure=0, baro_temp=0, hum=0, dht_temp=0; MySensor gw; void setup(){ gw.begin(incomingMessage, AUTO, false); gw.sendSketchInfo("Incoming Message Processor", "1.0"); Serial.begin(115200); // Serial.println("TempDHT \t Hum \t TempBaro \t Pressure \t AirQ"); } void loop() { gw.process(); // Serial.print(dht_temp); // Serial.print("\t"); // Serial.print(hum); // Serial.print("\t"); // Serial.print(baro_temp); // Serial.print("\t"); // Serial.print(pressure); // Serial.print("\t"); // Serial.println(mq); } void incomingMessage(const MyMessage &message){ Serial.println("Incoming Message function called"); if (message.isAck()) { Serial.println("This is an ack from gateway"); } else { switch (message.sender){ case CAQ:{ Serial.println("CAQ sender detected"); switch(message.sensor){ case CHILD_ID_MQ: mq=message.getFloat(); break; case CHILD_ID_HUM: hum=message.getFloat(); break; case CHILD_ID_TEMP: dht_temp=message.getFloat(); break; case BARO_CHILD: pressure=message.getFloat(); break; case TEMP_CHILD: baro_temp=message.getFloat(); break; } } } } }
- Node, which sends data:
#include <SPI.h> #include <MySensor.h> #include <DHT.h> #define CHILD_ID_HUM 1 #define CHILD_ID_TEMP 2 //Pins #define HUMIDITY_SENSOR_DIGITAL_PIN 4 //DHT-sensor variables: float lastTempDHT; float lastHum; boolean metric = true; DHT dht; //My Sensors objects: MySensor gw; MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); void setup() { gw.begin(NULL,10, true,AUTO); dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); // Send the sketch version information to the gateway and Controller gw.sendSketchInfo("Simple Message Sender", "1.0"); gw.present(CHILD_ID_HUM, S_HUM); gw.present(CHILD_ID_TEMP, S_TEMP, "Temperure DHT"); metric = gw.getConfig().isMetric; } void loop() { delay(dht.getMinimumSamplingPeriod()); float temperatureDHT = dht.getTemperature(); if (isnan(temperatureDHT)) { Serial.println("Failed reading temperature from DHT"); } else if (temperatureDHT != lastTempDHT) { lastTempDHT = temperatureDHT; if (!metric) { temperatureDHT = dht.toFahrenheit(temperatureDHT); } gw.send(msgTemp.set(temperatureDHT, 1)); Serial.print("T: "); Serial.println(temperatureDHT); } float humidity = dht.getHumidity(); if (isnan(humidity)) { Serial.println("Failed reading humidity from DHT"); } else if (humidity != lastHum) { lastHum = humidity; gw.send(msgHum.set(humidity, 1)); Serial.print("H: "); Serial.println(humidity); } }```
Serial monitor of 2) node:
*send: 10-10-15-0 s=255,c=0,t=18,pt=0,l=5,sg=0,st=ok:1.5.1
send: 10-10-15-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=fail:15
repeater started, id=10, parent=15, distance=2
send: 10-10-15-0 s=255,c=3,t=11,pt=0,l=21,sg=0,st=ok:Simple Message Sender
send: 10-10-15-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.0
send: 10-10-15-0 s=1,c=0,t=7,pt=0,l=0,sg=0,st=ok:
send: 10-10-15-0 s=2,c=0,t=6,pt=0,l=13,sg=0,st=fail:Temperure DHT
send: 10-10-15-0 s=2,c=1,t=0,pt=7,l=5,sg=0,st=fail:27.0
T: 27.00
send: 10-10-15-0 s=1,c=1,t=1,pt=7,l=5,sg=0,st=ok:28.0
H: 28.00Serial monitor of 1) node:
send: 15-15-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,st=fail:1.5.1
send: 15-15-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=fail:0
sensor started, id=15, parent=0, distance=1
send: 15-15-0-0 s=255,c=3,t=11,pt=0,l=25,sg=0,st=fail:Incoming Message Processo
send: 15-15-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=fail:1.0
read: 10-10-0 s=1,c=1,t=1,pt=7,l=5,sg=0:28.0
read: 10-10-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
read: 10-10-0 s=1,c=1,t=1,pt=7,l=5,sg=0:27.0
read: 10-10-0 s=2,c=1,t=0,pt=7,l=5,sg=0:28.0
read: 10-10-0 s=1,c=1,t=1,pt=7,l=5,sg=0:28.0
read: 10-10-0 s=2,c=1,t=0,pt=7,l=5,sg=0:27.0
read: 10-10-0 s=1,c=1,t=1,pt=7,l=5,sg=0:17.0