action
A generic block that represents some kind of action
Example
import { action } from "@hass-blocks/blocks"
const turnOnLivingRoomLights = action({
name: `Turn on lights`,
callback: async (hass) => {
await hass.callService({
domain: 'light',
service: 'turn_on',
target: {
entity_id: 'light.living_room'
}
})
},
});
Signature
action: <I = void, O = void>(config: IActionConfig<I, O>) => Block<I, O>
Parameters
Name | Type | Description |
config | IActionConfig<I, O> | configuration for the action |
Return Value
Block<I, O>