Questions on id/unique_id and area_id for automations and mqtt

Hello everyone,

I wanted to assign IDs to all my automations etc. but for some reason, two of them did not take and the UI is claiming that they have no unique_id.

Example that is not working (and I cannot figure out why):

- alias: Set Logger default level
  id: set_logger_default_level
  description: ''
  mode: queued
  trigger:
    - platform: homeassistant
      event: start
  condition: []
  action:
    - service: logger.set_default_level
      data:
        level: fatal

The second issue is regarding area_id. In the core registry, every sensor etc. has an area_id. Most are “none”.
I have found that my mqtt climate and sensor entities cannot be defined via yaml.
I get the error message

Invalid config for [sensor.mqtt]: [area_id] is an invalid option for [sensor.mqtt]. Check: sensor.mqtt->area_id. (See ?, line ?).
Invalid config for [climate.mqtt]: [area_id] is an invalid option for [climate.mqtt]. Check: climate.mqtt->area_id. (See ?, line ?).

I don’t quite see why this should only apply to some types and why this cannot be set if the core registry has fields for it.

climate:
  - platform: mqtt
    name: "eQ-3 Living Room"
    unique_id: eq_3_living_room
    area_id: living_room
    icon: hass:thermometer-bluetooth
    modes: ['off',heat,auto,unique_idle]
    min_temp: 4.5
    max_temp: 23.0
    temp_step: 0.5
    mode_command_topic: cmnd/eq3devices/EQ3/001A2208B/mode
    temperature_command_topic: cmnd/eq3devices/EQ3/001A2208B/settemp
    temperature_state_topic: stat/EQ3/001A2208B
    temperature_state_template: '{{ value_json.temp }}'
    mode_state_topic: stat/EQ3/001A2208B
    mode_state_template: '{{ value_json.hassmode }}'
    hold_command_topic: cmnd/eq3devices/EQ3/001A2208B
    hold_state_template: '{{ value_json.mode }}'
    hold_state_topic: stat/EQ3/001A2208B
    hold_modes: ["auto","manual"]
    precision: 0.5
#    json_attributes_topic: stat/EQ3/001A2208B

Thank you for your help
Alex

Post the error message reported for the automation.

They can but area_id is not a supported option when you define MQTT HVAC or MQTT Sensor with YAML. That’s why you received the error messages.

According to the documentation for MQTT Discovery if you use it to define a device, you can specify suggested_area.

Hello @123 ,

I had to change to logger level first.
Now it seems that logger.set_default_level ist suddenly not valid service anymore.
I created this automation via the UI and then moved it to a yaml file. Was this service deprecated for some reason?

Problem with the MQTT HVAC and sensor is, that I actually have no device for it. I am directly creating the climate and sensors.
The devices are TRVs which are BLE. And they are relayed via a Tasmota BLE to Wifi via MQTT service. So in HA I can only see the ESP32 board as a device and not the TRVs that are sending the data in the background.

Hello everyone,

I stumbled across this problem when I wanted to define area_id for my MQTT sensors and climate entities.
I seems that areas cannot be assigned to those directly, only via a device.

However, when I create an MQTT sensor (using yaml), how do I create an MQTT device? Because right now I have a bunch of sensors without a matching device.

The documentation is not clear to me on this. I need to define an MQTT device and then also link the sensor/climate to this device.

Could someone tell me how to do so?

A similar question was asked before, but no responses were posted.

Devices are discovered, not created in yaml.

You have to publish a discovery message as detailed here.

Hello @tom_l ,

I have no influence on the TRVs mqtt messages. So I cannot make the TRV send the device name in a matching syntax.
Is there no way of telling HA which device the entity belongs to? Essentially creating the device when I create the entity?