Home Assistant Repair Center and MQTT
If you are not familiar with the Home Assistant Repair center, you should be. It's a fantastic tool that helps you know when there are potential issues with your Home Assistant instance and suggests corrective actions. Take a look at my video if you want more details.
Recently, I've been staring at an MQTT notification in Repair Center that tells me my manually created entities will stop working in the 2022.12 release of Home Assistant. These notifications start as a number icon in the sidebar.
The MQTT specific entry is telling me that my MQTT sensor(s) need attention.
Clicking on the MQTT entry gives more detail.
Looking at the image above, there is a dire warning that my manually configured MQTT sensors will stop working in version 2022.12.0. As of this writing, that gives me a short timeframe to get things fixed. There is an option to ignore this alert and it will go away quietly. As I rely on quite a few MQTT-based sensors and devices, it is important that I take care of this or my smart home will be a little less smart, so ignoring is not an option.
Fortunately, the fix for this is simple. All it requires is changing a few lines of YAML. The error details box above shows that there is a documentation link and in that documentation, specific details on how to fix the issue are outlined.
Here is an example of legacy code from my setup. This shows the mqtt entry under the "sensor" platform key.
sensor:
- platform: mqtt
state_topic: "rtl_433/Fineoffset-WH25/216"
name: "WH25 Pressure"
unit_of_measurement: "inHg"
force_update: true
value_template: "{{ value_json.pressure_inHg }}"
To solve this issue, a simple change in the code is required. Start with the "mqtt" platform key, then "sensor", and then all of your mqtt state_topics after. You can add multiple mqtt sensors as well.
mqtt:
sensor:
- state_topic: "rtl_433/Fineoffset-WH25/216"
name: "WH25 Pressure"
unit_of_measurement: "inHg"
force_update: true
value_template: "{{ value_json.pressure_inHg }}"
- state_topic:
{...}
- state_topic:
{...}
```
As you can see, this is not hard to fix and Repair Center has forced me into fixing some of my legacy code. I have a lot of that having run Home Assistant for a number of years now. I appreciate having Repair Center look over my shoulder and assist me with issues that might have caused me bigger headaches down the line.
As always, take a look at my video on this very subject and take a moment to subscribe to the channel while you are there. It's very much appreciated!