MQTT breaking changes RC 2022.6

I’m also having issues with the new changes. I’m getting the error “missing property platform” in sensor.yaml when I use a separate mqtt sensor file. How did you solve this?

Configuration.yaml

mqtt:
  broker: #hidden
  port: 1883
  username: #hidden
  password: #hidden
  sensor: !include sensor.yaml

sensor.yaml

mqtt:
  sensor:
  - name: "mqtt_temp"
    state_topic: "l/t_1/sensor/t_1/state"
    unit_of_measurement: '°C'
    payload_available: "online"
    payload_not_available: "offline"
    availability_topic : 'l/tyl_1'
    state_class: measurement

It looks like it should work for light as long as you are using packages. If you aren’t using packages and you have a single configuration, then both light and switch need to be in 1 mqtt section.

It does not go in sensor.yaml or the sensor section. It goes in a new MQTT section. There are multiple ways to specify this, and it’s covered earlier in the thread.

Thanks. I’ve looked at those and structured my code accordingly. For some reason, the error actually went away. However, the sensor doesn’t show up as an entity when I search for it.

Based on your previous response, it seems like you still have the sensor in the wrong section. Post your configuration.

Hi. I found the problem. I was including “mqtt” and “sensor” below, which is redundant because it’s already specified in configuration.yaml:

mqtt:
  sensor:
  - name

The solution was to just write:

  - name: "mqtt_temp"

I have the following sensor and I’m getting errors and trying to figure out how to use the Icon_template, as it’s not allowed in the mqtt.yaml.

- platform: mqtt
  state_topic: "bbq/iGrill/probe1"
  name: "Probe 1"
  qos: 0
  unit_of_measurement: "°"
  icon: mdi:thermometer
- platform: template
  sensors:
    probe1:
      friendly_name: "iGrill Probe 1"
      unit_of_measurement: '°'
      icon_template: >-
        {% if states.sensor.probe_1.state == 'unknown' %}
          mdi:cancel
        {% else %}
          mdi:thermometer
        {% endif %}
      #value_template: "{{ states('sensor.probe_1')|round }}"
      value_template: "{% if is_state('sensor.probe_1', 'unknown') -%}
     {{ 'off' }}
   {%- else -%}
     {{ states('sensor.probe_1')|round }}
   {%- endif %}"

Any suggestions?

What’s your configuration.yaml? We cant help you because we don’t know how or if this random mqtt.yaml file is included in your actual config.

No, he’ll have to switch to the new template style for that.

Keep platform: template and below in sensor.yaml. Only move the single mqtt sensor.

Example for those who have a separate yaml file …

configuration.yaml entry
mqtt:
discovery: true
broker: 192.168.1.6
binary_sensor: !include mqtt_binary_sensor.yaml
climate: !include mqtt_climate.yaml
switch: !include mqtt_switch.yaml
sensor: !include mqtt_sensor.yaml

Example in mqtt_binary_sensor.yaml …

  - name: "Carport Motion"
    device_class: motion
    state_topic: "mqtt/cp/master"
    payload_on: "Mo_1"
    payload_off: "Mo_0"
    off_delay: 10
    qos: 0

Hi all
I have the following in my configuration.yaml

alarm_control_panel:
  - platform: mqtt
    #name: Paradox Mak
    #unique_id: Paradox Mak
    state_topic: "paradoxdCTL/hassio/Arm0"
    command_topic: "paradoxdCTL/in"
    payload_disarm: '{"password":"3x","Command":"disarm","Subcommand":"0"}'
    payload_arm_night: '{"password":"3x","Command":"sleep","Subcommand":"0"}'
    payload_arm_home: '{"password":"3x","Command":"stay","Subcommand":"0"}'
    payload_arm_away: '{"password":"3x","Command":"arm","Subcommand":"0"}'

and I changed another sensor to this, which is working

mqtt:
  sensor:
    - name: "Wind Speed"
      state_topic: "anemometer/wind"
      unit_of_measurement: 'km/h

How should I change the alarm_control_panel? Or it is ok to leave it as it is?

edit: got it. I have to use it below mqtt:

I spent a few hours this morning updating my configuration files based on the MQTT changes. While I did get everything working, I did have to restructure my yaml file such that its now not as well organized. Perhaps you can recommend a solution.

I originally had:

# Unit 1

sensor Unit1:

- platform: mqtt
  name: unit1_abc

binary_sensor Unit1:
- platform: mqtt
  name: unit1_ijk

# Unit 2

sensor Unit2:

- platform: mqtt
  name: unit2_abc

binary_sensor Unit2:
- platform: mqtt
  name: unit2_ijk

I was unable to include sensor and binary_sensor twice within the mqtt integration. I tried this both with and without the Unit1/Unit2 identifiers. I also tried including the mqtt integration twice with and without Unit1/Unit2 specified on the same line as was originally done with the sensor / binary_sensor.

I ended up having to reorganize my yaml file such that all the sensor are grouped together and the same for the binary_sensor. I would prefer keeping all of each Unit’s sensors grouped together. Short of creating a separate package file for each Unit, is there a way this can be done?

At least until 2022.9

1 Like

I really love Home Assistant!
But what is happening here about “Move MQTT config schemas and client to separate modules” makes me also heating HA as well.

Hundreds or probably thousands of users are forced to change their WORKING configuration manually.

No info why, no info what will be the benefit, nothing. It’s sad.

I know moth of the contributors are from Europe, but why nobody remember old, good, American proverb: “Don’t fix it if it ain’t broken”?

3 Likes

That’s generally the case for most Breaking Changes so it’s the status quo.

I linked to the reason in an earlier post. It’s part of an architectural decision made 2 years ago and its benefits are explained.

Home Assistant’s success can be attributed to its comprehensive support of IoT devices made by numerous contributors under the guidance of its founder and a small (but growing) team of salaried developers. The founder’s vision includes making the product more capable, flexible, robust, etc. Not all of these enhancements can simply be tacked on to the existing architecture so sometimes that means replacing old ways with news ways (“Breaking Changes”).

I too have been inconvenienced with breaking changes, mostly from not reading “breaking changes”. But overall, Home Assistant just keeps getting better and easier to use.

2 Likes

Eh. Matter of fact is, from a purely technical point of view, it is always possible to avoid user facing breaking changes on an evolving code base, as long as you control the code (ie. cloud dependencies are more complicated). It’s just more work for the developer. And more often than not, HA development is still guided by the devs and for the devs philosophy, the user usually comes second. That’s the nature of many open source projects and to an extent, that’s fine. But as HA progressively turns more and more commercial operation with paid staff, it becomes less acceptable to shift the burden of the work on the paying user base.

In the end the main issue here is that HA still hasn’t managed to stabilize the fundamental structure of the code. At some point within software life cycle management, a project reaches a point of maturity where the fundamental building blocks don’t change that much anymore. The communication APIs between these blocks stabilize and the foundations settle into a system that while staying extensible, stops moving. Breaking changes are mostly necessary while the foundations are still moving, but become much more uncommon once you reach that point of maturity. And being less common, they’re easier to manage.

HA has not yet reached this point. In fact, even though there were improvements on that front, it’s very far from it. The foundations move all the time, and as soon as things seem to head towards stabilization, some general strategic development decisions scramble things up again. This is not a technical necessity to stay cutting edge. It’s simply the way the project is managed. Sometimes it feels like the core devs don’t even want the code to mature because they like to keep this very flexible open sourcey type of approach where you can do far reaching changes on a whim. But at some point, especially when going commercial, you’ll have to stabilize your project or you will end up frustrating your users to a point they’ll just quit and look for something else.

4 Likes

Hi,

followed the different options in the thread, would like to apply this, but I’ve the following error (extract of the configuration.yaml):

Can someone hints me how to proceed?

Thank you in advance!

Hello All,

please can someone advise how will this translate to new format?

  • platform: mqtt
    name: “Garage Motion”
    device_class: motion
    state_topic: “blueiris/garagehd”
    payload_on: “on”
    off_delay: 30