I see this but what exactly am I looking for?
Is this considered old and needs to be fixed?
sensor:
- platform: mqtt
name: "OpenEVSE Manual Override"
state_topic: !secret OPENEVSE_T_OVERRIDE
value_template: >-
{% if value == '1' %}
On
{% else %}
Off
{% endif %}
If yes then to what?
browetd
(Browet Didier)
September 7, 2022, 9:03pm
2
Click on âsee the documentation, for more informationâ in the screen you included in the post and you will see the new requested formatâŚ
1 Like
The only change I can see is that âplatform:mqttâ is deleted and the sensor now comes under âmqtt:â
Am I right?
limwakra
(Sven)
September 8, 2022, 9:58am
4
Example from my own converted mqtt sensors to the new format.
Put name on top first and add - before it:
mqtt:
sensor:
- name: "Ventilation Supply Temperature"
unique_id: "ventilation/supply_temperature"
state_topic: "ventilation/supply_temperature"
unit_of_measurement: "°C"
value_template: "{{ value }}"
- name: "Ventilation Output Temperature"
unique_id: "ventilation/output_temperature"
state_topic: "ventilation/output_temperature"
unit_of_measurement: "°C"
value_template: "{{ value }}"
3 Likes
Kaaf
September 8, 2022, 10:02am
5
I was puzzled too, but is quite clear in hindsight
change it to:
mqtt:
sensor:
name: "OpenEVSE Manual Override"
state_topic: !secret OPENEVSE_T_OVERRIDE
value_template: >-
{% if value == '1' %}
On
{% else %}
Off
{% endif %}
1 Like
roberto87
(Roberto)
September 8, 2022, 12:49pm
6
How can I find the entity to modify? I have hundreds of them, I have modified many of them but maybe I canât find some, the log does not tell me which one to correct, how can I solve?
Yes it will take some time but just do a search for mqtt through all your yaml files.
doberbert
(Doberbert)
September 9, 2022, 9:20am
8
I am trying to figure out how to get my (test) switch into the new format , but whatever format i try the configuration is not valid.
switch:
- platform: template
switches:
wohnzimmer:
friendly_name: "Wohnzimmer"
turn_on:
service: script.wohnzimmer_an
turn_off:
service: script.wohnzimmer_aus
- platform: mqtt
name: "test-lader-dummy"
command_topic: "home/switch/653/power"
state_topic: "home/switch/653/state"
payload_on: "On"
payload_off: "Off"
qos: 1
retain: true
mqtt:
broker: 192.168.1.5
port: 1883
discovery: true
Also it complains about my external mqtt server , it seems to be deprecated
q1t1
September 9, 2022, 2:11pm
9
The template switch stays like that but you need to chnage your mqtt one like that :
mqtt:
switch:
- name: "test-lader-dummy"
command_topic: "home/switch/653/power"
state_topic: "home/switch/653/state"
payload_on: "On"
payload_off: "Off"
qos: 1
retain: true
It actually says that it has imported the MQTT server configuration in to Home Assistant and it can now be removed from your configuration.yaml file.
In automations does this also need to be updated or not?
trigger:
platform: mqtt
topic: !secret OPENEVSE_T_ISL
giqcass
September 9, 2022, 4:04pm
12
I literally used the notepad replace function. It may not be âidealâ but everything is working great. That said I keep my configuration segmented into separate files. That made things easy.
EDIT: I further segmented during the process by creating an MQTT folder.
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
notify: !include notify.yaml
switch: !include switch.yaml
sensor: !include sensor.yaml
mqtt:
binary_sensor: !include mqtt/binary_sensors.yaml
sensor: !include mqtt/sensors.yaml
switch: !include mqtt/switches.yaml
6 Likes
123
(Taras)
September 9, 2022, 4:22pm
14
If what you posted is not located in configuration.yaml
(it appears to be in a separate file) then remove the first line containing mqtt:
from the file.
1 Like
I had a -platform: template in there which was causing the issue, thought it was commented out
1 Like
Hi,
Please help me because it is not clear for me:
i have a file !switches.yaml
- platform: mqtt
name: "Tasmota Plug1"
state_topic: "stat/tasmota1/RESULT"
value_template: "{{ value_json.POWER }}"
command_topic: "cmnd/tasmota1/POWER"
payload_on: "ON"
payload_off: "OFF"
qos: 1
retain: false
and
!sensors.yaml
- platform: "mqtt"
state_topic: "zigbee2mqtt/0x****"
availability_topic: "zigbee2mqtt/bridge/state"
value_template: "{{ value_json.temperature }}"
unit_of_measurement: "°C"
device_class: "temperature"
What should I change in those files?
Thank you!
OK, solve it:
in configuration.yaml I added
mqtt:
switch: !include mqtt/zswitches.yaml
sensor: !include mqtt/zsensors.yaml
I created files zswitches.yaml and zsensors.yaml in a new mqtt folder
I removed all the lines that were under senors.yaml and switches.yaml (the initial one, from root), all the entries related to platform mqtt and I added to new files (starting with z, in mqtt folder).
I changed each entry lihe this:
- platform: mqtt
name: "Tasmota Plug1"
state_topic: "stat/tasmota1/RESULT"
value_template: "{{ value_json.POWER }}"
command_topic: "cmnd/tasmota1/POWER"
payload_on: "ON"
payload_off: "OFF"
to
- name: "Tasmota Plug1"
state_topic: "stat/tasmota1/RESULT"
value_template: "{{ value_json.POWER }}"
command_topic: "cmnd/tasmota1/POWER"
payload_on: "ON"
payload_off: "OFF"
I hope that this will help someone!
5 Likes
ScottS
September 11, 2022, 2:36pm
17
I moved all my mqtt-related sensors and binary_sensors to the new mqtt.yaml.
However, I still have Date & Time related sensors in my sensor.yaml. Will this cause problems when devices looking for a sensor and get confused by where to find the sensor?
wars
(Warren)
September 14, 2022, 10:16pm
18
Could anyone be so kind as to help me modify these two to work with the new format? Itâs been a horrendous day and Iâd like to get this off my âtodoâ list!
platform: mqtt
name: âToilet Motionâ
state_topic: âtele/tasmota_8266F7/RESULTâ
value_template: >-
{% if value_json.RfReceived.Data == âD49B1Eâ %}
{{âONâ}}
{% else %}
{{states(âbinary_sensor.toilet_motionâ) | upper}}
{% endif %}
off_delay: 15
device_class: motion
platform: mqtt
state_topic: âtele/tasmota_8266F7/RESULTâ
value_template: â{{value_json.RfReceived.Data}}â
payload_on: â8CA0B1â
payload_off: â8CA0B1â
name: âR1_Button_Aâ
off_delay: 1
wars:
platform: mqtt
name: âToilet Motionâ
state_topic: âtele/tasmota_8266F7/RESULTâ
value_template: >-
{% if value_json.RfReceived.Data == âD49B1Eâ %}
{{âONâ}}
{% else %}
{{states(âbinary_sensor.toilet_motionâ) | upper}}
{% endif %}
off_delay: 15
device_class: motion
platform: mqtt
state_topic: âtele/tasmota_8266F7/RESULTâ
value_template: â{{value_json.RfReceived.Data}}â
payload_on: â8CA0B1â
payload_off: â8CA0B1â
name: âR1_Button_Aâ
off_delay: 1
mqtt:
binary_sensor:
- name: 'Toilet Motion'
state_topic: 'tele/tasmota_8266F7/RESULT'
value_template: >-
{% if value_json.RfReceived.Data == 'D49B1E' %}
{{'ON'}}
{% else %}
{{states('binary_sensor.toilet_motion') | upper}}
{% endif %}
off_delay: 15
device_class: motion
unique_id: mqtt-a979e8dadc7a49f295604f6342ad50b9
- name: "R1_Button_A"
state_topic: "tele/tasmota_8266F7/RESULT"
value_template: '{{value_json.RfReceived.Data}}'
payload_on: '8CA0B1'
payload_off: '8CA0B1'
off_delay: 1
unique_id: mqtt-176ae5ad468747aaa24665c3dc530083
Thatâs the best I can do because you didnât use the code button in your post.
Iâm not entirely sure about that second sensor - because the payload for on and off are the same, I think you might want to remove payload_off:
because thatâs what off_delay:
is doing.
1 Like
wars
(Warren)
September 15, 2022, 8:31am
20
Hey Andrew,
Thanks so much for helping me out. When I read through this thread I figured this was the way forward but wasnât sure if it would work for me due to mine looking slightly different to anyone elseâs.
So, to save a long post I didnât list all of the sensors as they are all similar. I have a remote control with 4 buttons on, two are onâs and two are offâs (for the kids to turn some lights on and off, I was finding that if they use the same button for both on&off it was getting confusing so one is only on, the other is only off).
This code is in /config/includes/binarysensor.yaml - will it be fine for me to use the heading mqtt: in this (if it could exist in other yaml files which will probably cause a conflict, right?)
The less headachey way of doing it - is to have all your MQTT stuff in itâs own files - then stick this in your configuration.yaml:
mqtt:
sensor: !include includes/mqttsensor.yaml
binary_sensor: !include includes/mqttbinarysensor.yaml
switch: !include includes/mqttswitch.yaml
Inside includes/mqttbinarysensor.yaml - your file will look like this:
- name: 'Toilet Motion'
state_topic: 'tele/tasmota_8266F7/RESULT'
value_template: >-
{% if value_json.RfReceived.Data == 'D49B1E' %}
{{'ON'}}
{% else %}
{{states('binary_sensor.toilet_motion') | upper}}
{% endif %}
off_delay: 15
device_class: motion
unique_id: mqtt-a979e8dadc7a49f295604f6342ad50b9
- name: "R1_Button_A"
state_topic: "tele/tasmota_8266F7/RESULT"
value_template: '{{value_json.RfReceived.Data}}'
payload_on: '8CA0B1'
payload_off: '8CA0B1'
off_delay: 1
unique_id: mqtt-176ae5ad468747aaa24665c3dc530083
basically exactly as I posted, but just with the mqtt:
and binary_sensor:
lines removed.