home / skills / laurigates / claude-plugins / ha-entities

This skill helps you manage Home Assistant entities and domains, including IDs, device classes, customizations, and naming conventions.

npx playbooks add skill laurigates/claude-plugins --skill ha-entities

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
6.3 KB
---
model: haiku
created: 2025-02-01
modified: 2026-02-14
reviewed: 2025-02-01
name: ha-entities
description: |
  Home Assistant entity and domain management. Use when working with entity IDs,
  device classes, customizations, template entities, groups, or understanding
  entity naming conventions and domain-specific attributes.
allowed-tools: Read, Edit, Write, Grep, Glob, TodoWrite
---

# Home Assistant Entities

## When to Use This Skill

| Use this skill when... | Use ha-automations instead when... |
|------------------------|-----------------------------------|
| Understanding entity domains | Creating automation rules |
| Customizing entities | Working with triggers/actions |
| Creating template sensors | Writing automation conditions |
| Setting up groups | Working with scripts/scenes |
| Working with device classes | Handling events |

## Entity ID Structure

```
domain.object_id
```

**Examples:**
- `light.living_room_ceiling`
- `sensor.outdoor_temperature`
- `binary_sensor.front_door_contact`
- `switch.garden_irrigation`

## Common Domains

| Domain | Description | Example |
|--------|-------------|---------|
| `light` | Lighting control | `light.kitchen` |
| `switch` | On/off switches | `switch.outlet` |
| `sensor` | Numeric sensors | `sensor.temperature` |
| `binary_sensor` | On/off sensors | `binary_sensor.motion` |
| `climate` | HVAC control | `climate.thermostat` |
| `cover` | Blinds, garage doors | `cover.garage` |
| `lock` | Door locks | `lock.front_door` |
| `media_player` | Media devices | `media_player.tv` |
| `camera` | Camera feeds | `camera.front_yard` |
| `vacuum` | Robot vacuums | `vacuum.roomba` |
| `fan` | Fan control | `fan.bedroom` |
| `alarm_control_panel` | Alarm systems | `alarm_control_panel.home` |
| `person` | People tracking | `person.john` |
| `device_tracker` | Device location | `device_tracker.phone` |
| `weather` | Weather info | `weather.home` |
| `input_boolean` | Virtual toggle | `input_boolean.guest_mode` |
| `input_number` | Virtual number | `input_number.target_temp` |
| `input_select` | Virtual dropdown | `input_select.house_mode` |
| `input_text` | Virtual text | `input_text.message` |
| `input_datetime` | Virtual date/time | `input_datetime.alarm` |
| `input_button` | Virtual button | `input_button.reset` |
| `automation` | Automations | `automation.motion_light` |
| `script` | Scripts | `script.morning_routine` |
| `scene` | Scenes | `scene.movie_night` |
| `group` | Entity groups | `group.all_lights` |
| `timer` | Countdown timers | `timer.laundry` |
| `counter` | Counters | `counter.guests` |
| `zone` | Geographic zones | `zone.home` |
| `sun` | Sun position | `sun.sun` |

For complete device class tables (binary sensor and sensor), see [REFERENCE.md](REFERENCE.md).

## Entity Customization

### customize.yaml

```yaml
# Single entity
light.living_room:
  friendly_name: "Living Room Light"
  icon: mdi:ceiling-light

# Binary sensor
binary_sensor.front_door:
  friendly_name: "Front Door"
  device_class: door

# Sensor
sensor.outdoor_temperature:
  friendly_name: "Outdoor Temperature"
  device_class: temperature
  unit_of_measurement: "°C"
```

### Glob Customization

```yaml
customize_glob:
  "light.*_ceiling":
    icon: mdi:ceiling-light

  "sensor.*_temperature":
    device_class: temperature
    unit_of_measurement: "°C"

  "binary_sensor.*_motion":
    device_class: motion
```

## Template Sensors

```yaml
template:
  - sensor:
      # Simple state
      - name: "Average Temperature"
        unit_of_measurement: "°C"
        device_class: temperature
        state: >-
          {{ ((states('sensor.living_room_temp') | float +
               states('sensor.bedroom_temp') | float +
               states('sensor.kitchen_temp') | float) / 3) | round(1) }}

      # With attributes
      - name: "Power Usage"
        unit_of_measurement: "W"
        device_class: power
        state: "{{ states('sensor.energy_meter_power') }}"
        attributes:
          cost_per_hour: >-
            {{ (states('sensor.energy_meter_power') | float * 0.15 / 1000) | round(2) }}

      # Availability
      - name: "Solar Power"
        unit_of_measurement: "W"
        device_class: power
        state: "{{ states('sensor.inverter_power') }}"
        availability: "{{ states('sensor.inverter_power') != 'unavailable' }}"
```

For template binary sensors, switches, buttons, numbers, groups, utility meters, counters, and timers, see [REFERENCE.md](REFERENCE.md).

## State Attributes

### Common Attributes

| Domain | Common Attributes |
|--------|-------------------|
| `light` | `brightness`, `color_temp`, `rgb_color`, `hs_color`, `effect` |
| `climate` | `temperature`, `current_temperature`, `hvac_action`, `preset_mode` |
| `media_player` | `volume_level`, `media_title`, `media_artist`, `source` |
| `cover` | `current_position`, `current_tilt_position` |
| `weather` | `temperature`, `humidity`, `pressure`, `wind_speed`, `forecast` |
| `person` | `source`, `latitude`, `longitude`, `gps_accuracy` |
| `sun` | `elevation`, `azimuth`, `next_rising`, `next_setting` |

### Accessing Attributes

```yaml
# In templates
{{ state_attr('light.living_room', 'brightness') }}
{{ state_attr('climate.thermostat', 'current_temperature') }}
{{ state_attr('sun.sun', 'elevation') }}

# In conditions
condition:
  - condition: numeric_state
    entity_id: light.living_room
    attribute: brightness
    above: 100
```

## Quick Reference

### State Functions

| Function | Description | Example |
|----------|-------------|---------|
| `states('entity')` | Get state | `states('sensor.temp')` |
| `state_attr('entity', 'attr')` | Get attribute | `state_attr('light.x', 'brightness')` |
| `is_state('entity', 'value')` | Check state | `is_state('light.x', 'on')` |
| `is_state_attr('entity', 'attr', 'val')` | Check attribute | `is_state_attr('climate.x', 'hvac_action', 'heating')` |
| `states.domain` | All entities in domain | `states.light` |
| `expand('group.x')` | Expand group members | `expand('group.all_lights')` |

## Agentic Optimizations

| Context | Command |
|---------|---------|
| Find entity usage | `grep -r "entity_id:" config/ --include="*.yaml"` |
| List customizations | `grep -rA2 "^[a-z_]*\\..*:" config/customize.yaml` |
| Find template sensors | `grep -rB2 "platform: template" config/ --include="*.yaml"` |
| Find groups | `grep -rA5 "^group:" config/ --include="*.yaml"` |
| List domains used | `grep -roh "[a-z_]*\\." config/ --include="*.yaml" \| sort -u` |

Overview

This skill helps manage Home Assistant entity IDs, domains, device classes, customizations, template entities, and groups. It explains naming conventions, common domain attributes, and practical commands to locate entities and templates in your configuration. Use it to standardize entity names, create template sensors, and tune domain-specific attributes. It focuses on actionable guidance for everyday Home Assistant maintenance and development.

How this skill works

The skill inspects entity ID structure (domain.object_id), common domains, and state attributes to guide naming and configuration decisions. It shows how to customize entities via customize.yaml or customize_glob, and how to create template sensors with attributes, availability, and unit handling. It also provides common template functions and shell commands to find entity usage, customizations, groups, and templates in your config. The result is faster troubleshooting and consistent entity management across your installation.

When to use it

  • You need to pick or standardize entity IDs and domains
  • Creating or refining template sensors, binary sensors, switches, or other template entities
  • Customizing friendly names, icons, device classes, or units with customize.yaml or glob rules
  • Mapping and understanding state attributes for automations and templates
  • Searching your configuration for entity usage, groups, or template definitions

Best practices

  • Follow domain.object_id format and use descriptive object_ids (e.g., sensor.outdoor_temperature)
  • Use device_class and unit_of_measurement for sensors and binary_sensors to enable UI features and integrations
  • Apply customize_glob to enforce consistent icons or device classes across similar entities
  • Name template sensors clearly and set unit_of_measurement and device_class when appropriate
  • Use state_attr and states('entity') in templates to read attributes safely and avoid runtime errors
  • Search config with targeted grep commands to find entity_id, template platforms, and group definitions quickly

Example use cases

  • Create a template sensor that averages multiple room temperatures and exposes device_class: temperature
  • Customize all ceiling lights' icons with customize_glob "light.*_ceiling"
  • Build a template sensor with additional attributes such as calculated cost_per_hour
  • Find every place an entity is referenced in YAML using grep -r "entity_id:" config/
  • List all domains used in your YAML to audit integrations and tidy unused entities

FAQ

What is the basic structure of an entity ID?

Entity IDs use the format domain.object_id, for example light.kitchen or sensor.outdoor_temperature.

How do I ensure a template sensor is treated as a temperature sensor in the UI?

Set unit_of_measurement to the temperature unit (°C or °F) and device_class to temperature in the template definition.