Home Assistant logo

Naming schema

The default names generated by Home Assistant are unsustainable in the long term and hard to work with. This is how I tediously work around them

Naming of light entities

Indicator-type lights are assigned to a special "Indicators" area in Home Assistant.
  • light.${area}_${kind}_${placement} where $placement is optional and used when needed. examples:
    • light.bedroom_ceiling
    • light.hallway_lamps_table

Naming of binary_sensor entities

Naming convention:

  • binary_sensor.${kind}_${area}_${placement}

If there are more than one type of sensor in a location, they are named in one of the following ways:

  • binary_sensor.${kind}_${area}_${placement}
  • binary_sensor.${kind}_${area}_${number}

And then they get all grouped or templated together into a single binary_sensor.${kind}_${area}. Then it is often the group/template that it makes sense to show on dashboard and build automations with.

A (non-exhaustive) list of diferent $kinds of binary_sensors:

  • radar: mmWave presence detection
  • motion: PIR sensors, motion detectors and "moving target" on mmWave sesors
  • door: a magnetic/hall/reed/window sensor affixed to a door.
  • window: same, but affixed to a window
  • tamper: tamper detection, commonly found on various Z-Wave sensors

Examples:

  • binary_sensor.door_${area}
  • binary_sensor.window_${area}
  • binary_sensor.motion_${area}
  • binary_sensor.presence_${area}

Adding new devices

Z-Wave

Default nameNaming standard
switch.outlet_${area}switch.outlet_${area} for kinds outlet
sensor.${kind}_${area}_electric_consumption_wsensor.electric_w_${kind}_${area}
sensor.${kind}_${area}_electric_consumption_kwhsensor.electric_kwh_${kind}_${area}
sensor.${kind}_${area}_electric_consumption_asensor.electric_a_${kind}_${area}
sensor.${kind}_${area}_electric_consumption_vsensor.electric_v_${kind}_${area}
update.${kind}_${area}_firmwareupdate.firmware_${kind}_${locatiom}
button.${kind}_${area}_pingbutton.ping_${kind}_${area}
sensor.${kind}_${area}_node_statussensor.node_status_${kind}_${area}
sensor.${kind}_${area}_successful_commands_rxsensor.ok_rx_${kind}_${area}
sensor.${kind}_${area}_successful_commands_txsensor.ok_tx_${kind}_${area}

Additionally I create derivative sensors:

  • sensor.ok_rx_per_min_${kind}_${area} of sensor.ok_rx_${kind}_${area}
  • sensor.ok_tx_per_min_${kind}_${area} of sensor.ok_tx_${kind}_${area}

They are good for spotting devices that are wrongly configured to send too many reports.

Zigbee

First we need to get the device to join the Zigbee network. These devices are not very standardized in how they join a network, and are very picky about distance from the controller. Sometimes there are instructions in Zigbee2mqtt's Device page but not always. Aside from the devices manual, it's a good place to start looking.

Once the device has joined, rename it from the default 0x.. name. The device's friendly_name and id are stored in the configuration.yaml file (using config as storage..). Since i manage this with ansible, i add something like this to the inventory variable hass_zigbee_devices, and ansible will template it into configuration.yaml (same yaml-structure):

'0x70ac08fffeb4cd10':
    friendly_name: light_livingroom_plants

Protip: the web ui has a "Update Home Assistant entity ID" toggle, which defaults to false

Now the device is in Home Assistant, with a mostly-correct name, but the entity_ids are wrong and need to be redefined in Home Assistant.

default namenaming standard
select.${device_name}_power_on_behaviorselect.power_on_behavior_${device_name}
sensor.${device_name}_linkqualitysensor.linkquality_${device_name}

Zigbee devices dont expose a lot of entities.