plugins/home-assistant-dev/skills/ha-service-actions/SKILL.md
Generate and explain Home Assistant service actions for controlling entities (lights, switches, climate, media, covers) in Python and YAML. Use when asking about calling services, controlling devices, hass.services.async_call, entity actions, turn_on, turn_off, or invoking HA actions.
npx skillsauth add l3digital-net/claude-code-plugins ha-service-actionsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Service calls (now called "actions" in the UI) are the primary mechanism for controlling devices. Register them in async_setup, not async_setup_entry.
await hass.services.async_call(
domain="light",
service="turn_on",
service_data={"brightness_pct": 80, "color_temp_kelvin": 3000},
target={"entity_id": "light.living_room"},
blocking=True, # Wait for completion
)
# Multiple entities
target={"entity_id": ["light.kitchen", "light.hallway"]}
# By area
target={"area_id": "living_room"}
# By device
target={"device_id": "abc123def456"}
Register in async_setup (not async_setup_entry):
import voluptuous as vol
from homeassistant.helpers import config_validation as cv
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
async def handle_set_mode(call: ServiceCall) -> None:
entity_ids = call.data.get("entity_id")
mode = call.data["mode"]
# Process the action...
hass.services.async_register(
DOMAIN,
"set_mode",
handle_set_mode,
schema=vol.Schema({
vol.Required("entity_id"): cv.entity_ids,
vol.Required("mode"): vol.In(["auto", "manual", "eco"]),
}),
)
return True
Define action metadata for the UI:
set_mode:
name: 'Set Mode'
description: 'Set the operating mode.'
target:
entity:
integration: my_integration
fields:
mode:
name: 'Mode'
description: 'The operating mode to set.'
required: true
example: 'auto'
selector:
select:
options:
- 'auto'
- 'manual'
- 'eco'
For actions that operate on specific entities:
from homeassistant.helpers import entity_platform
async def async_setup_entry(hass, entry, async_add_entities):
platform = entity_platform.async_get_current_platform()
platform.async_register_entity_service(
"set_mode",
{vol.Required("mode"): vol.In(["auto", "manual", "eco"])},
"async_set_mode", # Method on entity class
)
async_add_entities([MyEntity(entry.runtime_data)])
await hass.services.async_call("light", "turn_on", {
"brightness_pct": 80,
"color_temp_kelvin": 3000,
"transition": 2,
}, target={"entity_id": "light.bedroom"}, blocking=True)
await hass.services.async_call("climate", "set_temperature", {
"temperature": 22,
"hvac_mode": "heat",
}, target={"entity_id": "climate.thermostat"}, blocking=True)
await hass.services.async_call("media_player", "play_media", {
"media_content_id": "https://example.com/stream",
"media_content_type": "music",
}, target={"entity_id": "media_player.speaker"}, blocking=True)
action:
- action: light.turn_on
target:
entity_id: light.living_room
data:
brightness_pct: 80
- action: climate.set_temperature
target:
entity_id: climate.thermostat
data:
temperature: 22
Target the level the action actually operates on:
entity_iddevice_idconfig_entry_idDo not use lower-level targets as a workaround for higher-level ones.
tools
Configures Python projects to the Python Tooling SSOT Standard (uv, Ruff, BasedPyright strict, pytest+coverage, pip-audit). Use when creating projects, writing standalone scripts, configuring pyproject.toml, migrating from pip/Poetry/mypy/black/flake8, or auditing a project for conformance to the standard.
development
Use when you're stuck or missing current information mid-task - the same command/API/approach failed twice, an error looks like a changed or deprecated API, or you need the current version of something, a fact from after your training cutoff, or to verify something you cannot confirm from the code in context. Starts with a cheap inline lookup and only escalates to a full research sweep if that fails. Do not use for routine pre-emptive checks before ordinary library work - for deliberate research, use /qdev:research.
documentation
Update the llm-wiki knowledge base (remote LXC CT 103, /srv/workspaces/llm-wiki, over SSH) with implementation-level details from the current session by dispatching the up-docs-propagate-wiki sub-agent. This skill should be used when the user runs /up-docs:wiki.
documentation
Update repository documentation (README.md, docs/, CLAUDE.md) based on session changes by dispatching the up-docs-propagate-repo sub-agent. This skill should be used when the user runs /up-docs:repo.