MyController 1.2.0-SNAPSHOT version with major provider changes and supports for ack
-
I'd like to do some testing too!
I have 2 ethernet gateways, but this new versions seems to have some issue with GW presentation (I still haven't enabled ack on GW): -
-
You're super-quick!!!
I updated the version, and now the issue is fixed.
For the time being everything is running fine, I'll let it run for a pair of days and let you know if I find any issue.By the way, I suggest adding something in this page to expose the ack flag status:
-
PS: really minor issue: the order of the dashboards is reversed now; is there a way to change it?
-
PS: really minor issue: the order of the dashboards is reversed now; is there a way to change it?
There is a change in dashboard, from this fix -> https://github.com/mycontroller-org/mycontroller/issues/424
Do you see anything different? It should be
order by ascending alphabetical
-
By the way, I suggest adding something in this page to expose the ack flag status:
You mean ack enabled or disabled? Or something else?
-
@jkandasa That's exactly what's happening, I missed that change. Thanks!
-
@jkandasa Actually without going in edit you don't have anything telling you if this GW uses ack. Enabled / disabled would be enough for me.
-
@daniele said in MyController 1.2.0-SNAPSHOT version with major provider changes and supports for ack:
@jkandasa Actually without going in edit you don't have anything telling you if this GW uses ack. Enabled / disabled would be enough for me.
Changes updated in SNAPSHOT build.
changes: https://github.com/mycontroller-org/mycontroller/commit/0e7467e230927b67d8f664476f83e2f509d69010 -
When registering nodes with a sensor of the "Motion" type in the old version of MyController, I created two variables "V_ARMED" and "V_TRIPPED". In the new version, only a variable of the type "V_TRIPPED" is created
I'm still looking error in my sketch -
Earlier, when I changed the variable "Armed" on a sleeping node
MyController waited until the node came out of sleep and sent it the right message.
Now when I try to change this variable, I get the following warning
-
When registering nodes with a sensor of the "Motion" type in the old version of MyController, I created two variables "V_ARMED" and "V_TRIPPED". In the new version, only a variable of the type "V_TRIPPED" is created
I guess the problem will be your node sketch presentation code?
-
@wanvo said in MyController 1.2.0-SNAPSHOT version with major provider changes and supports for ack:
MyController waited until the node came out of sleep and sent it the right message.
Now when I try to change this variable, I get the following warningYes, I changed this approach as follows,
If you change anything for a sleeping node, simply it will be sent to the queue. Will not update into inventory/graph etc., Once it sent successfully to the sleeping node, it will be updated.
I will change this message to user friendly, also I will try to display message queue for a sleeping node.
-
@jkandasa said in MyController 1.2.0-SNAPSHOT version with major provider changes and supports for ack:
I guess the problem will be your node sketch presentation code?
This my presentation codevoid presentation() { sendSketchInfo(SKETCH_NAME, SKETCH_VERSION,true); present(ID_S_MOTION, S_MOTION, "Motion Sensor",true); present(ID_TIME_SLEEP, S_CUSTOM, "Time sleep",true); } void loop() { if(first_start){ first_start = false; DEBUG_PRINTLN("Start"); send(msg_S_MOTION.set(false),true); send(msg_S_MOTION_ARM.set(s_armed),true); //send(msg_TIME_SLEEP.set(time_sleep)); //sendRSSIReport(); //sendBatteryReport(); request(ID_TIME_SLEEP, V_VAR5); //запрос значения time_sleep```
This all sketch
/******************************************************************* * DEFINE SECTION ********************************************************************/ // Enable debug prints //#define MY_DEBUG #define SER_DEBUG #ifdef SER_DEBUG #define DEBUG_SERIAL(x) Serial.begin(x) #define DEBUG_PRINT(x) Serial.print(x) #define DEBUG_PRINTLN(x) Serial.println(x) #else #define DEBUG_SERIAL(x) #define DEBUG_PRINT(x) #define DEBUG_PRINTLN(x) #endif #define ONE_DAY_TIME 86400000 //24 часа #define ONE_HOUR_TIME 3600000 //1 час #define MY_SMART_SLEEP_WAIT_DURATION_MS (30000ul) //время прослушки эфира до ухода в сон #define TIME_SLEEP_INIT 60000 #define RSSI_REPORT_INTERVAL 180000 #define BATTERY_REPORT_INTERVAL 600000 //#define BATTERY_REPORT_INTERVAL ONE_DAY_TIME //#define MY_INDICATION_HANDLER // Enable and select radio type attached //#define MY_RADIO_NRF24 #define MY_RADIO_RFM69 //#define MY_RADIO_RFM95 //#define MY_RADIO_NRF5_ESB #ifdef MY_RADIO_NRF24 //#define SKETCH_NAME "nrf24 gate" #define MY_RF24_PA_LEVEL (RF24_PA_MAX) #define MY_RF24_CHANNEL (124) //#define MY_RF24_CHANNEL (125) #endif #ifdef MY_RADIO_RFM69 //#define SKETCH_NAME "rfm69 gate" #define MY_IS_RFM69HW #define MY_RFM69_NEW_DRIVER // ATC on RFM69 works only with the new driver (not compatible with old=default driver) #define MY_RFM69_ATC_MODE_ENABLED #define MY_RFM69_ATC_TARGET_RSSI_DBM (-70) // target RSSI -70dBm #define MY_RFM69_MAX_POWER_LEVEL_DBM (20) // max. TX power 10dBm = 10mW //#define MY_DEBUG_VERBOSE_RFM69 //#define MY_RFM69_ENABLE_ENCRYPTION #endif //**** Message signing settings /*#define MY_SIGNING_SOFT #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7 #define MY_SIGNING_REQUEST_SIGNATURES*/ #ifdef MY_RADIO_RFM95 //#define SKETCH_NAME "rfm95 gate" #define MY_RFM95_FREQUENCY RFM95_434MHZ //#define MY_TRANSPORT_STATE_TIMEOUT_MS (3*1000ul) //#define RFM95_RETRY_TIMEOUT_MS (3000ul) //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR48SF4096 #define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128 #define MY_RFM95_ATC_TARGET_RSSI_DBM (-70) // target RSSI -70dBm #define MY_RFM95_MAX_POWER_LEVEL_DBM (30) // max. TX power 30dBm = 1000mW #endif #ifdef MY_RADIO_NRF5_ESB //#define SKETCH_NAME "nrf5 gate" #endif #if defined(MY_RADIO_RFM69) || defined(MY_RADIO_RFM95) #define MY_SIGNAL_REPORT_ENABLED #define MY_DEFAULT_RX_LED_PIN LED_BUILTIN #endif // Set baud rate to same as optibot #define MY_BAUD_RATE 9600 #define MY_NODE_ID 3 #define SKETCH_NAME "Motion Sensor" #define SKETCH_VERSION "1.0" #define ID_S_MOTION 1 // Id of the sensor child #define ID_TIME_SLEEP 2 #define ID_RSSI 3 #define PIN_S_MOTION 3 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!) #define PIN_PWR 4 // Pin for power sensors in sleep. #define VCC_MIN 2.7 #define VCC_MAX 3.9 #include <MySensors.h> #include <Vcc.h> Vcc vcc; /* //Отправить уровень батареи после стольких циклов передач.Максимальный интервал отчета также будет равен этому количеству дней. int BATTERY_REPORT_BY_IRT_CYCLE = 10; // "false" will make the first loop disregard high output from HV-505 (from start-up) and make a battery report instead. bool interruptReturn = false; */ #if defined(MY_RADIO_RFM69) || defined(MY_RADIO_RFM95) MyMessage msg_RSSI(ID_RSSI,V_VAR5);//Создаем контейнер для измерителя RSSI #endif MyMessage msg_S_MOTION(ID_S_MOTION, V_TRIPPED);// Создаем контейнер для датчика MyMessage msg_S_MOTION_ARM(ID_S_MOTION, V_ARMED);// Создаем контейнер для датчика MyMessage msg_TIME_SLEEP(ID_TIME_SLEEP, V_VAR5); bool first_start; bool s_armed; //режим работы сенсора - armed, bypassed unsigned long time_sleep; unsigned long lastSendRSSI = 0; unsigned long lastSendBattery = 0; unsigned long millis_in_sleep = 0; unsigned long millis_total = 0; int sleep_returt; void setup() { DEBUG_PRINTLN("Setup"); first_start = true; s_armed = true; time_sleep = TIME_SLEEP_INIT; pinMode(PIN_PWR, OUTPUT);//Пин питающий датчики digitalWrite(PIN_PWR, HIGH); pinMode(PIN_S_MOTION, INPUT); // Вход датчика //digitalWrite(PIN_S_DOOR, HIGH); //подтяжка к плюсу для отладки } void presentation() { sendSketchInfo(SKETCH_NAME, SKETCH_VERSION,true); present(ID_S_MOTION, S_MOTION, "Motion Sensor",true); present(ID_TIME_SLEEP, S_CUSTOM, "Time sleep",true); } void loop() { if(first_start){ first_start = false; DEBUG_PRINTLN("Start"); send(msg_S_MOTION.set(false),true); send(msg_S_MOTION_ARM.set(s_armed),true); //send(msg_TIME_SLEEP.set(time_sleep)); //sendRSSIReport(); //sendBatteryReport(); request(ID_TIME_SLEEP, V_VAR5); //запрос значения time_sleep } millis_total = millis() + millis_in_sleep + MY_SMART_SLEEP_WAIT_DURATION_MS; #if defined(MY_RADIO_RFM69) || defined(MY_RADIO_RFM95) if (millis_total - lastSendRSSI > RSSI_REPORT_INTERVAL) { lastSendRSSI = millis_total; sendRSSIReport(); } #endif if (millis_total - lastSendBattery > BATTERY_REPORT_INTERVAL) { lastSendBattery = millis_total; sendBatteryReport(); } //sendHeartbeat(); sleep_returt = sleep(digitalPinToInterrupt(PIN_S_MOTION),CHANGE,time_sleep,true); if(sleep_returt != MY_WAKE_UP_BY_TIMER){ // проснулись по тревоге send(msg_S_MOTION.set(true),true); DEBUG_PRINTLN("ТРЕВОГА!!!"); } else{ millis_in_sleep = millis_in_sleep + time_sleep; } DEBUG_PRINT("ts = ");DEBUG_PRINTLN(time_sleep); } /*********************FUNCTIONS**********************************/ //функция обработки входящих сообщений void receive(const MyMessage &message) { if (message.sensor == ID_S_MOTION) { //проверяем, что именно этому сенсору if (message.type == V_ARMED) { //проверяем тип переменной s_armed = message.getBool(); //получаем значение V_ARMED DEBUG_PRINT("V_ARMED received: ");DEBUG_PRINTLN(s_armed); if(s_armed){ DEBUG_PRINTLN("Power On"); digitalWrite(PIN_PWR, HIGH); //включаем питание //digitalWrite(PIN_PWR, LOW); //для отладки } else{ DEBUG_PRINTLN("Power Off"); digitalWrite(PIN_PWR, LOW); //отключаем питание //digitalWrite(PIN_PWR, HIGH); //для отладки } } } else if (message.sensor == ID_TIME_SLEEP){ if (message.type == V_VAR5) { time_sleep = message.getULong(); //получаем значение sleep_time DEBUG_PRINT("time_sleep = ");DEBUG_PRINTLN(time_sleep); } } } //функция отправки RSSI если используем RFM69 радио #if defined(MY_RADIO_RFM69) || defined(MY_RADIO_RFM95) void sendRSSIReport() { int16_t rssiVal; char rssiStr[14]; rssiVal = transportGetSignalReport(SR_RX_RSSI); // snprintf(rssiStr,10,"rssi: %d%",rssiVal,"dBm"); sprintf (rssiStr, "rssi:%d dBm", rssiVal); send(msg_RSSI.set(rssiStr),true); DEBUG_PRINTLN(rssiStr); //DEBUG_PRINT("TxRssi = ");DEBUG_PRINTLN(transportGetSignalReport(SR_TX_RSSI)); } #endif //функция отправки отчета состояния батареи void sendBatteryReport() { float p = vcc.Read_Perc(VCC_MIN, VCC_MAX, true); int batteryPcnt = static_cast<int>(p); sendBatteryLevel(batteryPcnt,true); DEBUG_PRINT("Battery is: ");DEBUG_PRINTLN(batteryPcnt); }
I can not find an error yet. I'll look further.
-
@wanvo Is this sketch running first time with MyController? Do you have this sketch with the previous version? Did it work with old version?
Can you add some minimal delay between,
send(msg_S_MOTION.set(false),true); wait(500); // value in milliseconds send(msg_S_MOTION_ARM.set(s_armed),true);
-
@jkandasa
Thanx! I'll try. -
I noticed that when I reboot a node, the sensors names are overwritten with the sketch version (and since I didn't change the sketch and it was not happening in 1.1.0, so I guess this is not an error in the sketch):
-
@daniele version 1.1.0 also designed the same.
When it receives node/sensor name will be replaced with the local(MyController database) one. -
I'm not sure I understood.
I had sensor name set up in mycontroller, and not in the Arduino sketch (btw, I don't know a way to set it up in the sketch).
But the name in mycontroller has been overwritten with "1.2", which is the sketch version. -
@daniele Via sketch you can assign as follows,
void presentation() { sendSketchInfo("NODE_NAME", "NODE_VERSION"); present(SEN_ID, S_CUSTOM, "SENSOR_NAME"); }