mqtt.h
1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#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_TEMP "temperature"
#define T_MOIST "moisture"
#define T_PUMPSOURCE "pumpsource"
#define T_PUMPSTATE "pumpstate"
#define T_PUMPLEVEL "pumplevel"
#define T_PUMPDURATION "pumpduration"
#define T_PUMPABORT "pumpabort"
#define T_FILL "fill/"
#define T_ROTATE "rotate/"
#define T_FERTILIZE "fertilize/"
#define TS_DURATION "duration"
#define TS_LEVEL "level"
#define C_FILL_DURATION 0
#define C_ROTATE_DURATION 1
#define C_FERTILIZE_DURATION 2
long stringToLong(String s);
void setup_mqtt();
void mqttSubscribe();
void mqttPublished();
void mqttConnected();
void mqttDisconnected();
void mqttData(String& topic, String& data);
#endif