From 3a791502bb5e00587ed93fb582c9ed082831008a Mon Sep 17 00:00:00 2001 From: Joop Date: Thu, 2 Mar 2023 15:31:23 +0100 Subject: [PATCH] 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) --- doc/HOMEASSISTANT.md | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/doc/HOMEASSISTANT.md b/doc/HOMEASSISTANT.md index 3a8bc14..b61cb0e 100644 --- a/doc/HOMEASSISTANT.md +++ b/doc/HOMEASSISTANT.md @@ -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/' ``` +## 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/" + 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: + then: + - service: + data: {} +mode: single +``` + ## API details