It looks that I've achieved my goal. I'm able dynamically change parent id node (proved in lab) and power level (don't have idea how to check it). You can send V_VAR1 message with number of preferred parent or V_VAR2 with requested power (values: 0 - RF24_PA_MIN, 1 - RF24_PA_LOW, 2 - RF24_PA_HIGH, RF24_PA_MAX) and then REBOOT node (required to changes take effect). Version of sketch reported to controller is changed dynamically depends of set power level.
My "repeater: code bellow:
#define SKETCH_NAME "Repeater Node L1"
#define SV "1.0.1"
#define MY_RADIO_NRF24
#define MY_REPEATER_FEATURE
int8_t myParrentNodeId;
int8_t myRF24PALevel;
#define MY_PARENT_NODE_ID myParrentNodeId
#define MY_RF24_PA_LEVEL myRF24PALevel
#include <MySensors.h>
#ifndef MY_REPEATER_FEATURE
#define SKETCH_VERSION1 SV
#else
#define SKETCH_VERSION1 SV "R"
#endif
#define SKETCH_VERSION SKETCH_VERSION1 " "
uint8_t SketchVersion[sizeof(SKETCH_VERSION)];
#define EEPROM_PARENT 0
#define EEPROM_PA_LEVEL 1
void before() {
int8_t tmpui = loadState(EEPROM_PARENT);
if (tmpui == 0xFF)
{
myParrentNodeId = 0;
}
else {
myParrentNodeId = tmpui;
}
memcpy(SketchVersion, SKETCH_VERSION, sizeof(SKETCH_VERSION));
tmpui = loadState(EEPROM_PA_LEVEL);
switch (tmpui)
{
case 0:
myRF24PALevel = RF24_PA_MIN;
memcpy(SketchVersion + sizeof(SKETCH_VERSION) - 4, "MIN", 3);
break;
case 1:
myRF24PALevel = RF24_PA_LOW;
memcpy(SketchVersion + sizeof(SKETCH_VERSION) - 4, "LOW", 3);
break;
case 2:
myRF24PALevel = RF24_PA_HIGH;
memcpy(SketchVersion + sizeof(SKETCH_VERSION) - 4, "HIG", 3);
break;
case 3:
myRF24PALevel = RF24_PA_MAX;
memcpy(SketchVersion + sizeof(SKETCH_VERSION) - 4, "MAX", 3);
break;
default:
myRF24PALevel = RF24_PA_MAX;
break;
}
}
void setup()
{
}
void presentation()
{
//Send the sensor node sketch version information to the gateway
//sendSketchInfo("Repeater Node L1 MAX", "1.0");
sendSketchInfo(SKETCH_NAME, SketchVersion);
}
void loop()
{
}
void receive(const MyMessage &message) {
if (!message.isAck()) {
if (message.type == V_VAR1) {
uint8_t tmpui = message.getByte();
uint8_t tmpui1 = loadState(EEPROM_PARENT);
if (tmpui != tmpui1)
{
saveState(EEPROM_PARENT, tmpui);
}
}
else if (message.type == V_VAR2)
{
uint8_t tmpui = message.getByte();
uint8_t tmpui1 = loadState(EEPROM_PA_LEVEL);
if (tmpui >= 0 && tmpui <= 3)
{
if (tmpui != tmpui1)
{
saveState(EEPROM_PA_LEVEL, tmpui);
}
}
}
}
}