You found an outdated and no longer supported way.
The documentation is correct. As Francis says, your indention is not correct.
Please try to be more constructive. If you have suggestions for improvements to the documentation you can make them using the links at the bottom of every documentation page.
But that’s the indentation in the documentation, so that should be fixed then, but anyway,
It does not work, config check says
Configuration invalid!
Invalid config for [mqtt]: expected dictionary for dictionary value @ data['mqtt']. Got [{'sensor': None, 'state_topic': 'obk5541802A/power/get'}]. (See /config/configuration.yaml, line 36).
My full configuration.yaml would look like this:
# Loads default set of integrations. Do not remove.
default_config:
# Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
# Text to speech
tts:
- platform: google_translate
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
influxdb:
host: a0d7b954-influxdb
port: 8086
database: homeassistant
username: homeassistant
password: test
max_retries: 3
default_measurement: state
include:
entity_globs:
- sensor.pzem*
ignore_attributes:
- device_class
- device_class_str
- friendly_name
- friendly_name_str
- state_class
- state_class_str
mqtt:
- sensor:
state_topic: "obk5541802A/power/get"
But I won’t try to run with this config, if it fails to boot.
So I don’t know whats wrong here.