> For the complete documentation index, see [llms.txt](https://docs.brewtools.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.brewtools.com/fcs/custom-mqtt-guide.md).

# Custom MQTT Guide

This is a guide on how to use your FCS with your own custom MQTT broker, in order to set it up with Home Assistant or other custom solutions.

## Introduction

The FCS custom MQTT integration works with Home Assistant (HA).

Enter your Home Assistant MQTT broker credentials in FCS. Home Assistant then detects and configures FCS automatically.

You can also use another MQTT broker with Node-RED or a custom application.

{% hint style="danger" %}
If you decide to use a custom MQTT broker, you will not be able to use [brewtools.cloud](https://brewtools.cloud/) simultaneously.&#x20;
{% endhint %}

### Before you start

1. Connect FCS to your network.
2. Configure an MQTT broker and create credentials for FCS.
3. Enter the broker credentials in FCS.

Use the same broker for Home Assistant and FCS. Home Assistant must have MQTT configured.

## Typical MQTT JSON payload from FCS Fermentation

FCS publishes device data to `fcs-fermentation/<mcu_id>/state`.

The following example uses a standard 24V, 2A setup. It has one temperature sensor and one pressure sensor. Connected density and level sensors add their related fields.

Subscribe to `fcs-fermentation/#` to find your mcu ID. Then subscribe to its state topic. For example:

```
fcs-fermentation/20414116222657176/state
```

{% hint style="warning" %}
All MQTT values use fixed units: temperature in degrees Celsius (°C), pressure in bar, density as specific gravity (SG), volume in liters (L), and AC/DC current in amperes (A)
{% endhint %}

```json
{
  "mcu_id": "2401652181201104",
  "temperature_1": 18.4,
  "temperature_2": 18.6,
  "temperature_selected_sensor_value": 18.4,
  "temperature_setpoint": 18.0,
  "current_total": 1.42,
  "current_display": 0.21,
  "current_relay_1": 0.0,
  "current_relay_2": 0.85,
  "current_can_1": 0.12,
  "current_can_2": 0.0,
  "state_relay_1": 0,
  "state_relay_2": 1,
  "state_can_1": 1,
  "state_can_2": 0,
  "temperature_density_sensor": 18.3,
  "density_value": 1.012,
  "manual_density_entry": 1.050,
  "pressure": 1.02,
  "pressure_setpoint": 1.0,
  "calculated_tank_volume": 245.5,
  "agitator_rpm": 60,
  "agitator_motor_on": true,
  "agitator_speed": "50",
  "agitator_interval": "10/30",
  "allow_gas_in": false,
  "current_relay_3": 0.0,
  "current_relay_4": 0.0,
  "current_can_3": 0.0,
  "current_can_4": 0.0,
  "state_relay_3": 0,
  "state_relay_4": 0,
  "state_can_3": 0,
  "state_can_4": 0,
  "external_relay_state": 0,
  "current_acc_1": 0.0,
  "current_acc_2": 0.0
}
```

### Payload fields

### Home Assistant data points

The FCS sends its readings to Home Assistant as one JSON message on `fcs-fermentation/<hwid>/state` every 2 seconds. `<hwid>` is the unit's hardware ID (the `mcu_id` field). Home Assistant creates the entities by itself through MQTT discovery. The tables below explain each field in the message.

* Values are always in °C, bar and SG, whatever units the display is set to.
* A reading that isn't available, for example from a disconnected sensor, is sent as `null`.
* Fields for hardware the unit doesn't have are left out of the message, and their entities are removed from Home Assistant.
* The unit reports `online` or `offline` on `fcs-fermentation/<hwid>/availability`.

#### General

| Field    | Description                                                                         | Unit | Home Assistant entity |
| -------- | ----------------------------------------------------------------------------------- | ---- | --------------------- |
| `mcu_id` | The unit's hardware ID. Home Assistant also shows it as the device's serial number. | –    | –                     |

#### Temperature

| Field                               | Description                                                                                      | Unit | Home Assistant entity |
| ----------------------------------- | ------------------------------------------------------------------------------------------------ | ---- | --------------------- |
| `temperature_1`                     | Temperature sensor 1.                                                                            | °C   | Temperature 1         |
| `temperature_2`                     | Temperature sensor 2 (FCS IOM; FCS ONE has one temperature input).                               | °C   | Temperature 2         |
| `temperature_selected_sensor_value` | The temperature from the sensor chosen for control: sensor 1, sensor 2 or the density sensor.    | °C   | Selected Temperature  |
| `temperature_setpoint`              | The target temperature in use. During a fermentation profile, this is the current step's target. | °C   | Temperature Setpoint  |

#### Pressure

Sent only when a pressure sensor is connected, except `allow_gas_in`.

| Field               | Description                                                                                                                                                                             | Unit         | Home Assistant entity |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | --------------------- |
| `pressure`          | Tank pressure from the pressure sensor.                                                                                                                                                 | bar          | Pressure              |
| `pressure_setpoint` | The target pressure in use. During a fermentation profile, this is the current step's target.                                                                                           | bar          | Pressure Setpoint     |
| `allow_gas_in`      | "Allow gas in" from the quick settings. `true`: the unit may let gas in to raise the pressure. `false`: it only lets pressure out. Sent only when a relay or CAN port is set to Gas in. | true / false | Allow Gas In          |

#### Density

Sent only when a density sensor is connected.

| Field                        | Description                                                                                                                                                                            | Unit | Home Assistant entity      |
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---- | -------------------------- |
| `density_value`              | Density from the density sensor. `null` until an original gravity (OG) has been set and the sensor has taken a reading.                                                                | SG   | Density                    |
| `temperature_density_sensor` | Temperature at the density sensor.                                                                                                                                                     | °C   | Density Sensor Temperature |
| `manual_density_entry`       | The last density entered by hand, for example a hydrometer reading. It can be entered on the display or from Home Assistant. `null` until one has been entered since the unit started. | SG   | Manual Density Entry       |

#### Level

Sent only when a level sensor is connected.

| Field                    | Description                                                     | Unit | Home Assistant entity |
| ------------------------ | --------------------------------------------------------------- | ---- | --------------------- |
| `calculated_tank_volume` | Volume of liquid in the tank, calculated from the level sensor. | L    | Tank Volume           |

#### Agitator

Sent only when an agitator is connected.

| Field               | Description                                                                                                                          | Unit         | Home Assistant entity |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ------------ | --------------------- |
| `agitator_rpm`      | Measured agitator speed.                                                                                                             | rpm          | Agitator RPM          |
| `agitator_motor_on` | `true` when the agitator is switched on. It then runs and pauses according to the interval.                                          | true / false | Agitator Motor        |
| `agitator_speed`    | Motor power: `"25"`, `"50"`, `"75"` or `"100"`.                                                                                      | % (text)     | Agitator Speed        |
| `agitator_interval` | Minutes running / minutes paused: `"5/55"`, `"10/30"`, `"30/30"` or `"Always on"`. `"unknown"` if the setting matches none of these. | text         | Agitator Interval     |

#### Outputs

| Field                            | Description                                                                | Unit  | Home Assistant entity  |
| -------------------------------- | -------------------------------------------------------------------------- | ----- | ---------------------- |
| `state_relay_1`, `state_relay_2` | Relay 1 and 2: on (`1`) or off (`0`).                                      | 0 / 1 | Relay 1, Relay 2       |
| `state_relay_3`, `state_relay_4` | Relay 3 and 4: on (`1`) or off (`0`). FCS IOM only.                        | 0 / 1 | Relay 3, Relay 4       |
| `state_can_1`, `state_can_2`     | Power on CAN port 1 and 2: on (`1`) or off (`0`).                          | 0 / 1 | CAN Port 1, CAN Port 2 |
| `state_can_3`, `state_can_4`     | Power on CAN port 3 and 4: on (`1`) or off (`0`). FCS IOM only.            | 0 / 1 | CAN Port 3, CAN Port 4 |
| `external_relay_state`           | The external relay, used for heating: on (`1`) or off (`0`). FCS IOM only. | 0 / 1 | Heat State             |

#### Current

| Field                                | Description                                                                                                        | Unit | Home Assistant entity            |
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ---- | -------------------------------- |
| `current_total`                      | Total DC current drawn by the unit.                                                                                | A    | Current Total                    |
| `current_display`                    | Current drawn by the display.                                                                                      | A    | Current Display                  |
| `current_relay_1`, `current_relay_2` | Current through relay 1 and 2 (FCS IOM and FCS ONE 24V). On FCS ONE 230V, see `current_acc_1` and `current_acc_2`. | A    | Current Relay 1, Current Relay 2 |
| `current_relay_3`, `current_relay_4` | Current through relay 3 and 4. FCS IOM only.                                                                       | A    | Current Relay 3, Current Relay 4 |
| `current_can_1`, `current_can_2`     | Current drawn on CAN port 1 and 2.                                                                                 | A    | Current CAN 1, Current CAN 2     |
| `current_can_3`, `current_can_4`     | Current drawn on CAN port 3 and 4. FCS IOM only.                                                                   | A    | Current CAN 3, Current CAN 4     |
| `current_acc_1`                      | AC current. FCS IOM: the external relay. FCS ONE 230V: relay 1. Reads 0 below about 0.5 A.                         | A    | Current ACC 1                    |
| `current_acc_2`                      | AC current. FCS ONE 230V: relay 2. Not used on FCS IOM. Reads 0 below about 0.5 A.                                 | A    | Current ACC 2                    |

#### Controlling the FCS from Home Assistant

Commands go to `fcs-fermentation/<hwid>/set/<command>`. The payload is plain text, not JSON. The unit ignores a value that is out of range or that needs hardware it doesn't have.

| Command                | Payload                                                     | Home Assistant entity        |
| ---------------------- | ----------------------------------------------------------- | ---------------------------- |
| `temperature_setpoint` | 0 to 80 (°C)                                                | Temperature Setpoint Control |
| `pressure_setpoint`    | 0 to 2 (bar). Needs a pressure sensor.                      | Pressure Setpoint Control    |
| `manual_density_entry` | 0.900 to 1.200 (SG). Needs a density sensor.                | Manual Density Entry         |
| `agitator_motor_on`    | `ON` or `OFF`. Needs an agitator.                           | Agitator Motor               |
| `agitator_speed`       | `25`, `50`, `75` or `100`. Needs an agitator.               | Agitator Speed               |
| `agitator_interval`    | `5/55`, `10/30`, `30/30` or `Always on`. Needs an agitator. | Agitator Interval            |
| `allow_gas_in`         | `ON` or `OFF`. Needs a relay or CAN port set to Gas in.     | Allow Gas In                 |

Connected hardware determines which fields appear in the payload. Handle missing fields and `null` values in custom integrations.

## Updating Control System Setpoints

Publish a numeric payload to update a control system setpoint:

* `fcs-fermentation/<mcu_id>/set/temperature_setpoint`
* `fcs-fermentation/<mcu_id>/set/pressure_setpoint`

FCS enforces the allowed ranges. Subscribe to `fcs-fermentation/<mcu_id>/state` to confirm the updated value.

### Example payloads

Temperature: `0–85 °C` (`32–185 °F`)

```
18
```

Pressure: `0–2 bar` (`0–29 psi`)

```
0.8
```

## Auto Detected FCS Fermentation Device on HA Server

The image below shows a correctly detected FCS Fermentation device in Home Assistant.

<figure><img src="https://3668380214-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MIsW5sFFK20mPqMKRG6-1703796690%2Fuploads%2F7Tlpzk4eIPIuNKbYeTW6%2Fimage.png?alt=media&amp;token=cec9ea27-6f60-4841-ba6e-bb5a86ad1c60" alt=""><figcaption></figcaption></figure>
