plugins/home-assistant-dev/skills/ha-device-conditions-actions/SKILL.md
Device conditions and actions for Home Assistant automation. Use when implementing device_condition.py, device_action.py, condition state checks, or device-level automation actions.
npx skillsauth add l3digitalnet/claude-code-plugins ha-device-conditions-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.
Conditions let automations check device state before proceeding.
# device_condition.py
"""Device conditions for {Name}."""
from __future__ import annotations
from typing import Any
import voluptuous as vol
from homeassistant.const import CONF_CONDITION, CONF_DEVICE_ID, CONF_DOMAIN, CONF_TYPE
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import condition, config_validation as cv
from homeassistant.helpers.typing import ConfigType, TemplateVarsType
from .const import DOMAIN
CONDITION_TYPES = {"is_on", "is_off", "is_connected"}
CONDITION_SCHEMA = cv.DEVICE_CONDITION_BASE_SCHEMA.extend(
{
vol.Required(CONF_TYPE): vol.In(CONDITION_TYPES),
}
)
async def async_get_conditions(
hass: HomeAssistant, device_id: str
) -> list[dict[str, Any]]:
"""Return conditions for device."""
conditions = []
for condition_type in CONDITION_TYPES:
conditions.append(
{
CONF_CONDITION: "device",
CONF_DEVICE_ID: device_id,
CONF_DOMAIN: DOMAIN,
CONF_TYPE: condition_type,
}
)
return conditions
@callback
def async_condition_from_config(
hass: HomeAssistant, config: ConfigType
) -> condition.ConditionCheckerType:
"""Create a condition from config."""
@callback
def test_condition(hass: HomeAssistant, variables: TemplateVarsType) -> bool:
"""Test the condition."""
# Implement your condition logic
# Return True if condition is met
return True
return test_condition
Actions let automations command devices directly.
# device_action.py
"""Device actions for {Name}."""
from __future__ import annotations
from typing import Any
import voluptuous as vol
from homeassistant.const import CONF_DEVICE_ID, CONF_DOMAIN, CONF_TYPE
from homeassistant.core import Context, HomeAssistant
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.typing import ConfigType
from .const import DOMAIN
ACTION_TYPES = {"turn_on", "turn_off", "toggle"}
ACTION_SCHEMA = cv.DEVICE_ACTION_BASE_SCHEMA.extend(
{
vol.Required(CONF_TYPE): vol.In(ACTION_TYPES),
}
)
async def async_get_actions(
hass: HomeAssistant, device_id: str
) -> list[dict[str, Any]]:
"""Return actions for device."""
actions = []
for action_type in ACTION_TYPES:
actions.append(
{
CONF_DEVICE_ID: device_id,
CONF_DOMAIN: DOMAIN,
CONF_TYPE: action_type,
}
)
return actions
async def async_call_action_from_config(
hass: HomeAssistant,
config: ConfigType,
variables: dict[str, Any],
context: Context | None,
) -> None:
"""Execute action."""
action_type = config[CONF_TYPE]
device_id = config[CONF_DEVICE_ID]
# Implement your action logic
if action_type == "turn_on":
# Call your service or method
pass
Device automation modules are auto-discovered when present. Ensure the manifest reflects the integration type:
{
"domain": "my_integration",
"name": "My Integration",
"integration_type": "device"
}
ha-device-triggersha-service-actionsdevelopment
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 Outline wiki documentation 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.
documentation
Update Notion pages with strategic and organizational context from the current session by dispatching the up-docs-propagate-notion sub-agent. This skill should be used when the user runs /up-docs:notion.