text: /*
     -------------------------------------------------------------------
     EmonESP Serial to Emoncms gateway
     -------------------------------------------------------------------
     Adaptation of Chris Howells OpenEVSE ESP Wifi
     by Trystan Lea, Glyn Hudson, OpenEnergyMonitor
  
     Modified to use with the CircuitSetup.us Split Phase Energy Meter by jdeglavina
  
     All adaptation GNU General Public License as below.
  
     -------------------------------------------------------------------
  
     This file is part of OpenEnergyMonitor.org project.
     EmonESP is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 3, or (at your option)
     any later version.
     EmonESP is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.
     You should have received a copy of the GNU General Public License
     along with EmonESP; see the file COPYING.  If not, write to the
     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
     Boston, MA 02111-1307, USA.
  */
  #ifndef _EMONESP_MQTT_H
  #define _EMONESP_MQTT_H
  
  // -------------------------------------------------------------------
  // MQTT support
  // -------------------------------------------------------------------
  
  #include <Arduino.h>
  #include <PubSubClient.h>             // MQTT https://github.com/knolleary/pubsubclient PlatformIO lib: 89
  #include <WiFiClient.h>
  #include "emonesp.h"
  
  #ifndef MQTT_TIMEOUT
  #define MQTT_TIMEOUT 3
  #endif
  
  // -------------------------------------------------------------------
  // Perform the background MQTT operations. Must be called in the main
  // loop function
  // -------------------------------------------------------------------
  extern void mqtt_loop();
  
  // -------------------------------------------------------------------
  // Publish values to MQTT
  //
  // data: a comma seperated list of name:value pairs to send
  // -------------------------------------------------------------------
  extern void mqtt_publish(const char * data);
  
  // -------------------------------------------------------------------
  // Restart the MQTT connection
  // -------------------------------------------------------------------
  extern void mqtt_restart();
  
  
  // -------------------------------------------------------------------
  // Return true if we are connected to an MQTT broker, false if not
  // -------------------------------------------------------------------
  extern boolean mqtt_connected();
  
  String uint64ToString(uint64_t input);
  
  extern char input_json[MAX_DATA_LEN];
  
  
  #endif // _EMONESP_MQTT_H
  