How to add entities to devices


I’m fairly new to home assistant and I need some clarification on how adding or grouping entities to devices works or if it’s even possible.

I’ve got the following scenario.

I reprogrammed some of my sonoff wifi switches with my own firmware to work with the mqtt broker. The device works great with ha and its even no problem to expose it to my google home and control it via voice commands. Everything works great except one thing. I am unable to “create” a device for the mqtt switch entity respectively there is no device created. Due to this I am not able to define a room for the said switch which results in no automatic assignment to the right room in google home.

I’ve got the same problem with command line sensors (CPU -, GPU- temperature, …). Is it possible to “group” these sensors into one device like it is described here.

Thanks in advance

My yaml configs for the said entities (configured as packages)


- platform: command_line
  name: CPU Temperature
  command: "cat /sys/class/thermal/thermal_zone0/temp"
  unit_of_measurement: "°C"
  value_template: "{{ value | multiply(0.001) | round(1) }}"

- platform: command_line
  name: GPU Tempmperature
  command: "/opt/vc/bin/vcgencmd measure_temp"
  unit_of_measurement: "°C"
  value_template: '{{ value | regex_findall_index("=([0-9]*\.[0-9]*)", 0) }}'

- platform: command_line
  name: CPU Clock
  command: "/opt/vc/bin/vcgencmd measure_clock arm"
  unit_of_measurement: "MHz"
  value_template: '{{ value | regex_findall_index("=([0-9]*)", 0) | multiply(0.000001) | round(0) }}'


- platform: mqtt
 name: "Lavalampe"
 unique_id: switch.wohnzimmer_lavalampe
 state_topic: "home/sonoff/switch/1/stat"
 command_topic: "home/sonoff/switch/1"
 qos: 0
 payload_on: "on"
 payload_off: "off"
 retain: true
 icon: hass:lightbulb

Did you find the solution to add entety under device manually?

I started playing around with mqtt autodiscovery. However I ended up using ESPHome.