about 13 hours ago
Hello,
To know if we look at the date and time in the column "Last seen" in chilid "0" at 6:30 the alarm was stopped, and that's normal, on the other hand the childid phantoms 25, 249 and 255 were requested at the same time, why? So I'll show you the part of the script that you might be interested in:
#define MY_GATEWAY_SERIAL
#define MY_TRANSPORT_WAIT_READY_MS 5000 //set how long to wait for transport ready in milliseconds
#define MY_GATEWAY_SERIAL_BAUD_RATE 115200
#define MY_DEBUG
#define CHILD_ID_ARMED 0
#define IDX_PORTAIL2 635
#define IDX_PORTILLON2 1129
#define IDX_Texte1 1143
#define IDX_Texte2 1144
#define Code_ON 0
#define Code_OFF 1
#include <Tiny4kOLED.h>
#include<EEPROM.h>
#include <MySensors.h>
#include <Keypad.h>
int bu1=0;
int i=0;
int ii=0;
int Arme = 0;
int value0 = 0;
int oldValue0 = 0;
char pass1[4];
char customKey;
char customKey1;
int watchdog1 = 30000; // Fréquence des lectures des données Domoticz
unsigned long previousMillis2 = 0;
const unsigned long timeout2 = 30000; // Timeout de 30 secondes
unsigned long previousMillis1 = 0;
unsigned long currentMillis1 = millis();
unsigned long currentMillis2 = millis();
int returnWait = 1500;
int returnWait1 = 500;
int returnWait2 = 100;
int returnWait3 = 10;
int returnWait4 = 3000;
int returnWait5 = 800;
const int PinBuzzer = 10;
// *********** Pour MySensors **************************************************************
char newMessage[40]; // taille message reçu
char newMessage1[40]; // taille message reçu
bool state = 0;
MyMessage msg0(CHILD_ID_ARMED, V_STATUS);
MyMessage msg1(IDX_PORTAIL2, V_STATUS);
MyMessage msg2(IDX_PORTILLON2, V_STATUS);
MyMessage Texte1(IDX_Texte1, V_TEXT);
MyMessage Texte2(IDX_Texte2, V_TEXT);
void presentation(){
// Send the sketch version information to the gateway and Controller
sendSketchInfo("ClavierOled", "1.0");
// Register all sensors to gateway (they will be created as child devices)
present(CHILD_ID_ARMED, S_BINARY, "Armed");
present(IDX_PORTAIL2, S_BINARY, "Portail2");
present(IDX_PORTILLON2, S_BINARY, "Portillon2");
present(IDX_Texte1, S_INFO, "Texte1");
present(IDX_Texte2, S_INFO, "Texte2");
}
void setup() {
//Serial.begin(115200);
pinMode(PinBuzzer, OUTPUT);
digitalWrite(PinBuzzer, LOW);
oled.begin(128, 64, sizeof(tiny4koled_init_128x64br), tiny4koled_init_128x64br);
oled.setFontX2(FONT6X8P);
oled.on();
etablirInformations(); // initialise la structure avec soit le mot de passe par défaut, soit celui qui était déjà en EEPROM si dispo
presentation();
} // Fin Setup
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void loop() {
currentMillis1 = millis();
customKey = customKeypad.getKey();
if (customKey) { // si une touche du clavier et que l'alarme est active
if (Arme != 0) {
Dysarmed();
}
switch (customKey) {
case '*':
MENU();
break;
case '#':
send(msg1.set(1)); // Envoi la commande Portail
oled.clear();
oled.setCursor(20, 3);
oled.setFontX2(FONT6X8P);
oled.println("PORTAIL");
wait(returnWait + 2000);
break;
case 'C':
send(msg2.set(1)); // Envoi la commande Portillon
oled.clear();
oled.setCursor(18, 3);
oled.setFontX2(FONT6X8P);
oled.println("Portillon");
wait(returnWait + 2000);
break;
default:
// Rien si timeout atteint et aucune touche pressée
break;
}
}
customKey = NO_KEY;
// Gestion de l'écran de veille
if ((currentMillis1 - previousMillis1) > watchdog1) {
oled.clear();
oled.setCursor(i, ii);
oled.setFont(FONT6X8);
oled.println(Arme == 1 ? "Alarme ON" : "Alarme Off");
oled.setFontX2(FONT6X8P);
previousMillis1 = currentMillis1;
i = (i > 68) ? 0 : i + 1;
ii = (ii > 6) ? 0 : ii + 1;
watchdog1 = 10000; // Réinitialisation du watchdog
}
}
void receive(const MyMessage &message) {
if (message.getType() == V_STATUS) { // check to see if incoming message is for a switch
switch (message.sensor) { // message.getCommand will give us the command type of the incomming message
case 0: //message is a set command from controller to update relay state
state = message.getBool(); // get the new state
digitalWrite(0, state ? Code_ON : Code_OFF); // switch relay to new state
Arme = state;
if (Arme == 1) {
oled.setFont(FONT6X8);
oled.println("Alarme ON");
oled.setFontX2(FONT6X8P);
}
if (Arme == 0) {
oled.setFont(FONT6X8);
oled.println();
oled.println("Alarme Off");
oled.setFontX2(FONT6X8P);
}
}
}
if (message.getType()==V_TEXT) {
oled.setFont(FONT6X8);
if (message.sensor == IDX_Texte1){
strcpy(newMessage, message.getString());
oled.clear();
oled.setCursor(0,2);
for (i = 0; i < sizeof(newMessage)-1; i++) {
oled.write(newMessage[i]);
}
}
if (message.sensor == IDX_Texte2){
strcpy(newMessage1, message.getString());
oled.setCursor(0,3);
for (i = 0; i < sizeof(newMessage1)-1; i++) {
oled.write(newMessage1[i]);
wait (returnWait3);
}
}
for (int bu=0; bu <= 1; bu++){
digitalWrite(PinBuzzer, HIGH);
wait(returnWait4);
digitalWrite(PinBuzzer, LOW);
wait(returnWait1);
}
wait (returnWait4);
}
}
If you see anything abnormal, please let me know.
Have a nice day.