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.
Entity Customization
customize.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
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
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.
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
# 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 |
1---2name: ha-entities3description: Home Assistant entity and domain management. Use when working with entity IDs, device classes, template entities, groups, or domain-specific attribute customizations.4---5
6# Home Assistant Entities
7
8## When to Use This Skill
9
10| Use this skill when... | Use ha-automations instead when... |
11|------------------------|-----------------------------------|
12| Understanding entity domains | Creating automation rules |
13| Customizing entities | Working with triggers/actions |
14| Creating template sensors | Writing automation conditions |
15| Setting up groups | Working with scripts/scenes |
16| Working with device classes | Handling events |
17
18## Entity ID Structure
19
20```
21domain.object_id
22```
23
24**Examples:**
25- `light.living_room_ceiling`
26- `sensor.outdoor_temperature`
27- `binary_sensor.front_door_contact`
28- `switch.garden_irrigation`
29
30## Common Domains
31
32| Domain | Description | Example |
33|--------|-------------|---------|
34| `light` | Lighting control | `light.kitchen` |
35| `switch` | On/off switches | `switch.outlet` |
36| `sensor` | Numeric sensors | `sensor.temperature` |
37| `binary_sensor` | On/off sensors | `binary_sensor.motion` |
38| `climate` | HVAC control | `climate.thermostat` |
39| `cover` | Blinds, garage doors | `cover.garage` |
40| `lock` | Door locks | `lock.front_door` |
41| `media_player` | Media devices | `media_player.tv` |
42| `camera` | Camera feeds | `camera.front_yard` |
43| `vacuum` | Robot vacuums | `vacuum.roomba` |
44| `fan` | Fan control | `fan.bedroom` |
45| `alarm_control_panel` | Alarm systems | `alarm_control_panel.home` |
46| `person` | People tracking | `person.john` |
47| `device_tracker` | Device location | `device_tracker.phone` |
48| `weather` | Weather info | `weather.home` |
49| `input_boolean` | Virtual toggle | `input_boolean.guest_mode` |
50| `input_number` | Virtual number | `input_number.target_temp` |
51| `input_select` | Virtual dropdown | `input_select.house_mode` |
52| `input_text` | Virtual text | `input_text.message` |
53| `input_datetime` | Virtual date/time | `input_datetime.alarm` |
54| `input_button` | Virtual button | `input_button.reset` |
55| `automation` | Automations | `automation.motion_light` |
56| `script` | Scripts | `script.morning_routine` |
57| `scene` | Scenes | `scene.movie_night` |
58| `group` | Entity groups | `group.all_lights` |
59| `timer` | Countdown timers | `timer.laundry` |
60| `counter` | Counters | `counter.guests` |
61| `zone` | Geographic zones | `zone.home` |
62| `sun` | Sun position | `sun.sun` |
63
64For complete device class tables (binary sensor and sensor), see [REFERENCE.md](REFERENCE.md).
65
66## Entity Customization
67
68### customize.yaml
69
70```yaml
71# Single entity
72light.living_room:
73 friendly_name: "Living Room Light"
74 icon: mdi:ceiling-light
75
76# Binary sensor
77binary_sensor.front_door:
78 friendly_name: "Front Door"
79 device_class: door
80
81# Sensor
82sensor.outdoor_temperature:
83 friendly_name: "Outdoor Temperature"
84 device_class: temperature
85 unit_of_measurement: "°C"
86```
87
88### Glob Customization
89
90```yaml
91customize_glob:
92 "light.*_ceiling":
93 icon: mdi:ceiling-light
94
95 "sensor.*_temperature":
96 device_class: temperature
97 unit_of_measurement: "°C"
98
99 "binary_sensor.*_motion":
100 device_class: motion
101```
102
103## Template Sensors
104
105```yaml
106template:
107 - sensor:
108 # Simple state
109 - name: "Average Temperature"
110 unit_of_measurement: "°C"
111 device_class: temperature
112 state: >-
113 {{ ((states('sensor.living_room_temp') | float +
114 states('sensor.bedroom_temp') | float +
115 states('sensor.kitchen_temp') | float) / 3) | round(1) }}
116
117 # With attributes
118 - name: "Power Usage"
119 unit_of_measurement: "W"
120 device_class: power
121 state: "{{ states('sensor.energy_meter_power') }}"
122 attributes:
123 cost_per_hour: >-
124 {{ (states('sensor.energy_meter_power') | float * 0.15 / 1000) | round(2) }}
125
126 # Availability
127 - name: "Solar Power"
128 unit_of_measurement: "W"
129 device_class: power
130 state: "{{ states('sensor.inverter_power') }}"
131 availability: "{{ states('sensor.inverter_power') != 'unavailable' }}"
132```
133
134For template binary sensors, switches, buttons, numbers, groups, utility meters, counters, and timers, see [REFERENCE.md](REFERENCE.md).
135
136## State Attributes
137
138### Common Attributes
139
140| Domain | Common Attributes |
141|--------|-------------------|
142| `light` | `brightness`, `color_temp`, `rgb_color`, `hs_color`, `effect` |
143| `climate` | `temperature`, `current_temperature`, `hvac_action`, `preset_mode` |
144| `media_player` | `volume_level`, `media_title`, `media_artist`, `source` |
145| `cover` | `current_position`, `current_tilt_position` |
146| `weather` | `temperature`, `humidity`, `pressure`, `wind_speed`, `forecast` |
147| `person` | `source`, `latitude`, `longitude`, `gps_accuracy` |
148| `sun` | `elevation`, `azimuth`, `next_rising`, `next_setting` |
149
150### Accessing Attributes
151
152```yaml
153# In templates
154{{ state_attr('light.living_room', 'brightness') }}
155{{ state_attr('climate.thermostat', 'current_temperature') }}
156{{ state_attr('sun.sun', 'elevation') }}
157
158# In conditions
159condition:
160 - condition: numeric_state
161 entity_id: light.living_room
162 attribute: brightness
163 above: 100
164```
165
166## Quick Reference
167
168### State Functions
169
170| Function | Description | Example |
171|----------|-------------|---------|
172| `states('entity')` | Get state | `states('sensor.temp')` |
173| `state_attr('entity', 'attr')` | Get attribute | `state_attr('light.x', 'brightness')` |
174| `is_state('entity', 'value')` | Check state | `is_state('light.x', 'on')` |
175| `is_state_attr('entity', 'attr', 'val')` | Check attribute | `is_state_attr('climate.x', 'hvac_action', 'heating')` |
176| `states.domain` | All entities in domain | `states.light` |
177| `expand('group.x')` | Expand group members | `expand('group.all_lights')` |
178
179## Agentic Optimizations
180
181| Context | Command |
182|---------|---------|
183| Find entity usage | `grep -r "entity_id:" config/ --include="*.yaml"` |
184| List customizations | `grep -rA2 "^[a-z_]*\\..*:" config/customize.yaml` |
185| Find template sensors | `grep -rB2 "platform: template" config/ --include="*.yaml"` |
186| Find groups | `grep -rA5 "^group:" config/ --include="*.yaml"` |
187| List domains used | `grep -roh "[a-z_]*\\." config/ --include="*.yaml" \| sort -u` |