Add docs for AWS Lambda, SNS and SQS (#478)

* Add docs for AWS Lambda, SNS and SQS

* Improve SNS documentation
This commit is contained in:
Robbie Trencheny 2016-05-15 13:51:00 -07:00 committed by Paulus Schoutsen
parent c10b2d2204
commit 62a6a078b7
6 changed files with 172 additions and 0 deletions

View File

@ -0,0 +1,77 @@
---
layout: page
title: "AWS Lambda"
description: "Instructions how to invoke AWS Lambda functions from Home Assistant."
date: 2016-05-14 16:35
sidebar: true
comments: false
sharing: true
footer: true
logo: aws_lambda.png
ha_category: Notifications
ha_release: 0.20
---
The AWS Lambda notify platform enables invoking [AWS Lambda](https://aws.amazon.com/lambda/) functions.
### Configuration
```yaml
# Example configuration.yaml entry
notify:
platform: aws_lambda
name: NOTIFIER_NAME
aws_access_key_id: AWS_ACCESS_KEY_ID
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
profile_name: AWS_PROFILE
region_name: 'us-east-1'
# Optional
context:
...
```
Configuration variables:
- **aws_access_key_id** (*Required if aws_secret_access_key is provided*): Your AWS Access Key ID. For more information, please read the [AWS General Reference regarding Security Credentials](http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html). If provided, you must also provide an `aws_secret_access_key` and must **not** provide a `profile_name`.
- **aws_secret_access_key** (*Required if aws_access_key_id is provided*): Your AWS Secret Access Key. For more information, please read the [AWS General Reference regarding Security Credentials](http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html). If provided, you must also provide an `aws_access_key_id` and must **not** provide a `profile_name`.
- **profile_name** (*Optional*): A credentials profile name. For more information, please see the [boto3 documentation section about credentials](http://boto3.readthedocs.io/en/latest/guide/configuration.html#shared-credentials-file).
- **region_name** (*Required*): The region identifier to connect to. The default is `us-east-1`.
- **name** (*Optional*): Setting the optional parameter `name` allows multiple notifiers to be created. The default value is `notify`. The notifier will bind to the service `notify.NOTIFIER_NAME`.
- **context** (*Optional*): An optional dictionary you can provide to pass custom context through to the Lambda function. The `context` dictionary (if any) is combined with the same data available at the `/api/config` HTTP API route.
### Usage
AWS Lambda is a notify platform and thus can be controlled by calling the notify service [as described here](/components/notify/). It will invoke a Lambda for all targets given in the notification payload. A target can be formatted as a function name, an entire ARN ([Amazon Resource Name](http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)) or a partial ARN. For more information, please see the [boto3 docs](http://boto3.readthedocs.io/en/latest/reference/services/lambda.html#Lambda.Client.invoke).
The Lambda event payload will contain everything passed in the service call payload. Here is an example payload that would be sent to Lambda:
```json
{
"title": "Test message!",
"target": "arn:aws:lambda:us-east-1:123456789012:function:ProcessKinesisRecords",
"data": {
"test": "okay"
},
"message": "Hello world!"
}
```
The context will look like this:
```json
{
"hass": {
"components": ["recorder", "logger", "http", "logbook", "api", "frontend"],
"latitude": 44.1234,
"location_name": "Home",
"longitude": 5.5678,
"temperature_unit": "°C",
"time_zone": "Europe/Zurich",
"version": "0.20.0.dev0"
},
"custom": {
"two": "three",
"test": "one"
}
}
```

View File

@ -0,0 +1,42 @@
---
layout: page
title: "AWS SNS"
description: "Instructions how to publish messages to AWS SNS from Home Assistant."
date: 2016-05-14 16:35
sidebar: true
comments: false
sharing: true
footer: true
logo: aws_sns.png
ha_category: Notifications
ha_release: 0.20
---
The AWS SNS notify platform enables publishing to an [AWS SNS](https://aws.amazon.com/sns/) topic or application.
### Configuration
```yaml
# Example configuration.yaml entry
notify:
platform: aws_sns
name: NOTIFIER_NAME
aws_access_key_id: AWS_ACCESS_KEY_ID
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
profile_name: AWS_PROFILE
region_name: 'us-east-1'
```
Configuration variables:
- **aws_access_key_id** (*Required if aws_secret_access_key is provided*): Your AWS Access Key ID. For more information, please read the [AWS General Reference regarding Security Credentials](http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html). If provided, you must also provide an `aws_secret_access_key` and must **not** provide a `profile_name`.
- **aws_secret_access_key** (*Required if aws_access_key_id is provided*): Your AWS Secret Access Key. For more information, please read the [AWS General Reference regarding Security Credentials](http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html). If provided, you must also provide an `aws_access_key_id` and must **not** provide a `profile_name`.
- **profile_name** (*Optional*): A credentials profile name. For more information, please see the [boto3 documentation section about credentials](http://boto3.readthedocs.io/en/latest/guide/configuration.html#shared-credentials-file).
- **region_name** (*Required*): The region identifier to connect to. The default is `us-east-1`.
- **name** (*Optional*): Setting the optional parameter `name` allows multiple notifiers to be created. The default value is `notify`. The notifier will bind to the service `notify.NOTIFIER_NAME`.
### Usage
AWS SNS is a notify platform and thus can be controlled by calling the notify service [as described here](/components/notify/). It will publish a message to all targets given in the notification payload. A target must be a SNS topic or endpoint ARN ([Amazon Resource Name](http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)). For more information, please see the [boto3 docs](http://boto3.readthedocs.io/en/latest/reference/services/sns.html#SNS.Client.publish).
If one exists, the SNS Subject will be set to the title. All attributes from the payload except message will be sent as stringified message attributes.

View File

@ -0,0 +1,53 @@
---
layout: page
title: "AWS SQS"
description: "Instructions how to publish messages to AWS SQS from Home Assistant."
date: 2016-05-14 16:35
sidebar: true
comments: false
sharing: true
footer: true
logo: aws_sqs.png
ha_category: Notifications
ha_release: 0.20
---
The AWS SQS notify platform enables publishing to an [AWS SQS](https://aws.amazon.com/sqs/) message queue.
### Configuration
```yaml
# Example configuration.yaml entry
notify:
platform: aws_sqs
name: NOTIFIER_NAME
aws_access_key_id: AWS_ACCESS_KEY_ID
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
profile_name: AWS_PROFILE
region_name: 'us-east-1'
```
Configuration variables:
- **aws_access_key_id** (*Required if aws_secret_access_key is provided*): Your AWS Access Key ID. For more information, please read the [AWS General Reference regarding Security Credentials](http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html). If provided, you must also provide an `aws_secret_access_key` and must **not** provide a `profile_name`.
- **aws_secret_access_key** (*Required if aws_access_key_id is provided*): Your AWS Secret Access Key. For more information, please read the [AWS General Reference regarding Security Credentials](http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html). If provided, you must also provide an `aws_access_key_id` and must **not** provide a `profile_name`.
- **profile_name** (*Optional*): A credentials profile name. For more information, please see the [boto3 documentation section about credentials](http://boto3.readthedocs.io/en/latest/guide/configuration.html#shared-credentials-file).
- **region_name** (*Required*): The region identifier to connect to. The default is `us-east-1`.
- **name** (*Optional*): Setting the optional parameter `name` allows multiple notifiers to be created. The default value is `notify`. The notifier will bind to the service `notify.NOTIFIER_NAME`.
### Usage
AWS SQS is a notify platform and thus can be controlled by calling the notify service [as described here](/components/notify/). It will publish a message to the queue for all targets given in the notification payload. A target must be a SQS topic URL. For more information, please see the [SQS docs](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/ImportantIdentifiers.html).
The SQS event payload will contain everything passed in the service call payload. SQS payloads will be published as stringified JSON. All attributes from the payload except message will also be sent as stringified message attributes. Here is an example message that would be published to the SQS queue:
```json
{
"title": "Test message!",
"target": "http://sqs.us-east-1.amazonaws.com/123456789012/queue2",
"data": {
"test": "okay"
},
"message": "Hello world!"
}
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB