Created
September 1, 2018 00:49
-
-
Save dale3h/42ebc8dd3b2f3da56831313a538a43e8 to your computer and use it in GitHub Desktop.
[Home Assistant] If/Then Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http: | |
... | |
trusted_networks: | |
- 127.0.0.1 | |
rest_command: | |
ha_rest_api: | |
url: "http://localhost:8123/api/services/{{ service|replace('.', '/') }}" | |
method: post | |
content_type: application/json | |
payload: "{{ data|tojson }}" | |
script: | |
if_then: | |
alias: "If Then" | |
sequence: | |
- condition: template | |
value_template: "{{ if }}" | |
- service: rest_command.ha_rest_api | |
data_template: | |
service: "{{ service }}" | |
data: "{{ data }}" | |
automation: | |
- alias: "If/Then Test" | |
trigger: | |
- platform: state | |
entity_id: fan.dummy_fan | |
to: 'on' | |
action: | |
- service: script.if_then | |
data_template: | |
if: "{{ is_state('light.dummy_light_1', 'on') }}" | |
service: persistent_notification.create | |
data: | |
message: "Testing..." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment