Update HOMEASSISTANT.md

Adding a description on how signal-cli-rest-api can trigger automations in Home Assistant. (Sending messages to Signal to trigger events)
This commit is contained in:
Joop
2023-03-02 15:31:23 +01:00
committed by GitHub
parent 7cee836b20
commit 3a791502bb

View File

@@ -6,7 +6,7 @@ This document covers the following topics:
* [Installation](#installation)
* [Set up a phone number](#set-up-a-phone-number)
* [Sending messages to Signal Messenger groups](#sending-messages-to-signal-messenger-groups)
* [Sending messages to Signal to trigger events](##sending-messages-to-signal-to-trigger-events)
See also the [documentation of the Home Assistant integration](https://www.home-assistant.io/integrations/signal_messenger/).
## Installation
@@ -174,6 +174,33 @@ In order for groups to show up in the `groups` list, try the following steps:
curl -X GET -H "Content-Type: application/json" 'http://127.0.0.1:8080/v1/receive/<number>'
```
## Sending messages to Signal to trigger events
In this example, we will be using signal-cli-rest-api to as a Home Assistant trigger. For example, you would be able to write 'light' to your Signal account linked to signal-cli-rest-api and have Home Assistant adjust the lights for you. To accomplish this, you will need to edit the `rest.yaml` configuration of Home Assistant, add the following resource:
```- resource: "http://127.0.0.1:8080/v1/receive/<number>"
headers:
Content-Type: application/json
sensor:
- name: "Signal message received"
value_template: '{{ value_json[0].envelope.dataMessage.message }}'
```
And then you can create an automation as follows:
```alias: "[signal] message received"
trigger:
- platform: state
entity_id:
- sensor.signal_message_received
condition: []
action:
- if:
- condition: state
entity_id: sensor.signal_message_received
state: <word to use for trigger>
then:
- service: <service to run>
data: {}
mode: single
```
## API details