thermferm/mqtt.h

Sat, 25 Apr 2020 20:31:31 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 25 Apr 2020 20:31:31 +0200
changeset 605
e00f8ff4de9a
parent 598
363dc36d2450
child 677
c867eb3f7fc1
permissions
-rw-r--r--

Version 0.9.8. Added extra path to the fonts for Debian buster. Changed the PID to work on Proportional on Measurement. Added loops so that it looks like the PID is running at 100 mSec intervals.

#ifndef	_MQTT_H
#define	_MQTT_H


#define STATUS_CONNECTING 0
#define STATUS_CONNACK_RECVD 1
#define STATUS_WAITING 2

#ifndef HAVE_WIRINGPI_H

// Pi model types and version numbers
//      Intended for the GPIO program Use at your own risk.

#define PI_MODEL_A               0
#define PI_MODEL_B               1
#define PI_MODEL_AP              2
#define PI_MODEL_BP              3
#define PI_MODEL_2               4
#define PI_ALPHA                 5
#define PI_MODEL_CM              6
#define PI_MODEL_07              7
#define PI_MODEL_3B              8
#define PI_MODEL_ZERO            9
#define PI_MODEL_CM3            10
#define PI_MODEL_ZERO_W         12
#define PI_MODEL_3BP            13
#define PI_MODEL_3AP            14
#define PI_MODEL_CM3P           16

#define PI_VERSION_1            0
#define PI_VERSION_1_1          1
#define PI_VERSION_1_2          2
#define PI_VERSION_2            3

#define PI_MAKER_SONY           0
#define PI_MAKER_EGOMAN         1
#define PI_MAKER_EMBEST         2
#define PI_MAKER_UNKNOWN        3


#endif


/*
 * Public functions
 */
void pub_domoticz_temp(int, int);
void pub_domoticz_output(int, int);
void mqtt_connect(void);
void mqtt_disconnect(void);

/**
 * @brief Publish DBIRTH for all active units. If there are no active units, don't
 *        publish anything. This function should be called at program start.
 */
void publishDBirthAll(void);

/**
 * @brief Publish unit data.
 * @param unit Unit data structure.
 */
void publishDData(units_list *unit);

/**
 * @brief Publish unit birth.
 * @param unit Unit data structure.
 */
void publishDBirth(units_list *unit);

/**
 * @brief Publish death of a unit.
 * @param unit Unit data structure.
 */
void publishDDeath(units_list *unit);

/**
 * @brief Publish log data.
 * @param unit Unit data structure.
 */
void publishDLog(units_list *unit);

/**
 * @brief Publish Node data or birth message.
 * @param birth If true send a birh message, else a regular data update.
 * @param flag Bit flag to enable control messages.
 */
void publishNData(bool birth, int flag);


#endif

mercurial