This example implements a secure actuator in the form of a IO controlled electrical lock.
Multiple locks are supported as long as they are on subsequent IO pin indices. The first lock pin is defined by LOCK_1. The number of locks is controlled by NOF_LOCKS .
The sketch will require incoming messages to be signed and the use of signing backend is selected by MY_SIGNING_ATSHA204 or MY_SIGNING_SOFT. Hard or soft ATSHA204 signing is supported.
Whitelisting can be enabled through MY_SIGNING_NODE_WHITELISTING in which case a single entry is provided in this example which typically should map to the gateway of the network.
#define MY_DEBUG
#define MY_DEBUG_VERBOSE_SIGNING
#define MY_NODE_LOCK_FEATURE
#define MY_RADIO_RF24
//#define MY_RADIO_NRF5_ESB
//#define MY_RADIO_RFM69
//#define MY_RADIO_RFM95
#define MY_SIGNING_SOFT
//#define MY_SIGNING_ATSHA204
#define MY_SIGNING_REQUEST_SIGNATURES
#define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
#ifndef MY_SIGNING_ATSHA204_PIN
#define MY_SIGNING_ATSHA204_PIN 17
#endif
#define LOCK_1 3
#define NOF_LOCKS 1
#define LOCK_LOCK 1
#define LOCK_UNLOCK 0
{
pinMode(pin, OUTPUT);
}
}
{
present(lock, S_LOCK,
"SecureActuator",
false);
}
}
{
}
{
Serial.print("Incoming change for lock:");
Serial.print(", New status: ");
}
}
bool present(const uint8_t sensorId, const mysensors_sensor_t sensorType, const char *description="", const bool requestEcho=false)