janbenes
(Jan Benes)
November 4, 2022, 8:52am
1
I am getting messages that something about mqtt in configuration.yaml will be deprecated. I am just user, not developer and I do not understand that message. I have following entries in configuration.yaml - will I need to change anything? And how? I have probably hundred of sensors:
#MQTT autodiscovery
mqtt:
discovery: true
#qos: 2 not allowed
sensor ACC_Z:
- platform: mqtt
state_topic: "AndrOBD/ACC_Z"
sensor 3:
platform: mqtt
unique_id: sensor.test_temperature_2
name: "ESP8266_Temperature"
state_topic: "sensor/temperature"
force_update: true
qos: 2
unit_of_measurement: "ÂșC"
zoogara
(Daryl)
November 4, 2022, 8:55am
2
Hereâs one of the many posts that were arround when this message started - in 2022.9 release:
Like almost everybody with the update to 2022.9 I am getting MQTT warnings.
I have read the documentation, but it confuses me further as to what must change.
If someone can explain how I would change this particular instance it might help me understand the new format.
This is what I currently have
binary_sensor:
- platform: mqtt
name: "Garage Door State"
state_topic: "stat/GarageDoor/status"
payload_on: "open"
payload_off: "closed"
# payload_on: "closed"
# payload_oâŠ
You need to move your mqtt devices to a mqtt section, with sensors, switches etc under there.
janbenes
(Jan Benes)
November 7, 2022, 4:50pm
3
Thanks. What is âmqtt sectionâ? Is it in configuration.yaml where it starts with mqtt:
? I only have discovery: true
there. But the warning says "mqtt deprecated in configuration.yamlâ - so where do I need to put all my manual configurations to?
Does it mean that following definition will not be valid and I have to manually rewrite hundreds of sensor definitions?
sensor 3:
platform: mqtt
unique_id: sensor.test_temperature_2
name: "ESP8266_Temperature"
state_topic: "sensor/temperature"
force_update: true
qos: 2
unit_of_measurement: "ÂșC"
zoogara
(Daryl)
November 7, 2022, 7:56pm
4
If by rewrite you mean do some copy/pasting, yes. Your sensor becomes:
mqtt:
sensor:
- name: "ESP8266_Temperature"
unique_id: sensor.test_temperature_2
state_topic: "sensor/temperature"
force_update: true
qos: 2
unit_of_measurement: "ÂșC"
janbenes
(Jan Benes)
November 9, 2022, 6:26pm
5
Does the order matter, or can it be like this?
mqtt:
sensor:
- unique_id: sensor.test_temperature_2
name: "ESP8266_Temperature"
state_topic: "sensor/temperature"
force_update: true
qos: 2
unit_of_measurement: "ÂșC"
myle
(StePhan McKillen (Other kiwi Here))
November 9, 2022, 6:40pm
6
no bro
but to make YAML cleaner
I did this
in the config file
mqtt:
sensor: !include_dir_merge_list mqtt/sensor/
climate: !include_dir_merge_list mqtt/climate/
binary_sensor: !include_dir_merge_list mqtt/binary_sensor/
switch: !include_dir_merge_list mqtt/switch/
light: !include_dir_merge_list mqtt/light/
what this means is that you can have a folder for each section
and inside that, you can have your Yaml Files
so my MQTT lounge lights are in the file lounge.yaml into the mqtt folder which has a light folder
janbenes
(Jan Benes)
November 11, 2022, 1:07pm
7
Thanks. I still do not get this:
with sensor: !include_dir_merge_list mqtt/sensor/
- the yaml file is in folder sensor, but how it is called?
In that sensor yaml file, can there be entries like this?
sensor 3:
platform: mqtt
unique_id: sensor.test_temperature_2
name: "ESP8266_Temperature"
state_topic: "sensor/temperature"
force_update: true
qos: 2
unit_of_measurement: "ÂșC"
I am really unhappy about new updates not beeing backward compatible. I think I will just not use new version. I had lot of problems when Python 3 came over Python 2.7, it costs me days of my lifeâŠ
1 Like
myle
(StePhan McKillen (Other kiwi Here))
November 12, 2022, 12:51am
8
as it the MQTT Domain you dont need the Platform bit
try this
- unique_id: sensor.test_temperature_2
name: "ESP8266_Temperature"
state_topic: "sensor/temperature"
force_update: true
qos: 2
unit_of_measurement: "ÂșC"
janbenes
(Jan Benes)
November 15, 2022, 8:14pm
9
Thanks. So let me summerize it (for others too). Instead all current definitions like this:
sensor 3:
platform: mqtt
unique_id: sensor.test_temperature_2
name: "ESP8266_Temperature"
state_topic: "sensor/temperature"
force_update: true
qos: 2
unit_of_measurement: "ÂșC"
I will create single entry in configuration.yaml
:
mqtt:
sensor: !include_dir_merge_list mqtt/sensor/
then in config
folder I will create subfolder mqtt
and in it the file sensor.yaml
and to this file I will copy all definitions like this:
- unique_id: sensor.test_temperature_2
name: "ESP8266_Temperature"
state_topic: "sensor/temperature"
force_update: true
qos: 2
unit_of_measurement: "ÂșC"
Is that correct? Two things not clear - name of file in mqtt subfolder and why in last example the dash is intended by one space?
1 Like