This skill provides an interface between the Home Assistant REST API and Alexa
Follow this tutorial
- Rename
/config/env.sample
to/config/env
MANUFACTURER
: The manufacturer to be displayed in the Alexa AppAPI_URL
: Url to your Home Assistant APIAPI_TOKEN
: HA Long Lived Access TokenINCLUDE_PATTERN
: Regex pattern to filter which Home Assistant entities to include (leave empty to include all)EXCLUDE_PATTERN
: Regex pattern to filter which Home Assistant entities to exclude (leave empty for no exclusions)
-
Install dependencies
npm i
-
Bundle and upload
zip -x "*out*" -x "*.git*" -r lambda.zip . && aws lambda update-function-code --function-name <name-of-your-lambda-function> --zip-file fileb://lambda.zip
- Bundle and upload (without
node_modules
if no changes)zip -x "*node_modules*" -x "*out*" -x "*.git*" -r lambda.zip . && aws lambda update-function-code --function-name <name-of-your-lambda-function> --zip-file fileb://lambda.zip
To add custom behavior you can add special devices.
That way you can for example make a switch control a TV.
Adding special devices requires an entry in the special_devices.json as well as a handler file in the special_devices/ directory.
- categories: Alexa display categories
- capabilities: Alexa capability interfaces
- currently supported:
- playback
- volume
- power
- channel
- scene
- input
- handler: name of the handler file in
special_devices/
- Turn on: "Alexa, schalte {HA friendly name} an
- Turn off: "Alexa, schalte {HA friendly name} aus
- Turn on: "Alexa, schalte {HA friendly name} an
- Turn off: "Alexa, schalte {HA friendly name} aus
- Switch HDMI input: "Alexa, Eingang HDMI{number}" (probably only works if no other media was started after turning on)
- Switch to TV: "Alexa, Eingang TV" (does not work, for whatever reason...)
- Switch channel: "Alexa, Kanal {number}"
- Switch channel by name: "Alexa, schalte auf {channel name}"
- Requires a script.tv_channel{channel name} in HA
- Volume up: "Alexa, {HA friendly name} {number} lauter"
- Might work without {HA friendly name} if no other media was started after turning on
- {number} is optional, +1 if omitted
- Volume down: "Alexa, {HA friendly name} {number} leiser"
- Might work without {HA friendly name} if no other media was started after turning on
- {number} is optional, -1 if omitted
- Volume mute: "Alexa, {HA friendly name} lautlos"
- Might work without {HA friendly name} if no other media was started after turning on