ha_light_turn_on
Turn on a light in Home Assistant by providing its entity ID.
Instructions
Turn on a light by entity_id.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"entity_id": "<entity_id>"
},
"name": "ha_light_turn_on"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entity_id | Yes |
Implementation Reference
- src/index.ts:133-143 (registration)Registration of the 'ha_light_turn_on' tool via server.tool(), with name, description, schema, and handler.
server.tool( 'ha_light_turn_on', 'Turn on a light by entity_id.', TurnOnLightInput.shape, async (input) => { const res = await ha.callService('light', 'turn_on', { entity_id: input.entity_id }) return { content: [{ type: 'text', text: JSON.stringify(res, null, 2) }], } }, ) - src/index.ts:137-143 (handler)Handler function that calls ha.callService('light', 'turn_on', { entity_id: input.entity_id }) and returns the result.
async (input) => { const res = await ha.callService('light', 'turn_on', { entity_id: input.entity_id }) return { content: [{ type: 'text', text: JSON.stringify(res, null, 2) }], } }, ) - src/tools.ts:19-21 (schema)Zod schema definition for TurnOnLightInput — accepts a required entity_id string.
export const TurnOnLightInput = z.object({ entity_id: z.string().min(1), })