thermferm/mqtt.h

Mon, 15 Apr 2024 17:04:57 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 15 Apr 2024 17:04:57 +0200
changeset 678
cc49115e769e
parent 677
c867eb3f7fc1
child 689
f94b525f7563
permissions
-rw-r--r--

Better websocket broadcast messages. Added GLOBAL JSON command to the server. Better logic to trigger websocket and mqtt data updates for the fermenter units. Websocket receive added fermenter mode, stage, setpoints, switches. Added more css styles for the fermenter screen. Added the fermenter screen php and javascript.

#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);

char *unit_data(units_list *unit, bool birth);

/**
 * @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