Skip to content

Commit

Permalink
refactor(mqtt): refactored mqtt messages
Browse files Browse the repository at this point in the history
  • Loading branch information
tspopp committed Dec 8, 2023
1 parent a76aec6 commit 15d6eac
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 101 deletions.
107 changes: 53 additions & 54 deletions AquaMQTT/include/mqtt/MQTTDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ namespace aquamqtt
{
namespace mqtt
{
const char BASE_TOPIC[] PROGMEM = { "aquamqtt/" };
const char CONTROL_TOPIC[] PROGMEM = { "aquamqtt/ctrl/#" };
const char STATS_SUBTOPIC[] PROGMEM = { "stats/" };
// Base Topics
const char BASE_TOPIC[] PROGMEM = { "aquamqtt/" };
const char CONTROL_TOPIC[] PROGMEM = { "aquamqtt/ctrl/#" };

const char HMI_SUBTOPIC[] PROGMEM = { "hmi/" };
const char MAIN_SUBTOPIC[] PROGMEM = { "main/" };
const char ENERGY_SUBTOPIC[] PROGMEM = { "energy/" };
const char STATS_SUBTOPIC[] PROGMEM = { "stats/" };

// Enum Types
const char ENUM_UNKNOWN[] PROGMEM = { "UNKNOWN" };

const char ENUM_AQUAMQTT_MODE_LISTENER[] PROGMEM = { "listener" };
const char ENUM_AQUAMQTT_MODE_MITM[] PROGMEM = { "mitm" };
const char ENUM_AQUAMQTT_MODE_LISTENER[] PROGMEM = { "LISTENER" };
const char ENUM_AQUAMQTT_MODE_MITM[] PROGMEM = { "MITM" };

const char ENUM_OPERATION_MODE_AUTO[] PROGMEM = { "AUTO" };
const char ENUM_OPERATION_MODE_ECO_OFF[] PROGMEM = { "MAN ECO OFF" };
Expand Down Expand Up @@ -47,55 +49,52 @@ const char ENUM_TEST_MODE_ACTIVE_HEAT_PUMP_BOILER_BACKUP[] PROGMEM = { "TESTING
const char ENUM_OPERATION_TYPE_ALWAYS_ON[] PROGMEM = { "ALWAYS ON" };
const char ENUM_OPERATION_TYPE_TIMER[] PROGMEM = { "TIME WINDOW" };

// TODO: distinguish between messages
const char HOT_WATER_TEMP[] PROGMEM = { "waterTemp" };
const char SUPPLY_AIR_TEMP[] PROGMEM = { "supplyAirTemp" };
const char EVAPORATOR_AIR_TEMP_UPPER[] PROGMEM = { "evaporatorAirTemp" };
const char EVAPORATOR_AIR_TEMP_LOWER[] PROGMEM = { "evaporatorAirTempLower" };
const char HOT_WATER_TEMP_TARGET[] PROGMEM = { "waterTempTarget" };
const char TOTAL_HEATING_ELEM_HOURS[] PROGMEM = { "totalHeatingElemHours" };
const char TOTAL_HEATPUMP_HOURS[] PROGMEM = { "totalHeatpumpHours" };
const char TOTAL_HOURS[] PROGMEM = { "totalHours" };
const char TOTAL_ENERGY_WH[] PROGMEM = { "totalEnergyWh" };
const char OPERATION_MODE[] PROGMEM = { "operationMode" };
const char OPERATION_TYPE[] PROGMEM = { "operationType" };
const char TIME[] PROGMEM = { "time" };
const char DATE[] PROGMEM = { "date" };
const char POWER_TOTAL[] PROGMEM = { "powerTotal" };
const char POWER_HEAT_ELEMENT[] PROGMEM = { "powerHeatingElem" };
const char POWER_HEATPUMP[] PROGMEM = { "powerHeatpump" };
const char FAN_SPEED[] PROGMEM = { "fanSpeed" };
const char EMERGENCY_MODE[] PROGMEM = { "emergencyMode" };
const char HEATING_ELEMENT_ENABLED[] PROGMEM = { "heatingElementEnabled" };
const char LEGIONELLA[] PROGMEM = { "antiLegionellaPerMonth" };
const char TIMER_WINDOW_A[] PROGMEM = { "timerWindowA" };
const char TIMER_WINDOW_B[] PROGMEM = { "timerWindowB" };

const char AIR_DUCT_CONFIG[] PROGMEM = { "configAirduct" };
const char INSTALLATION_CONFIG[] PROGMEM = { "configInstallation" };
const char TEST_MODE[] PROGMEM = { "testModeStatus" };

const char STATE_FAN[] PROGMEM = { "stateFan" };
const char STATE_HEATPUMP[] PROGMEM = { "stateHeatpump" };
const char STATE_HEAT_ELEMENT[] PROGMEM = { "stateElement" };
const char STATE_EXT_BOILER[] PROGMEM = { "stateExtBoiler" };
const char STATE_DEFROST[] PROGMEM = { "stateDefrost" };

const char AQUAMQTT_ADDR[] PROGMEM = { "ipAddress" };
const char AQUAMQTT_RSSI[] PROGMEM = { "rssiDb" };
const char AQUAMQTT_MODE[] PROGMEM = { "aquamqttMode" };
const char AQUAMQTT_LAST_WILL[] PROGMEM = { "lwlState" };

const char STATS_MSG_HANDLED[] PROGMEM = { "msgHandled" };
const char STATS_MSG_UNHANDLED[] PROGMEM = { "msgUnhandled" };
const char STATS_MSG_SENT[] PROGMEM = { "msgSent" };
const char STATS_MSG_CRC_NOK[] PROGMEM = { "msgCRCNOK" };
const char STATS_DROPPED_BYTES[] PROGMEM = { "droppedBytes" };

const char AQUAMQTT_LAST_WILL_ONLINE[] PROGMEM = { "online" };
const char AQUAMQTT_LAST_WILL_OFFLINE[] PROGMEM = { "offline" };


const char ENUM_LAST_WILL_ONLINE[] PROGMEM = { "ONLINE" };
const char ENUM_LAST_WILL_OFFLINE[] PROGMEM = { "OFFLINE" };

// Subtopics
const char MAIN_HOT_WATER_TEMP[] PROGMEM = { "waterTemp" };
const char MAIN_SUPPLY_AIR_TEMP[] PROGMEM = { "supplyAirTemp" };
const char MAIN_EVAPORATOR_AIR_TEMP_UPPER[] PROGMEM = { "evaporatorAirTemp" };
const char MAIN_EVAPORATOR_AIR_TEMP_LOWER[] PROGMEM = { "evaporatorAirTempLower" };
const char MAIN_FAN_SPEED[] PROGMEM = { "fanSpeed" };
const char MAIN_STATE_FAN[] PROGMEM = { "stateFan" };
const char MAIN_STATE_HEATPUMP[] PROGMEM = { "stateHeatpump" };
const char MAIN_STATE_HEAT_ELEMENT[] PROGMEM = { "stateElement" };
const char MAIN_STATE_EXT_BOILER[] PROGMEM = { "stateExtBoiler" };
const char MAIN_STATE_DEFROST[] PROGMEM = { "stateDefrost" };

const char HMI_HOT_WATER_TEMP_TARGET[] PROGMEM = { "waterTempTarget" };
const char HMI_OPERATION_MODE[] PROGMEM = { "operationMode" };
const char HMI_OPERATION_TYPE[] PROGMEM = { "operationType" };
const char HMI_TIME[] PROGMEM = { "time" };
const char HMI_DATE[] PROGMEM = { "date" };
const char HMI_EMERGENCY_MODE[] PROGMEM = { "emergencyMode" };
const char HMI_HEATING_ELEMENT_ENABLED[] PROGMEM = { "heatingElementEnabled" };
const char HMI_LEGIONELLA[] PROGMEM = { "antiLegionellaPerMonth" };
const char HMI_TIMER_WINDOW_A[] PROGMEM = { "timerWindowA" };
const char HMI_TIMER_WINDOW_B[] PROGMEM = { "timerWindowB" };
const char HMI_AIR_DUCT_CONFIG[] PROGMEM = { "configAirduct" };
const char HMI_INSTALLATION_CONFIG[] PROGMEM = { "configInstallation" };
const char HMI_TEST_MODE[] PROGMEM = { "testModeStatus" };

const char ENERGY_TOTAL_HEATING_ELEM_HOURS[] PROGMEM = { "totalHeatingElemHours" };
const char ENERGY_TOTAL_HEATPUMP_HOURS[] PROGMEM = { "totalHeatpumpHours" };
const char ENERGY_TOTAL_HOURS[] PROGMEM = { "totalHours" };
const char ENERGY_TOTAL_ENERGY_WH[] PROGMEM = { "totalEnergyWh" };
const char ENERGY_POWER_TOTAL[] PROGMEM = { "powerTotal" };
const char ENERGY_POWER_HEAT_ELEMENT[] PROGMEM = { "powerHeatingElem" };
const char ENERGY_POWER_HEATPUMP[] PROGMEM = { "powerHeatpump" };

const char STATS_AQUAMQTT_ADDR[] PROGMEM = { "ipAddress" };
const char STATS_AQUAMQTT_RSSI[] PROGMEM = { "rssiDb" };
const char STATS_AQUAMQTT_MODE[] PROGMEM = { "aquamqttMode" };
const char STATS_AQUAMQTT_LAST_WILL[] PROGMEM = { "lwlState" };
const char STATS_MSG_HANDLED[] PROGMEM = { "msgHandled" };
const char STATS_MSG_UNHANDLED[] PROGMEM = { "msgUnhandled" };
const char STATS_MSG_SENT[] PROGMEM = { "msgSent" };
const char STATS_MSG_CRC_NOK[] PROGMEM = { "msgCRCNOK" };
const char STATS_DROPPED_BYTES[] PROGMEM = { "droppedBytes" };

} // namespace mqtt
} // namespace aquamqtt
Expand Down
Loading

0 comments on commit 15d6eac

Please sign in to comment.