MQTT Custom Device integration as a device with multiple entites

Hi together,

I’m struggling with the creation of a MQTT Device in HA.

My device has the following topics:
To read:

  • esp32_fan_rack/stat/HA:
    {"Temp":24.74,"Pres":904.03,"Alt":1036.75,"Hum":45.53,"Targ":20.00,"RPM":0,"PWM":255,"RSSI":-43,"Chan":6,"SSID":afasdfasd,"IP":10.xxx.xxx.xxx,"MAC":xx.xx.xx.xx.xx,"OTA":0}
    To write:
  • esp32_fan_rack/cmnd/OTA
    Possible Value to send: “ON” or “OFF” (Think it would be a MQTT Switch)
  • eso32_fan_rack/cmnd/TARGETTEMP
    Possible value to send int:[0…100] (Think it would be a MQTT Number)

I would like to have a Device in HA with to following possibility:

  • Set Target Temperature
  • Set OTA ON or OFF (Slider) and update slider state depending on (esp32_fan_rack/stat/HA).OTA 0/1
  • Show the current value of the topic esp32_fan_rack/stat/HA (MQTT Sensors?)

I’m sorry to ask, but either i have to say that i can’t read, or I’m to dumb, or I don’t know… :thinking: :see_no_evil:

Regards,
Adrian

I think i’m on the right way.

1: i corrected some points in my payload.
My New Topic: esp32_fan_rack/stat/HA
New payload:

{
  "Temp":24.93,
  "Pres":905.46,
  "Alt":1036.24,
  "Hum":46.34,
  "Targ":20.00,
  "RPM":500,
  "PWM":255,
  "RSSI":-49,
  "Chan":6,
  "SSID":"asddasdas",
  "IP":"10.xx.xx.xx",
  "MAC":"xx:xx:xx:xx:xx:xx",
  "OTA":"OFF"
}

Then a plubished a config via MQTT Publisher.
Topic: homeassistant/sensor/esp32rackfan/config
Payload:

{
  "name": "ESP32 FAN PWM",
  "state_topic": "esp32_fan_rack/stat/HA",
  "value_template": "{{ value_json.PWM }}",
  "unit_of_measurement": "PWM",
  "unique_id": "ESP32_Rack_Fan_PWM",
  "device": {
      "identifiers": ["ESP32RACKFAN"],
      "name": "ESP32 Rack FAN",
      "model": "ESP32FAN",
      "manufacturer": "Adrian",
      "sw_version": "1.0"
  }
}

image

Sadly, the sensor doesn’t show any value. :disappointed_relieved:

I also tried to configure the OTA.
I would like to have a slider with actual state.
Topic: homeassistant/switch/esp32rackfan/config
Payload:

{
  "name": "ESP32 FAN OTA",
  "command_topic": "esp32_fan_rack/cmnd/OTA",
  "state_topic": "esp32_fan_rack/stat/HA",
  "state_value_template": "{{ value_json.OTA }}",
  "payload_on": "ON",
  "payload_off": "OFF",
  "unique_id": "ESP32_Rack_Fan_OTA",
  "device": {
      "identifiers": ["ESP32RACKFAN"],
      "name": "ESP32 Rack FAN",
      "model": "ESP32FAN",
      "manufacturer": "Adrian",
      "sw_version": "1.0"
  }

I get this:
image

But i would like this:
image

I also tried the MQTT numbers and MQTT HVAC but I’m not sure if I’m on the right way.

Would you define the device with MQTT Publish or with MQTT configuration in YAML like this:

sensor:
  - name: ESP32FAN Rack RPM
    state_topic: "esp32_fan_rack/tele/HA"
    unit_of_measurement: "RPM"
    value_template: "{{ value_json.RPM}}"
    device: {
      "identifiers": ["ESP32RACKFAN"],
      "name": "ESP32 Rack FAN",
      "model": "ESP32FAN",
      "manufacturer": "Adrian",
      "sw_version": "1.0"
      }

Will be happy for a little hint. :upside_down_face: