82 lines
1.7 KiB
C++
82 lines
1.7 KiB
C++
#ifndef Domoticz_h
|
|
#define Domoticz_h
|
|
|
|
#include "Arduino.h"
|
|
#include <ArduinoJson.h>
|
|
#include <WiFi.h>
|
|
#include "HTTPClient.h"
|
|
//#include <WiFiClient.h>
|
|
#include "Ecran.h"
|
|
#include "Graph.h"
|
|
#include "Connect.h"
|
|
#include "common.h"
|
|
|
|
// Max devices in domoticz
|
|
#define MAX_DEVICES 4
|
|
#define NB_ROOMS 8
|
|
|
|
typedef struct {
|
|
String name;
|
|
String temperature_name;
|
|
String consigne_name;
|
|
String volet_name;
|
|
float temperature;
|
|
float consigne;
|
|
bool open;
|
|
String presence_name;
|
|
float presence;
|
|
} Room;
|
|
|
|
|
|
//typedef struct {
|
|
// String name;
|
|
// int temperature_idx;
|
|
// int consigne_idx;
|
|
// int volet_idx;
|
|
// float temperature;
|
|
// float consigne;
|
|
// bool open;
|
|
// int presence_idx;
|
|
// float presence;
|
|
//} Room;
|
|
|
|
typedef struct {
|
|
String date;
|
|
float value;
|
|
} Domoticz_device_log;
|
|
|
|
typedef struct {
|
|
int idx;
|
|
//Domoticz_device_log domoticz_device_log[max_readings];
|
|
float data_readings[max_readings] = {0};
|
|
} Device;
|
|
|
|
#define WL_MAC_ADDR_LENGTH 8
|
|
class Domoticz
|
|
{
|
|
public:
|
|
Domoticz(Ecran * ecran, Connect * connect, String domoticz, String port);
|
|
bool loadData();
|
|
void loadCounters(int idx[], String horizon);
|
|
void drawCounters(Graph_Param gp, int series[], int x, int y, int w, int h);
|
|
void loadTemps();
|
|
void drawTemps(int x0, int y, int w, int h);
|
|
void drawGraphs(int x0, int y, int w, int h);
|
|
void loadLinky();
|
|
String getVariableValue(int idx);
|
|
String setVariableValue(int idx, String value);
|
|
public:
|
|
int max_hours = max_readings;
|
|
//WiFiClient client;
|
|
Connect * connect;
|
|
Ecran * ecran;
|
|
int iport;
|
|
String domoticz;
|
|
String port;
|
|
int number_devices = 0;
|
|
Device devices[MAX_DEVICES];
|
|
Room * rooms[NB_ROOMS];
|
|
};
|
|
|
|
#endif
|