Hello everyone,
I am trying to get HA t discover and register my MQTT climate devices.
I am publishing the message according to the yaml I used to use in my configuration.yaml.
name: eQ-3 Climate Living Room
object_id: eq3_climate_living_room
unique_id: eq3_climate_living_room
icon: 'hass:thermometer-bluetooth'
min_temp: 4.5
max_temp: 23
temp_step: 0.5
temperature_command_topic: cmnd/EQ3/EQ3/001A2208B97D/settemp
temperature_state_topic: tele/EQ3/001A2208B97D
temperature_state_template: '{{ value_json.temp }}'
modes:
- auto
- 'off'
- heat
mode_command_topic: cmnd/EQ3/EQ3/001A2208B97D/mode
mode_state_topic: tele/EQ3/001A2208B97D
mode_state_template: '{{ value_json.hassmode }}'
precision: 0.5
device:
identifiers:
- eQ-3 Living Room
name: eQ-3 Living Room
model: eQ-3
manufacturer: eQ-3
suggested_area: Living Room
This works without issues.
But the same payload as JSON via MQTT does not lead to HA recognizing the device.
{"name":"eQ-3 Climate Living Room","object_id":"eq3_climate_living_room","unique_id":"eq3_climate_living_room","icon":"mdi:thermometer-bluetooth","min_temp":4.5,"max_temp":23,"temp_step":0.5,"temperature_command_topic":"cmnd/EQ3/EQ3/001A2208B97D/settemp","temperature_state_topic":"tele/EQ3/001A2208B97D","temperature_state_template":"{{ value_json.temp }}","modes":["auto","off","heat"],"mode_command_topic":"cmnd/EQ3/EQ3/001A2208B97D/mode","mode_state_topic":"tele/EQ3/001A2208B97D","mode_state_template":"{{ value_json.hassmode }}","precision":0.5,"device":{"identifiers":["eQ-3 Living Room"],"name":"eQ-3 Living Room","model":"eQ-3","manufacturer":"eQ-3","suggested_area":"Living Room"}}
or formatted
{
"name": "eQ-3 Climate Living Room",
"object_id": "eq3_climate_living_room",
"unique_id": "eq3_climate_living_room",
"icon": "mdi:thermometer-bluetooth",
"min_temp": 4.5,
"max_temp": 23,
"temp_step": 0.5,
"temperature_command_topic": "cmnd/EQ3/EQ3/001A2208B97D/settemp",
"temperature_state_topic": "tele/EQ3/001A2208B97D",
"temperature_state_template": "{{ value_json.temp }}",
"modes": ["auto", "off", "heat"],
"mode_command_topic": "cmnd/EQ3/EQ3/001A2208B97D/mode",
"mode_state_topic": "tele/EQ3/001A2208B97D",
"mode_state_template": "{{ value_json.hassmode }}",
"precision": 0.5,
"device": {
"identifiers": ["eQ-3 Living Room"],
"name": "eQ-3 Living Room",
"model": "eQ-3",
"manufacturer": "eQ-3",
"suggested_area": "Living Room"
}
}
According to the log, there is a problem with state_topic even though there is no pure state_topic
and the ones I need should be declared already
2023-09-21 00:49:57.783 ERROR (MainThread) [homeassistant.components.mqtt.mixins] Error 'required key not provided @ data['state_topic']' when processing MQTT discovery message topic: 'homeassistant/sensor/EQ3/001A2208C9FA_climate/config', message: '{'name': 'eQ-3 Climate Dining Room', 'object_id': 'eq3_climate_dining_room', 'unique_id': 'eq3_climate_dining_room', 'icon': 'hass:thermometer-bluetooth', 'min_temp': 4.5, 'max_temp': 23, 'temp_step': 0.5, 'temperature_command_topic': 'cmnd/EQ3/EQ3/001A2208C9FA/settemp', 'temperature_state_topic': 'tele/EQ3/001A2208C9FA', 'temperature_state_template': '{{ value_json.temp }}', 'modes': "['auto', 'off', 'heat']", 'mode_command_topic': 'cmnd/EQ3/EQ3/001A2208C9FA/mode', 'mode_state_topic': 'tele/EQ3/001A2208C9FA', 'mode_state_template': '{{ value_json.hassmode }}', 'precision': 0.5, 'device': {'identifiers': ['eQ-3 Dining Room'], 'name': 'eQ-3 Dining Room', 'model': 'eQ-3', 'manufacturer': 'eQ-3', 'suggested_area': 'Dining Room'}, 'platform': 'mqtt'}'
HEre is also an example payload:
{"cmd":"poll","result":"ok","MAC":"001A2208C9FA","tas":"tasmota-D2EE70-3696","RSSI":-77,"stattime":1695254586,"temp":14,"posn":0,"mode":"manual","hassmode":"off","boost":"inactive","dst":"set","window":"closed","state":"unlocked","battery":"GOOD","holidayend":"00-00-00 00:00","windowtemp":5,"windowdur":15,"day":21,"night":17,"offset":0,"Time":"2023-09-21T00:03:07.717Z"}
Is there some kind of difference in handling in HA between yaml and mqtt payload?
OR can anybody spot a problem in my config?
Thank you all for any ideas, suggestions or of course solutions
Alex
P.S.: Don’t be surprised to see Living Room and Dining Room mixed in these discussions. They are all created in the same loop and are identical apart from name.