Hi, i use MySensors 1.5.4. I test the software version signing.
If i send a message to another node the signing is lost.
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.8
*
*******************************
*
* DESCRIPTION
*
*/
// set node id
#define NODE_ID 143
// select MySigningAtsha204Soft
#define Atsha204Soft
// select MySigningAtsha204 with hardware
//#define Atsha204hw
#include <MySensor.h>
#ifdef Atsha204Soft
#include <MySigningAtsha204Soft.h>
#elif defined Atsha204hw
#include <MySigningAtsha204.h>
#endif
#include <MyHwATMega328.h>
MyHwATMega328 hw; // Select AtMega328 hardware profile
MyTransportNRF24 radio; // NRFRF24L01 radio driver
#ifdef Atsha204Soft
MySigningAtsha204Soft signer(true);
MySensor gw(radio, hw, signer);
#elif defined Atsha204hw
MySigningAtsha204 signer; // Select HW ATSHA signing backend
MySensor gw(radio, hw, signer);
#else
MySensor gw(radio, hw);
#endif
#include <SPI.h>
#include <Wire.h>
#define CHILD_ID_HVAC 0
#define CHILD_ID_TEMP 1
// Initialize temperature message
MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
// Initialize thermostat message
MyMessage msgHeater(CHILD_ID_HVAC, V_STATUS);
boolean metric = true;
int Sleep_time = 3000;
float temperature;
byte heating;
void setup()
{
// Startup and initialize MySensors library. Set callback for incoming messages.
gw.begin(NULL, NODE_ID);
// Register all sensors to gw (they will be created as child devices)
gw.present(CHILD_ID_TEMP, S_TEMP);
// termostato
gw.present(CHILD_ID_HVAC, S_HVAC);
//*******************************
msgHeater.setDestination(200);
//*******************************
metric = gw.getConfig().isMetric;
heating = 1;
temperature = 24;
}
void loop()
{
// Process incoming messages (like config from server)
gw.process();
gw.send(msgTemp.set(temperature,1));
gw.send(msgHeater.set(heating,1));
gw.sleep(Sleep_time);
}
MyConfig.h
/**
* 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.
*/
#ifndef MyConfig_h
#define MyConfig_h
#include <stdint.h>
// Enable debug flag for debug prints. This will add a lot to the size of the final sketch but good
// to see what is actually is happening when developing
#define DEBUG
// Disable this line, If you are using TX(1), RX(0) as normal I/O pin
#define ENABLED_SERIAL
// Serial output baud rate (for debug prints and serial gateway)
#define BAUD_RATE 115200
/**********************************
* Over the air firmware updates
***********************************/
// The following define enables the safe over-the-air firmware update feature
// which requires external flash and the DualOptiBoot bootloader.
// Note: You can still have OTA FW updates without external flash but it
// requires the MYSBootloader and disabled MY_OTA_FIRMWARE_FEATURE
//#define MY_OTA_FIRMWARE_FEATURE
// Slave select pin for external flash
#define MY_OTA_FLASH_SS 8
// Flash jdecid
#define MY_OTA_FLASH_JDECID 0x1F65
/**********************************
* Information LEDs blinking
***********************************/
// This feature enables LEDs blinking on message receive, transmit
// or if some error occured. This was commonly used only in gateways,
// but now can be used in any sensor node. Also the LEDs can now be
// disabled in the gateway.
//#define WITH_LEDS_BLINKING
// The following setting allows you to inverse the blinking feature WITH_LEDS_BLINKING
// When WITH_LEDS_BLINKING_INVERSE is enabled LEDSs are normally turned on and switches
// off when blinking
#define WITH_LEDS_BLINKING_INVERSE
// default LEDs blinking period in milliseconds
#define DEFAULT_LED_BLINK_PERIOD 300
// The RX LED default pin
#define DEFAULT_RX_LED_PIN 6
// The TX LED default pin
#define DEFAULT_TX_LED_PIN 5
// The Error LED default pin
#define DEFAULT_ERR_LED_PIN 4
/**********************************
* Message Signing Settings
***********************************/
// Disable to completly disable signing functionality in library
#define MY_SIGNING_FEATURE
// Define a suitable timeout for a signature verification session
// Consider the turnaround from a nonce being generated to a signed message being received
// which might vary, especially in networks with many hops. 5s ought to be enough for anyone.
#define MY_VERIFICATION_TIMEOUT_MS 5000
// Enable to turn on whitelisting
// When enabled, a signing node will salt the signature with it's unique signature and nodeId.
// The verifying node will look up the sender in a local table of trusted nodes and
// do the corresponding salting in order to verify the signature.
// For this reason, if whitelisting is enabled on one of the nodes in a sign-verify pair, both
// nodes have to implement whitelisting for this to work.
// Note that a node can still transmit a non-salted message (i.e. have whitelisting disabled)
// to a node that has whitelisting enabled (assuming the receiver does not have a matching entry
// for the sender in it's whitelist)
//#define MY_SECURE_NODE_WHITELISTING
// MySigningAtsha204 default setting
#define MY_ATSHA204_PIN 17 // A3 - pin where ATSHA204 is attached
// MySigningAtsha204Soft default settings
#define MY_RANDOMSEED_PIN 7 // A7 - Pin used for random generation (do not connect anything to this)
// Key to use for HMAC calculation in MySigningAtsha204Soft (32 bytes)
#define MY_HMAC_KEY 0x00,0x01,0x02,0x03,0x04,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
/**********************************
* NRF24L01 Driver Defaults
***********************************/
#define RF24_CE_PIN 9
#define RF24_CS_PIN 10
#define RF24_PA_LEVEL RF24_PA_MAX
#define RF24_PA_LEVEL_GW RF24_PA_MAX
// RF channel for the sensor net, 0-127
#define RF24_CHANNEL 76
//RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps
#define RF24_DATARATE RF24_250KBPS
// This is also act as base value for sensor nodeId addresses. Change this (or channel) if you have more than one sensor network.
#define RF24_BASE_RADIO_ID ((uint64_t)0xA8A8E1FC00LL)
// Enable SOFTSPI for NRF24L01 when using the W5100 Ethernet module
//#define SOFTSPI
#ifdef SOFTSPI
// Define the soft SPI pins used for NRF radio
const uint8_t SOFT_SPI_MISO_PIN = 16;
const uint8_t SOFT_SPI_MOSI_PIN = 15;
const uint8_t SOFT_SPI_SCK_PIN = 14;
#endif
/**********************************
* RFM69 Driver Defaults
***********************************/
// Default network id. Use the same for all nodes that will talk to each other
#define RFM69_NETWORKID 100
// Default frequency to use. This must match the hardware version of the RFM69 radio (uncomment one):
// #define RFM69_FREQUENCY RF69_433MHZ
#define RFM69_FREQUENCY RF69_868MHZ
//#define FREQUENCY RF69_915MHZ
// Enable this for encryption of packets
//#define RFM69_ENABLE_ENCRYPTION
#define RFM69_ENCRYPTKEY "sampleEncryptKey" //exactly the same 16 characters/bytes on all nodes!
#endif
log with msgHeater.setDestination(200);
send: 143-143-0-0 s=255,c=3,t=15,pt=2,l=2,sg=0,st=ok:1
read: 0-0-143 s=255,c=3,t=15,pt=2,l=2,sg=0:1
send: 143-143-0-0 s=255,c=3,t=16,pt=0,l=0,sg=0,st=ok:
read: 0-0-143 s=255,c=3,t=17,pt=6,l=25,sg=0:01B3F448E00B03DE197731D7302FC7167D50E9F50B77C63700
send: 143-143-0-0 s=255,c=0,t=17,pt=0,l=5,sg=1,st=ok:1.5.4
send: 143-143-0-0 s=255,c=3,t=16,pt=0,l=0,sg=0,st=ok:
read: 0-0-143 s=255,c=3,t=17,pt=6,l=25,sg=0:01760D40777B6F77FB01DB9885D5E308FEA51F1A08C6FB2062
send: 143-143-0-0 s=255,c=3,t=6,pt=1,l=1,sg=1,st=ok:0
sensor started, id=143, parent=0, distance=1
send: 143-143-0-0 s=1,c=0,t=6,pt=0,l=0,sg=0,st=ok:
send: 143-143-0-0 s=0,c=0,t=29,pt=0,l=0,sg=0,st=ok:
send: 143-143-0-0 s=1,c=3,t=16,pt=0,l=0,sg=0,st=ok:
read: 0-0-143 s=255,c=3,t=17,pt=6,l=25,sg=0:0113FB50BA8E123562556FFB438496DD27EE929E73D8B05435
send: 143-143-0-0 s=1,c=1,t=0,pt=7,l=5,sg=1,st=ok:24.0
send: 143-143-0-200 s=0,c=1,t=2,pt=7,l=5,sg=0,st=ok:1.0
send: 143-143-0-0 s=1,c=3,t=16,pt=0,l=0,sg=0,st=ok:
read: 0-0-143 s=255,c=3,t=17,pt=6,l=25,sg=0:01064049BBFFF98FDAD1841895BC33ECDDA202E66BDB9D045F
send: 143-143-0-0 s=1,c=1,t=0,pt=7,l=5,sg=1,st=ok:24.0
send: 143-143-0-200 s=0,c=1,t=2,pt=7,l=5,sg=0,st=ok:1.0
log without msgHeater.setDestination(200);
send: 143-143-0-0 s=255,c=3,t=15,pt=2,l=2,sg=0,st=ok:1
read: 0-0-143 s=255,c=3,t=15,pt=2,l=2,sg=0:1
send: 143-143-0-0 s=255,c=3,t=16,pt=0,l=0,sg=0,st=ok:
read: 0-0-143 s=255,c=3,t=17,pt=6,l=25,sg=0:01B3F448E00B03DE197731D7302FC7167D50E9F50B77C63700
send: 143-143-0-0 s=255,c=0,t=17,pt=0,l=5,sg=1,st=ok:1.5.4
send: 143-143-0-0 s=255,c=3,t=16,pt=0,l=0,sg=0,st=ok:
read: 0-0-143 s=255,c=3,t=17,pt=6,l=25,sg=0:0113FB50BA8E123562556FFB438496DD27EE929E73D8B05435
send: 143-143-0-0 s=255,c=3,t=6,pt=1,l=1,sg=1,st=ok:0
sensor started, id=143, parent=0, distance=1
send: 143-143-0-0 s=1,c=0,t=6,pt=0,l=0,sg=0,st=ok:
send: 143-143-0-0 s=0,c=0,t=29,pt=0,l=0,sg=0,st=ok:
send: 143-143-0-0 s=1,c=3,t=16,pt=0,l=0,sg=0,st=ok:
read: 0-0-143 s=255,c=3,t=17,pt=6,l=25,sg=0:01064049BBFFF98FDAD1841895BC33ECDDA202E66BDB9D045F
send: 143-143-0-0 s=1,c=1,t=0,pt=7,l=5,sg=1,st=ok:24.0
send: 143-143-0-0 s=0,c=3,t=16,pt=0,l=0,sg=0,st=ok:
read: 0-0-143 s=255,c=3,t=17,pt=6,l=25,sg=0:0113FB50BA8E123562556FFB438496DD27EE929E73D8B05435
send: 143-143-0-0 s=0,c=1,t=2,pt=7,l=5,sg=1,st=ok:1.0
Arduino ide 1.6.1
the node is arduino nano and gateway is a mini pro over a Raspberry Pi via serial
I don't now if is a bug or a programming error.
Thank you for help
Stefano
p.s.: sorry for the broken english