Skip to content

MQTT Setup

Tobias Sandhaas edited this page Dec 22, 2021 · 14 revisions

1. Choose mqtt mode in userConfig.h

#define MQTT_ENABLE 1|2

  • "0" = off (no MQTT at all)
  • "1" will use an existing mqtt-broker running on another machine. This is the recommended way, because it scales better and you are able to integrate the data better with existing smart-home and monitoring solutions.
  • "2" will install a simple mqtt broker on the arduino. This service can be used to configure the settings remotely but is not tested in other use-cases. This mode is not supported on ESP32 hardware.

2. If MQTT_ENABLE==2 then you have to install the uMQTTBroker library.

If the lib uMQTTBroker is not available in the "arduino library manager", then you can install the lib manually by copying the folder "uMQTTBroker" (located at arduino-libs/) to your default library folder, which is on my installation "C:\Users\tobias\Documents\Arduino\libraries\uMQTTBroker".

3. Adapt all other mqtt relevant settings in userConfig.h

  • The topics prefix will be "<MQTT_TOPIC_PREFIX>/..."

4. Compile and Upload new version

5. Test mqtt broker with any client.

  • windows: "MQTT Explorer" is easy to use.

6. Use any mqtt client to access mqtt broker and remotely configure settings

  • Topic prefix is <MQTT_TOPIC_PREFIX><HOSTNAME>/
  • Following topics exists (/set should be used to set new settings):
activePreinfusion           
activePreinfusion/set       # should not be retained
activePreinfusionPause      
activePreinfusionPause/set  # should not be retained
activeSetPoint              
activeSetPoint/set          # should not be retained
activeBrewtime              
activeBrewtime/set          # should not be retained

brewReady
brewDetected  
brewDetectionPower
brewDetectionPower/set
brewDetectionSensitivity
brewDetectionSensitivity/set

pidON
pidON/set

setPointSteam
setPointSteam/set

steadyPower
steadyPower/set
steadyPowerOffset
steadyPowerOffset/set
steadyPowerOffsetTime
steadyPowerOffsetTime/set

temperature            
temperatureAboveTarget
heaterUtilization
pastTemperatureChange

events
  • IMPORTANT: Some topics have to be configured to be "retained" so that the setting will be automatically be applied after restarts.
  • Additional writable topics exists to remotely trigger controlActions: (supported raw data: -1 or 0 or 1)
actions/STREAMING     # should not be retained
actions/CLEANING      # should not be retained
actions/SLEEPING      # should not be retained
actions/MENU          # should not be retained
actions/HOTWATER      # should not be retained
<and many more to come>
  • IMPORTANT: Theses topics should ideally not to be configured to be "retained" because they should not be saved across restarts.

6.1. Sample apps for mobiles

  • android: you can use following ready-to-use configuration for the application IoTMQTTPanel
    • Install app, import IoTMQTTPanel.json, change "dashboardPrefixTopic" (which is "<MQTT_TOPIC_PREFIX>/" , dont forget the trailing "/") in "Dashboard configurations". Update Username/password. Connect.
  • Showcase
  • Screenshots:
  • ios: (any one can send me a working config for an "free" ios app?)