mqtt.h 723 Bytes
#ifndef __MQTT_H_
#define __MQTT_H_

#include <MQTT.h>
#include "sonar.h"
#include "queue.h"

const char *mqtt_server = "sokoban.fritz.box";
const char *device_id = "kompost";
MQTT mqttClient(device_id, mqtt_server, 1883);

#define PREAMBLE         "home/compost/"
#define T_RDIST          "rawdistance"
#define T_SDIST          "waterlevel"
#define T_PUMPSOURCE     "pumpsource"
#define T_PUMPSTATE      "pumpstate"
#define T_PUMPLEVEL      "pumplevel"
#define T_PUMPDURATION   "pumpduration"
#define T_PUMPABORT      "pumpabort"

long stringToLong(String s);
void setup_mqtt();
void mqttSubscribe();
void mqttPublished();
void mqttConnected();
void mqttDisconnected();
void mqttData(String& topic, String& data);

#endif