Code: Select all
MyMessage Msg_DB(Sensor_DB, V_VAR1);
Code: Select all
present(Sensor_DB,S_CUSTOM, "Wifi dB"); //wifi db
Code: Select all
void Sync_DB() {
int i = WiFi.RSSI();
send(Msg_DB.set(i));
}
I also tried using: V_LEVEL and S_SOUND, but also no device did appear.
Can anyone help me how to solve this?
The entire Sketch (the includes are in the main sketch).
Code: Select all
const byte Sensor_HEART = 1;
const byte Sensor_Relais[] = {2,3,4,5,6,7,8}; // 7 totaal
const byte Sensor_VIN = 9;
const byte Sensor_VBATT = 10;
const byte Sensor_VOUT = 11;
const byte Sensor_PWR = 15;
const byte Sensor_TEMP = 13;
//const byte Sensor_TEMPHUM = 16;
const byte Sensor_ESP = 20;
const byte Sensor_DB = 19;
MyMessage Msg_HEART(Sensor_HEART, V_STATUS);
MyMessage Msg_Relais[7];
MyMessage Msg_VIN_V(Sensor_VIN,V_VOLTAGE);
MyMessage Msg_VIN_A(Sensor_VIN,V_CURRENT);
MyMessage Msg_VBATT_V(Sensor_VBATT,V_VOLTAGE);
MyMessage Msg_VOUT_V(Sensor_VOUT,V_VOLTAGE);
MyMessage Msg_VOUT_A(Sensor_VOUT,V_CURRENT);
MyMessage Msg_PWR_WTT(Sensor_PWR, V_WATT);
MyMessage Msg_PWR_KWH(Sensor_PWR, V_KWH);
MyMessage Msg_PWR_VAR(Sensor_PWR, V_VAR1);
MyMessage Msg_TEMP(Sensor_TEMP, V_TEMP);
MyMessage Msg_HUM(Sensor_TEMP, V_HUM);
MyMessage Msg_ESP(Sensor_ESP, V_CUSTOM);
MyMessage Msg_DB(Sensor_DB, V_VAR1);
//MyMessage Msg_TEMP(Sensor_TEMPHUM, V_TEMP);
//MyMessage Msg_HUM(Sensor_TEMPHUM, V_HUM);
void setupMySensor() {
for (byte i=0;i<7;i++) {
Msg_Relais[i].sensor = Sensor_Relais[i];
Msg_Relais[i].type = V_STATUS;
}
}
void requestConnectDetection() {
request(Sensor_HEART,V_STATUS); //S_BINARY
DuurReqAnsTnul=millis();
}
void requestAfterReconnect() {
for (byte i=0;i<7;i++) {
request(Sensor_Relais[i],V_STATUS);
}
request(Sensor_PWR, V_VAR1);
}
///////////////////////
// Presentation
//////////////////////
void presentation()
{
sendSketchInfo(PROJECT,VERSION);
present(Sensor_HEART, S_BINARY, "Heartbeat");
char* rl="Rel @";
for (byte i=0;i<7;i++) {
rl[4]=48+i;
present(Sensor_Relais[i], S_LIGHT, rl);
}
present(Sensor_VIN, S_MULTIMETER,"VA zonnecel");
present(Sensor_VBATT, S_MULTIMETER, "V accu");
present(Sensor_VOUT, S_MULTIMETER, "VA out");
present(Sensor_PWR,S_POWER, "Vermogen Zonnecel");
present(Sensor_TEMP,S_TEMP, "Temp Hum tuin");
// present(Sensor_TEMPHUM,S_HUM);
present(Sensor_ESP,S_INFO, "ESP Info");
present(Sensor_DB,S_CUSTOM, "Wifi DB"); //wifi db
}
///////////////////////////////////
///////////////////////////////////
///////////////////////////////////
///////////////////////////////////
void receive(const MyMessage &message) {
if (message.sensor == Sensor_HEART) { //MySensor connected detection
isMySensorsConnected = true;
DuurReqAns=(millis() - DuurReqAnsTnul);
}
if (message.sensor == Sensor_PWR) { //MySensor opvragen KWH stand
SolarTotal = message.getFloat();
myLog+=" KWH=" + String(SolarTotal,6);
}
for (byte i=0;i<7;i++) {
if (message.sensor == Sensor_Relais[i]) {
//PCF.write(i,waarde
PCFwrite(i,message.getBool());
// myLog+="Rls " + String(i) + ": ";
// myLog+=String(message.getString());
// if (message.getBool()) {
// myLog+="=JA. ";
// } else {
// myLog+="=NEE. ";
// }
}
}
}
///////////////////////////////////
///////////////////////////////////
///////////////////////////////////
///////////////////////////////////
void Sync_Relais(byte i, bool v) {
send(Msg_Relais[i].set(v));
}
void Sync_HEART(bool v) {
send(Msg_HEART.set(v));
}
void Sync_PWR(float pwr, float kwh) {
send(Msg_PWR_WTT.set(pwr,2));
send(Msg_PWR_KWH.set(kwh,6));
send(Msg_PWR_VAR.set(kwh,6));
}
void Sync_TEMPHUM(float tmp, float hum) {
// send(Msg_TEMP.set(tmp,2));
// send(Msg_HUM.set(hum,2));
send(Msg_TEMP.set(tmp,2));
send(Msg_HUM.set(hum,2));
}
void Sync_VIN(float v, float a) {
send(Msg_VIN_V.set(v,2));
send(Msg_VIN_A.set(a,2));
}
void Sync_VBATT(float v) {
send(Msg_VBATT_V.set(v,2));
}
void Sync_VOUT(float v, float a) {
send(Msg_VOUT_V.set(v,2));
send(Msg_VOUT_A.set(a,2));
}
void Sync_ESP(String s) {
send(Msg_ESP.set(s)); //"WV1_c7_db-55"
myLog+=s;
}
void Sync_DB() {
int i = WiFi.RSSI();
send(Msg_DB.set(i));
}