Fix indentation and remove use_trigger_values (fixes #2306) (#2313)

This commit is contained in:
Fabian Affolter 2017-03-21 20:44:47 +01:00 committed by GitHub
parent 48084ee55e
commit e4246aa25a
3 changed files with 99 additions and 109 deletions

View File

@ -20,46 +20,42 @@ After setting up IFTTT, Maker Channel and ManyThing Channel, you can use the fol
```yaml ```yaml
# Example configuration.yaml entry # Example configuration.yaml entry
automation: automation:
- alias: 'ManyThing Recording ON' - alias: 'ManyThing Recording ON'
# This calls an IFTTT recipe to turn on recording of the ManyThing Camera # This calls an IFTTT recipe to turn on recording of the ManyThing Camera
# if we leave the house during the day. # if we leave the house during the day.
trigger: trigger:
- platform: state - platform: state
entity_id: group.all_devices entity_id: group.all_devices
state: 'not_home' state: 'not_home'
condition:
- platform: state
entity_id: sun.sun
state: 'above_horizon'
action:
service: ifttt.trigger
data: {"event":"manything_on"}
condition: - alias: 'ManyThing Recording OFF'
- platform: state # This calls an IFTTT recipe to turn off recording of the ManyThing Camera
entity_id: sun.sun # when we are home unless it's nighttime.
state: 'above_horizon' trigger:
- platform: state
action: entity_id: group.all_devices
service: ifttt.trigger state: 'home'
data: {"event":"manything_on"} condition:
- condition: state
- alias: 'ManyThing Recording OFF' entity_id: sun.sun
# This calls an IFTTT recipe to turn off recording of the ManyThing Camera state: 'above_horizon'
# when we are home unless it's nighttime. action:
trigger: service: ifttt.trigger
- platform: state data: {"event":"manything_off"}
entity_id: group.all_devices
state: 'home'
- platform: state
entity_id: sun.sun
state: 'above_horizon'
condition: use_trigger_values
action:
service: ifttt.trigger
data: {"event":"manything_off"}
``` ```
### {% linkable_title Setting up a recipe %} ### {% linkable_title Setting up a recipe %}
<p class='img'> <p class='img'>
<img src='/images/components/ifttt/IFTTT_manything_trigger.png' /> <img src='/images/components/ifttt/IFTTT_manything_trigger.png' />
You need to setup a unique trigger for each event you sent to IFTTT. You need to setup a unique trigger for each event you sent to IFTTT.
For ManyThing support, you need to set up an `on` and `off` event. For ManyThing support, you need to set up an `on` and `off` event.
</p> </p>
@ -73,4 +69,3 @@ domain | `ifttt`
service | `trigger` service | `trigger`
Service Data | `{"event": "manything_on"}` Service Data | `{"event": "manything_on"}`

View File

@ -16,42 +16,37 @@ Turn on a light in the living room when it starts raining, someone is home, and
```yaml ```yaml
automation: automation:
alias: 'Rainy Day' - alias: 'Rainy Day'
trigger:
trigger: - platform: state
- platform: state entity_id: sensor.precip_intensity
entity_id: sensor.precip_intensity state: 'rain'
state: 'rain' condition:
- platform: state - platform: state
entity_id: group.all_devices entity_id: group.all_devices
state: 'home' state: 'home'
- platform: time - platform: time
after: '14:00' after: '14:00'
before: '23:00' before: '23:00'
action:
condition: use_trigger_values service: light.turn_on
entity_id: light.couch_lamp
action:
service: light.turn_on
entity_id: light.couch_lamp
``` ```
And then of course turn off the lamp when it stops raining but only if it's within an hour before sunset. And then of course turn off the lamp when it stops raining but only if it's within an hour before sunset.
```yaml ```yaml
automation 2: - alias: 'Rain is over'
alias: 'Rain is over' trigger:
trigger: - platform: state
- platform: state entity_id: sensor.precip_intensity
entity_id: sensor.precip_intensity state: 'None'
state: 'None' condition:
- platform: sun - condition: sun
event: 'sunset' after: 'sunset'
offset: '-01:00:00' offset: '-01:00:00'
action:
condition: use_trigger_values service: light.turn_off
action: entity_id: light.couch_lamp
service: light.turn_off
entity_id: light.couch_lamp
``` ```

View File

@ -17,51 +17,51 @@ Just some sample automation rules to get you started.
automation: automation:
# Turns on lights 1 hour before sunset if people are home # Turns on lights 1 hour before sunset if people are home
# and if people get home between 16:00-23:00 # and if people get home between 16:00-23:00
- alias: 'Rule 1 Light on in the evening' - alias: 'Rule 1 Light on in the evening'
trigger: trigger:
# Prefix the first line of each trigger configuration # Prefix the first line of each trigger configuration
# with a '-' to enter multiple # with a '-' to enter multiple
- platform: sun - platform: sun
event: sunset event: sunset
offset: '-01:00:00' offset: '-01:00:00'
- platform: state - platform: state
entity_id: group.all_devices entity_id: group.all_devices
state: 'home' state: 'home'
condition: condition:
# Prefix the first line of each condition configuration # Prefix the first line of each condition configuration
# with a '-'' to enter multiple # with a '-'' to enter multiple
- condition: state - condition: state
entity_id: group.all_devices entity_id: group.all_devices
state: 'home' state: 'home'
- condition: time - condition: time
after: '16:00:00' after: '16:00:00'
before: '23:00:00' before: '23:00:00'
action: action:
service: homeassistant.turn_on service: homeassistant.turn_on
entity_id: group.living_room entity_id: group.living_room
# Turn off lights when everybody leaves the house # Turn off lights when everybody leaves the house
- alias: 'Rule 2 - Away Mode' - alias: 'Rule 2 - Away Mode'
trigger: trigger:
platform: state platform: state
entity_id: group.all_devices entity_id: group.all_devices
state: 'not_home' state: 'not_home'
action: action:
service: light.turn_off service: light.turn_off
entity_id: group.all_lights entity_id: group.all_lights
# Notify when Paulus leaves the house in the evening # Notify when Paulus leaves the house in the evening
- alias: 'Leave Home notification' - alias: 'Leave Home notification'
trigger: trigger:
platform: zone platform: zone
event: leave event: leave
zone: zone.home zone: zone.home
entity_id: device_tracker.paulus entity_id: device_tracker.paulus
condition: condition:
condition: time condition: time
after: '20:00' after: '20:00'
action: action:
service: notify.notify service: notify.notify
data: data:
message: 'Paulus left the house' message: 'Paulus left the house'
``` ```