Commit e0907197 authored by Juan Pablo Sarubbi's avatar Juan Pablo Sarubbi

Replace DHT22-Zbx.ino

parent bf7d3c31
......@@ -21,7 +21,7 @@ String zbx_cmd ="";
EthernetServer zServer(10050);
static byte mac[6] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xEE};
static byte ip[4] = {192, 168, 0, 2};
static byte ip[4] = {10, 10, 0, 76};
#define PIN_DHT 9 // Nro. de pin donde se encuentra conectado el sensor
#define DHTTYPE DHT22 // Modelo de sensor, puede ser DHT11, DHT21 o DHT22
......@@ -73,13 +73,13 @@ void loop() {
}
if(zbx_cmd.indexOf("agent.ping") >= 0) {
byte zbx_msg[1] = {0x31};
byte zbx_msg[] = {0x31};
zbx_print(zbx_msg, sizeof(zbx_msg));
} else if(zbx_cmd.equals("agent.hostname")) {
byte zbx_msg[14] = { 'A', 'r', 'd', 'u', 'i', 'n', 'o', '_', 'S', 'e', 'n', 's', 'o', 'r' };
byte zbx_msg[] = { 'A', 'r', 'd', 'u', 'i', 'n', 'o', '_', 'S', 'e', 'n', 's', 'o', 'r' };
zbx_print(zbx_msg, sizeof(zbx_msg));
} else if(zbx_cmd.equals("agent.version")) {
byte zbx_msg[4] = { '0', '.', '7', '0'};
byte zbx_msg[] = { '0', '.', '7', '0'};
zbx_print(zbx_msg, sizeof(zbx_msg));
} else if(zbx_cmd.equals("dht.temperature")) {
char zbx_msg[8];
......@@ -91,7 +91,7 @@ void loop() {
dtostrf(humidity, 6, 2, zbx_msg);
zbx_print(zbx_msg, sizeof(zbx_msg));
} else { // ZBX_NOTSUPPORTED
byte zbx_msg[38] = {'Z', 'B', 'X', '_', 'N', 'O', 'T', 'S', 'U', 'P', 'P', 'O', 'R', 'T', 'E', 'D', 0x00, 'U', 'n', 's', 'u', 'p', 'p', 'o', 'r', 't', 'e', 'd', ' ', 'i', 't', 'e', 'm', ' ', 'k', 'e', 'y', '.' };
byte zbx_msg[] = {'Z', 'B', 'X', '_', 'N', 'O', 'T', 'S', 'U', 'P', 'P', 'O', 'R', 'T', 'E', 'D', 0x00, 'U', 'n', 's', 'u', 'p', 'p', 'o', 'r', 't', 'e', 'd', ' ', 'i', 't', 'e', 'm', ' ', 'k', 'e', 'y', '.' };
zbx_print(zbx_msg, sizeof(zbx_msg));
}
zClient.stop();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment