From 5cd47a0528bcbc72afbee6d2594ef0d2ee6b9826 Mon Sep 17 00:00:00 2001 From: Sean Mooney Date: Tue, 9 Feb 2021 16:36:30 -0500 Subject: [PATCH 1/2] Add supported TV model to Panasonic Viera page (#16477) Adds TX-58AX802B as supported model. Fixes https://github.com/home-assistant/home-assistant.io/issues/16475 --- source/_integrations/panasonic_viera.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/source/_integrations/panasonic_viera.markdown b/source/_integrations/panasonic_viera.markdown index 061363c57c2..e0d00e0d9b6 100644 --- a/source/_integrations/panasonic_viera.markdown +++ b/source/_integrations/panasonic_viera.markdown @@ -117,6 +117,7 @@ script: - TX-55EXW604S - TX-55FX680W - TX-55FZ802B +- TX-58AX802B - TX-58DX700B - TX-65EXW784 - TX-65FX720W From 577817d0cf27a3f9889234a9c3ab98a833919e30 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 10 Feb 2021 08:34:28 +0100 Subject: [PATCH 2/2] Remove inline Liquid escaping for templates (#16478) --- .../_cookbook/automation_first_light.markdown | 12 ++- source/_cookbook/automation_sun.markdown | 15 +-- .../_cookbook/foscam_away_mode_PTZ.markdown | 7 +- source/_cookbook/google_maps_card.markdown | 6 +- .../notify_if__new_ha_release.markdown | 5 +- .../notify_if_over_threshold.markdown | 13 ++- ...orm_actions_based_on_input_select.markdown | 96 ++++++++++--------- ...ha_if_wemo_switch_is_not_detected.markdown | 7 +- source/_cookbook/sonos_say.markdown | 23 +++-- .../splitting_configuration.markdown | 8 +- source/_docs/scripts/service-calls.markdown | 26 +++-- source/_integrations/alexa.intent.markdown | 12 ++- .../_integrations/binary_sensor.rest.markdown | 12 ++- .../binary_sensor.xiaomi_aqara.markdown | 18 +++- source/_integrations/braviatv.markdown | 7 +- source/_integrations/broadlink.markdown | 6 +- source/_integrations/conversation.markdown | 6 +- .../_integrations/cover.command_line.markdown | 10 +- source/_integrations/emoncms.markdown | 6 +- source/_integrations/enocean.markdown | 8 +- source/_integrations/feedreader.markdown | 8 +- source/_integrations/file.markdown | 6 +- source/_integrations/flic.markdown | 6 +- source/_integrations/homematic.markdown | 13 ++- source/_integrations/hp_ilo.markdown | 9 +- source/_integrations/influxdb.markdown | 18 +++- source/_integrations/intent_script.markdown | 6 +- source/_integrations/light.mqtt.markdown | 36 ++++--- source/_integrations/london_air.markdown | 10 +- source/_integrations/notify.markdown | 12 ++- .../_integrations/nuimo_controller.markdown | 6 +- source/_integrations/rest.markdown | 24 ++++- .../_integrations/rss_feed_template.markdown | 8 +- source/_integrations/script.markdown | 8 +- source/_integrations/spc.markdown | 8 +- .../switch.command_line.markdown | 12 ++- source/_integrations/tcp.markdown | 13 ++- source/_integrations/tensorflow.markdown | 8 +- source/_integrations/tts.markdown | 6 +- source/_integrations/uk_transport.markdown | 12 ++- source/_integrations/xmpp.markdown | 12 ++- ...-amazon-echo-icloud-and-templates.markdown | 6 +- ...hat-cant-track-themselves-part-ii.markdown | 10 +- ...10-08-hassbian-rest-digital-ocean.markdown | 6 +- 44 files changed, 400 insertions(+), 166 deletions(-) diff --git a/source/_cookbook/automation_first_light.markdown b/source/_cookbook/automation_first_light.markdown index 39a4f15e9d9..b7d6b18799c 100644 --- a/source/_cookbook/automation_first_light.markdown +++ b/source/_cookbook/automation_first_light.markdown @@ -15,6 +15,8 @@ input_boolean: #### The Main Automation +{% raw %} + ```yaml ## These first two control t input_boolean that allows the "first morning action" to occur ## If the action is triggered, it will also disable this boolean. This assumes you have the sun platform enabled. @@ -67,26 +69,26 @@ automation: - condition: numeric_state entity_id: light.livingroom_ec # if light is off, force a 0, otherwise use the brightness value - value_template: {% raw %}'{% if is_state('light.livingroom_ec', 'on') %}{{ state_attr('light.livingroom_ec', 'brightness') }}{% else %}0{% endif %}'{% endraw %} + value_template: '{% if is_state('light.livingroom_ec', 'on') %}{{ state_attr('light.livingroom_ec', 'brightness') }}{% else %}0{% endif %}' # brightness below 50% (255 = 100%) below: 128 - condition: numeric_state entity_id: light.kitchen_bar - value_template: {% raw %}'{% if is_state('light.kitchen_bar', 'on') %}{{ state_attr('light.kitchen_bar', 'brightness') }}{% else %}0{% endif %}'{% endraw %} + value_template: '{% if is_state('light.kitchen_bar', 'on') %}{{ state_attr('light.kitchen_bar', 'brightness') }}{% else %}0{% endif %}' below: 128 - condition: numeric_state entity_id: light.kitchen_ceiling - value_template: {% raw %}'{% if is_state('light.kitchen_ceiling', 'on') %}{{ state_attr('light.kitchen_ceiling', 'brightness') }}{% else %}0{% endif %}'{% endraw %} + value_template: '{% if is_state('light.kitchen_ceiling', 'on') %}{{ state_attr('light.kitchen_ceiling', 'brightness') }}{% else %}0{% endif %}' below: 128 # Trigger a scene # You could add as many services or scenes as you'd like - service: scene.turn_on entity_id: scene.morning_first_motion - - ``` +{% endraw %} + #### The Scene Here is the Scene that is called via the Automations above. diff --git a/source/_cookbook/automation_sun.markdown b/source/_cookbook/automation_sun.markdown index f6af4cd26c0..eaa9630eabb 100644 --- a/source/_cookbook/automation_sun.markdown +++ b/source/_cookbook/automation_sun.markdown @@ -4,7 +4,7 @@ description: "Automation examples that use the sun." ha_category: Automation Examples --- -#### Turn on the living room lights 45 minutes before sunset if anyone is at home +#### Turn on the living room lights 45 minutes before sunset if anyone is at home ```yaml automation: @@ -21,7 +21,7 @@ automation: entity_id: group.living_room_lights ``` -#### Natural wake up light +#### Natural wake up light _Note, Philips Hue and LIFX are currently the only light platforms that support transitions._ @@ -68,12 +68,14 @@ automation: Solar elevation automations can cope with offsets from sunset / sunrise as the seasons change better than using a time based offsets. +{% raw %} + ```yaml - alias: "Turn a few lights on when the sun gets dim" trigger: platform: numeric_state entity_id: sun.sun - value_template: "{% raw %}{{ state_attr('sun.sun', 'elevation') }}{% endraw %}" + value_template: "{{ state_attr('sun.sun', 'elevation') }}" below: 3.5 action: service: scene.turn_on @@ -83,7 +85,7 @@ Solar elevation automations can cope with offsets from sunset / sunrise as the s trigger: platform: numeric_state entity_id: sun.sun - value_template: "{% raw %}{{ state_attr('sun.sun', 'elevation') }}{% endraw %}" + value_template: "{{ state_attr('sun.sun', 'elevation') }}" below: 1.5 action: service: scene.turn_on @@ -93,10 +95,11 @@ Solar elevation automations can cope with offsets from sunset / sunrise as the s trigger: platform: numeric_state entity_id: sun.sun - value_template: "{% raw %}{{ state_attr('sun.sun', 'elevation') }}{% endraw %}" + value_template: "{{ state_attr('sun.sun', 'elevation') }}" below: -2.5 action: service: switch.turn_off entity_id: switch.blind - ``` + +{% endraw %} \ No newline at end of file diff --git a/source/_cookbook/foscam_away_mode_PTZ.markdown b/source/_cookbook/foscam_away_mode_PTZ.markdown index 95cd12b85a2..f9d73a4c66d 100644 --- a/source/_cookbook/foscam_away_mode_PTZ.markdown +++ b/source/_cookbook/foscam_away_mode_PTZ.markdown @@ -11,6 +11,8 @@ The following outlines examples of the switch, services, and scripts required to The `switch.foscam_motion` will control whether the motion detection is on or off. This switch supports `statecmd`, which checks the current state of motion detection. +{% raw %} + ```yaml # Replace admin and password with an "Admin" privileged Foscam user # Replace ipaddress with the local IP address of your Foscam @@ -22,9 +24,11 @@ switch: command_on: "curl -k --tls-max 1.2 "https://ipaddress:443/cgi-bin/CGIProxy.fcgi?cmd=setMotionDetectConfig&isEnable=1&usr=admin&pwd=password"" command_off: 'curl -k --tls-max 1.2 "https://ipaddress:443/cgi-bin/CGIProxy.fcgi?cmd=setMotionDetectConfig&isEnable=0&usr=admin&pwd=password"' command_state: 'curl -k --silent --tls-max 1.2 "https://ipaddress:443/cgi-bin/CGIProxy.fcgi?cmd=getMotionDetectConfig&usr=admin&pwd=password" | grep "isEnable" | cut -b 15' - value_template: '{% raw %}{{ value == "1" }}{% endraw %}' + value_template: '{{ value == "1" }}' ``` +{% endraw %} + The service `shell_command.foscam_turn_off` sets the camera to point down and away to indicate it is not recording, and `shell_command.foscam_turn_on` sets the camera to point where I'd like to record. Each of these services require preset points to be added to your camera. See source above for additional information. ```yaml @@ -75,4 +79,3 @@ automation: action: service: script.foscam_off ``` - diff --git a/source/_cookbook/google_maps_card.markdown b/source/_cookbook/google_maps_card.markdown index 70790a604ae..10b06e9c4c8 100644 --- a/source/_cookbook/google_maps_card.markdown +++ b/source/_cookbook/google_maps_card.markdown @@ -10,16 +10,20 @@ As of June 2018, Google has changed the API limits for static maps. You now need It also leverages the `limit_refetch_to_url_change` option to ensure that we do not make a lot of requests to the Google Maps API. +{% raw %} + ```yaml # Example configuration.yaml entry. # Shows device_tracker.demo_paulus on a map. camera: name: Paulus platform: generic - still_image_url: {% raw %}https://maps.googleapis.com/maps/api/staticmap?center={{ state_attr('device_tracker.demo_paulus', 'latitude') }},{{ state_attr('device_tracker.demo_paulus', 'longitude') }}&zoom=13&size=500x500&maptype=roadmap&markers=color:blue%7Clabel:P%7C{{ state_attr('device_tracker.demo_paulus', 'latitude') }},{{ state_attr('device_tracker.demo_paulus', 'longitude') }}{% endraw %}&key=YOUR_API_KEY + still_image_url: https://maps.googleapis.com/maps/api/staticmap?center={{ state_attr('device_tracker.demo_paulus', 'latitude') }},{{ state_attr('device_tracker.demo_paulus', 'longitude') }}&zoom=13&size=500x500&maptype=roadmap&markers=color:blue%7Clabel:P%7C{{ state_attr('device_tracker.demo_paulus', 'latitude') }},{{ state_attr('device_tracker.demo_paulus', 'longitude') }}&key=YOUR_API_KEY limit_refetch_to_url_change: true ``` +{% endraw %} +

Screenshot showing Google Maps integration in Home Assistant front end.

diff --git a/source/_cookbook/notify_if__new_ha_release.markdown b/source/_cookbook/notify_if__new_ha_release.markdown index 8a99099d99d..76a731db903 100644 --- a/source/_cookbook/notify_if__new_ha_release.markdown +++ b/source/_cookbook/notify_if__new_ha_release.markdown @@ -29,6 +29,8 @@ automation: You can use [templates](/topics/templating/) to include the release number of Home Assistant if you prefer. The following example sends a notification via [Pushbullet](/integrations/pushbullet) with the Home Assistant version in the message. +{% raw %} + ```yaml notify: - platform: pushbullet @@ -47,6 +49,7 @@ automation: data: title: "New Home Assistant Release" target: "YOUR_TARGET_HERE" #See Pushbullet integration for usage - message: "Home Assistant {% raw %} {{ state_attr('binary_sensor.updater', 'newest_version') }} {% endraw %} is now available." + message: "Home Assistant {{ state_attr('binary_sensor.updater', 'newest_version') }} is now available." ``` +{% endraw %} diff --git a/source/_cookbook/notify_if_over_threshold.markdown b/source/_cookbook/notify_if_over_threshold.markdown index 8e7adf47730..f34c9d5a940 100644 --- a/source/_cookbook/notify_if_over_threshold.markdown +++ b/source/_cookbook/notify_if_over_threshold.markdown @@ -6,8 +6,9 @@ ha_category: Automation Examples The following example sends a notification via pushbullet if a sensor is over a critical value: -```yaml +{% raw %} +```yaml notify me: platform: pushbullet api_key: "API_KEY_HERE" @@ -23,11 +24,15 @@ automation: service: notify.mypushbullet data: title: "Furnace fan is running" - message: "Fan running because current is {% raw %}{{ states('sensor.furnace') }}{% endraw %} amps" + message: "Fan running because current is {{ states('sensor.furnace') }} amps" ``` +{% endraw %} + If you also want a notification when it drops back down below that limit, you could add this as well: +{% raw %} + ```yaml - alias: FanOff trigger: @@ -38,5 +43,7 @@ If you also want a notification when it drops back down below that limit, you co service: notify.mypushbullet data: title: "Furnace fan is stopped" - message: "Fan stopped because current is {% raw %}{{ states('sensor.furnace') }}{% endraw %} amps" + message: "Fan stopped because current is {{ states('sensor.furnace') }} amps" ``` + +{% endraw %} diff --git a/source/_cookbook/perform_actions_based_on_input_select.markdown b/source/_cookbook/perform_actions_based_on_input_select.markdown index 6e9ed91f224..f8436cfe8ff 100644 --- a/source/_cookbook/perform_actions_based_on_input_select.markdown +++ b/source/_cookbook/perform_actions_based_on_input_select.markdown @@ -71,6 +71,8 @@ automation: ``` A little bit more complex example that uses [`input_select`](/integrations/input_select/) and template to decide what to play, and which [Chromecast](/integrations/cast/) to play on. +{% raw %} + ```yaml input_select: radio_station: @@ -106,22 +108,22 @@ automation: action: service: media_player.turn_off data: - entity_id: >{% raw %} - {% if is_state("input_select.radio_player", "Mansarda") %}{% endraw %} - media_player.bed_2{% raw %} - {%-elif is_state("input_select.radio_player", "Doccia") %}{% endraw %} - media_player.bed_3{% raw %} - {%-elif is_state("input_select.radio_player", "Bed") %}{% endraw %} - media_player.bed{% raw %} - {%-elif is_state("input_select.radio_player", "Bath") %}{% endraw %} - media_player.bath{% raw %} - {%-elif is_state("input_select.radio_player", "Salotto") %}{% endraw %} - media_player.salotto{% raw %} - {%-elif is_state("input_select.radio_player", "Salotto Video") %}{% endraw %} - media_player.salotto_video{% raw %} - {% else %}{% endraw %} - none{% raw %} - {% endif %}{% endraw %} + entity_id: > + {% if is_state("input_select.radio_player", "Mansarda") %} + media_player.bed_2 + {%-elif is_state("input_select.radio_player", "Doccia") %} + media_player.bed_3 + {%-elif is_state("input_select.radio_player", "Bed") %} + media_player.bed + {%-elif is_state("input_select.radio_player", "Bath") %} + media_player.bath + {%-elif is_state("input_select.radio_player", "Salotto") %} + media_player.salotto + {%-elif is_state("input_select.radio_player", "Salotto Video") %} + media_player.salotto_video + {% else %} + none + {% endif %} - alias: Stream Radio - Template trigger: @@ -130,35 +132,37 @@ automation: action: - service: media_player.play_media data: - entity_id: >{% raw %} - {% if is_state("input_select.radio_player", "Mansarda") %}{% endraw %} - media_player.bed_2{% raw %} - {%-elif is_state("input_select.radio_player", "Doccia") %}{% endraw %} - media_player.bed_3{% raw %} - {%-elif is_state("input_select.radio_player", "Bed") %}{% endraw %} - media_player.bed{% raw %} - {%-elif is_state("input_select.radio_player", "Bath") %}{% endraw %} - media_player.bath{% raw %} - {%-elif is_state("input_select.radio_player", "Salotto") %}{% endraw %} - media_player.salotto{% raw %} - {%-elif is_state("input_select.radio_player", "Salotto Video") %}{% endraw %} - media_player.salotto_video{% raw %} - {% else %}{% endraw %} - none{% raw %} - {% endif %}{% endraw %} - media_content_id: >{% raw %} - {% if is_state("input_select.radio_station", "Z88.3") %}{% endraw %} - http://ice.zradio.org/z/high.mp3{% raw %} - {%-elif is_state("input_select.radio_station", "Virgin") %}{% endraw %} - http://icecast.unitedradio.it/Virgin.mp3{% raw %} - {%-elif is_state("input_select.radio_station", "RMC") %}{% endraw %} - http://icecast.unitedradio.it/RMC.mp3{% raw %} - {%-elif is_state("input_select.radio_station", "rmcHQ") %}{% endraw %} - http://icecast.unitedradio.it/rmcHQ.mp3{% raw %} - {%-elif is_state("input_select.radio_station", "105") %}{% endraw %} - http://icecast.unitedradio.it/Radio105.mp3{% raw %} - {% else %}{% endraw %} - none{% raw %} - {% endif %}{% endraw %} + entity_id: > + {% if is_state("input_select.radio_player", "Mansarda") %} + media_player.bed_2 + {%-elif is_state("input_select.radio_player", "Doccia") %} + media_player.bed_3 + {%-elif is_state("input_select.radio_player", "Bed") %} + media_player.bed + {%-elif is_state("input_select.radio_player", "Bath") %} + media_player.bath + {%-elif is_state("input_select.radio_player", "Salotto") %} + media_player.salotto + {%-elif is_state("input_select.radio_player", "Salotto Video") %} + media_player.salotto_video + {% else %} + none + {% endif %} + media_content_id: > + {% if is_state("input_select.radio_station", "Z88.3") %} + http://ice.zradio.org/z/high.mp3 + {%-elif is_state("input_select.radio_station", "Virgin") %} + http://icecast.unitedradio.it/Virgin.mp3 + {%-elif is_state("input_select.radio_station", "RMC") %} + http://icecast.unitedradio.it/RMC.mp3 + {%-elif is_state("input_select.radio_station", "rmcHQ") %} + http://icecast.unitedradio.it/rmcHQ.mp3 + {%-elif is_state("input_select.radio_station", "105") %} + http://icecast.unitedradio.it/Radio105.mp3 + {% else %} + none + {% endif %} media_content_type: "music" ``` + +{% endraw %} diff --git a/source/_cookbook/restart_ha_if_wemo_switch_is_not_detected.markdown b/source/_cookbook/restart_ha_if_wemo_switch_is_not_detected.markdown index bc54bdd3ff4..cf9347b9df8 100644 --- a/source/_cookbook/restart_ha_if_wemo_switch_is_not_detected.markdown +++ b/source/_cookbook/restart_ha_if_wemo_switch_is_not_detected.markdown @@ -8,6 +8,8 @@ ha_category: Automation Examples This configuration example is restarting Home Assistant if a [WeMo](/integrations/wemo) switch is not detected. An additional MQTT switch is present for stopping Home Assistant and can be triggered by [IFTTT](/integrations/ifttt/). The running batch script will automatically restart Home Assistant if the process isn't found anymore. +{% raw %} + ```yaml mqtt: broker: 127.0.0.1 @@ -65,7 +67,7 @@ automation: to: "home" condition: - condition: template - value_template: {% raw %}'{% if states.switch.wemo %}false{% else %}true{% endif %}'{% endraw %} + value_template: '{% if states.switch.wemo %}false{% else %}true{% endif %}' - condition: state entity_id: script.restarthawemo state: "off" @@ -82,7 +84,7 @@ automation: - alias: "Stop restarting HA is WeMo is found" trigger: platform: template - value_template: {% raw %}'{% if states.switch.wemo %}true{% else %}false{% endif %}'{% endraw %} + value_template: '{% if states.switch.wemo %}true{% else %}false{% endif %}' condition: condition: state entity_id: script.restarthawemo @@ -92,3 +94,4 @@ automation: entity_id: script.restarthawemo ``` +{% endraw %} diff --git a/source/_cookbook/sonos_say.markdown b/source/_cookbook/sonos_say.markdown index 15a5145241c..478b0c54f02 100644 --- a/source/_cookbook/sonos_say.markdown +++ b/source/_cookbook/sonos_say.markdown @@ -8,6 +8,8 @@ ha_category: Automation Examples This script allows you to use [TTS](/integrations/#text-to-speech) on Sonos. +{% raw %} + ```yaml script: sonos_say: @@ -15,25 +17,28 @@ script: sequence: - service: sonos.snapshot data: - entity_id: {% raw %}"{{ sonos_entity }}"{% endraw %} + entity_id: "{{ sonos_entity }}" - service: sonos.unjoin data: - entity_id: {% raw %}"{{ sonos_entity }}"{% endraw %} + entity_id: "{{ sonos_entity }}" - service: media_player.volume_set data: - entity_id: {% raw %}"{{ sonos_entity }}"{% endraw %} - volume_level: {% raw %}"{{ volume }}"{% endraw %} + entity_id: "{{ sonos_entity }}" + volume_level: "{{ volume }}" - service: tts.voicerss_say data: - entity_id: {% raw %}"{{ sonos_entity }}"{% endraw %} - message: {% raw %}"{{ message }}"{% endraw %} - - delay: {% raw %}"{{ delay }}"{% endraw %} + entity_id: "{{ sonos_entity }}" + message: "{{ message }}" + - delay: "{{ delay }}" - service: sonos.restore data: - entity_id: {% raw %}"{{ sonos_entity }}"{% endraw %} + entity_id: "{{ sonos_entity }}" ``` +{% endraw %} + We call this now with: + ```yaml automation: - alias: "test" @@ -48,6 +53,7 @@ automation: message: "Your husband coming home!" delay: "00:00:05" ``` + Note that this example uses the `voicerss` text-to-speech platform. There are many platforms that can be used. The one installed by default with Home Assistant is Google TTS. This appears in your `configuration.yaml` file as: ```yaml @@ -56,6 +62,7 @@ tts: ``` If you want to use this TTS engine, change the line in the example provided to: + ```txt - service: tts.google_translate_say ``` diff --git a/source/_docs/configuration/splitting_configuration.markdown b/source/_docs/configuration/splitting_configuration.markdown index 037fbf60666..33bf5480b9a 100644 --- a/source/_docs/configuration/splitting_configuration.markdown +++ b/source/_docs/configuration/splitting_configuration.markdown @@ -141,6 +141,8 @@ This small example illustrates how the "split" files work. In this case, we star This (large) sensor configuration gives us another example: +{% raw %} + ```yaml ### sensor.yaml ### METEOBRIDGE ############################################# @@ -149,7 +151,7 @@ This (large) sensor configuration gives us another example: host: 192.168.2.82 timeout: 6 payload: "Content-type: text/xml; charset=UTF-8\n\n" - value_template: "{% raw %}{{value.split (' ')[2]}}{% endraw %}" + value_template: "{{value.split (' ')[2]}}" unit: C - platform: tcp name: "Outdoor Humidity (Meteobridge)" @@ -157,7 +159,7 @@ This (large) sensor configuration gives us another example: port: 5556 timeout: 6 payload: "Content-type: text/xml; charset=UTF-8\n\n" - value_template: "{% raw %}{{value.split (' ')[3]}}{% endraw %}" + value_template: "{{value.split (' ')[3]}}" unit: Percent #### STEAM FRIENDS ################################## @@ -179,6 +181,8 @@ This (large) sensor configuration gives us another example: name: "Ann Arbor" ``` +{% endraw %} + You'll notice that this example includes a secondary parameter section (under the steam section) as well as a better example of the way comments can be used to break down files into sections. That about wraps it up. diff --git a/source/_docs/scripts/service-calls.markdown b/source/_docs/scripts/service-calls.markdown index 98f081eac56..c1087b37dd7 100644 --- a/source/_docs/scripts/service-calls.markdown +++ b/source/_docs/scripts/service-calls.markdown @@ -62,22 +62,27 @@ A full list of the parameters for a service can be found on the documentation pa You can use [templating] support to dynamically choose which service to call. For example, you can call a certain service based on if a light is on. +{% raw %} + ```yaml service: > - {% raw %}{% if states('sensor.temperature') | float > 15 %} + {% if states('sensor.temperature') | float > 15 %} switch.turn_on {% else %} switch.turn_off - {% endif %}{% endraw %} + {% endif %} entity_id: switch.ac ``` +{% endraw %} + ### Using the Services Developer Tool You can use the Services Developer Tool to test data to pass in a service call. For example, you may test turning on or off a 'group' (See [groups] for more info) To turn a group on or off, pass the following info: + - Domain: `homeassistant` - Service: `turn_on` - Service Data: `{ "entity_id": "group.kitchen" }` @@ -86,26 +91,29 @@ To turn a group on or off, pass the following info: Templates can also be used for the data that you pass to the service call. +{% raw %} + ```yaml service: thermostat.set_temperature data: entity_id: > - {% raw %}{% if is_state('device_tracker.paulus', 'home') %} + {% if is_state('device_tracker.paulus', 'home') %} thermostat.upstairs {% else %} thermostat.downstairs - {% endif %}{% endraw %} - temperature: {% raw %}{{ 22 - distance(states.device_tracker.paulus) }}{% endraw %} + {% endif %} + temperature: {{ 22 - distance(states.device_tracker.paulus) }} ``` +{% endraw %} ### `homeassistant` services There are four `homeassistant` services that aren't tied to any single domain, these are: -* `homeassistant.turn_on` - Turns on an entity (that supports being turned on), for example an `automation`, `switch`, etc -* `homeassistant.turn_off` - Turns off an entity (that supports being turned off), for example an `automation`, `switch`, etc -* `homeassistant.toggle` - Turns off an entity that is on, or turns on an entity that is off (that supports being turned on and off) -* `homeassistant.update_entity` - Request the update of an entity, rather than waiting for the next scheduled update, for example [Google travel time] sensor, a [template sensor], or a [light] +- `homeassistant.turn_on` - Turns on an entity (that supports being turned on), for example an `automation`, `switch`, etc +- `homeassistant.turn_off` - Turns off an entity (that supports being turned off), for example an `automation`, `switch`, etc +- `homeassistant.toggle` - Turns off an entity that is on, or turns on an entity that is off (that supports being turned on and off) +- `homeassistant.update_entity` - Request the update of an entity, rather than waiting for the next scheduled update, for example [Google travel time] sensor, a [template sensor], or a [light] Complete service details and examples can be found on the [Home Assistant integration][homeassistant-integration-services] page. diff --git a/source/_integrations/alexa.intent.markdown b/source/_integrations/alexa.intent.markdown index e07127c2640..72f4d203dcd 100644 --- a/source/_integrations/alexa.intent.markdown +++ b/source/_integrations/alexa.intent.markdown @@ -210,18 +210,22 @@ ActivateSceneIntent activate {Scene} Then add the intent to your `intent_script` section in your HA configuration file: +{% raw %} + ```yaml intent_script: ActivateSceneIntent: action: service: scene.turn_on data: - entity_id: scene.{% raw %}{{ Scene | replace(" ", "_") }}{% endraw %} + entity_id: scene.{{ Scene | replace(" ", "_") }} speech: type: plain text: OK ``` +{% endraw %} + Here we are using [templates] to take the name we gave to Alexa e.g., `downstairs on` and replace the space with an underscore so it becomes `downstairs_on` as Home Assistant expects. Now say `Alexa ask Home Assistant to activate ` and Alexa will activate that scene for you. @@ -258,18 +262,22 @@ RunScriptIntent run {Script} Then add the intent to your intent_script section in your HA configuration file: +{% raw %} + ```yaml intent_script: RunScriptIntent: action: service: script.turn_on data: - entity_id: script.{% raw %}{{ Script | replace(" ", "_") }}{% endraw %} + entity_id: script.{{ Script | replace(" ", "_") }} speech: type: plain text: OK ``` +{% endraw %} + Now say `Alexa ask Home Assistant to run ` and Alexa will run that script for you. ### Support for Launch Requests diff --git a/source/_integrations/binary_sensor.rest.markdown b/source/_integrations/binary_sensor.rest.markdown index 5c5c339d1c5..8c9738afe36 100644 --- a/source/_integrations/binary_sensor.rest.markdown +++ b/source/_integrations/binary_sensor.rest.markdown @@ -52,13 +52,17 @@ binary_sensor: or a template based request: +{% raw %} + ```yaml # Example configuration.yaml entry sensor: - platform: rest - resource_template: {% raw %} "http://IP_ADDRESS/{{ now().strftime('%Y-%m-%d') }}" {% endraw %} + resource_template: "http://IP_ADDRESS/{{ now().strftime('%Y-%m-%d') }}" ``` +{% endraw %} + {% configuration %} resource: description: The resource or endpoint that contains the value. @@ -131,6 +135,8 @@ Instead of using an [aREST](/integrations/arest#binary-sensor) binary sensor, you could retrieve the value of a device supporting aREST directly with a REST binary sensor. +{% raw %} + ```yaml binary_sensor: - platform: rest @@ -138,9 +144,11 @@ binary_sensor: method: GET name: Light device_class: light - value_template: {% raw %}'{{ value_json.return_value }}'{% endraw %} + value_template: '{{ value_json.return_value }}' ``` +{% endraw %} + ### Accessing an HTTP authentication protected endpoint The REST sensor supports HTTP authentication and customized headers. diff --git a/source/_integrations/binary_sensor.xiaomi_aqara.markdown b/source/_integrations/binary_sensor.xiaomi_aqara.markdown index 8eeef94a6ff..3fb58d7f2b7 100644 --- a/source/_integrations/binary_sensor.xiaomi_aqara.markdown +++ b/source/_integrations/binary_sensor.xiaomi_aqara.markdown @@ -138,6 +138,8 @@ The requirement is that you have setup the [`xiaomi aqara` integration](/integra #### Gas +{% raw %} + ```yaml - alias: Send notification on gas alarm trigger: @@ -149,9 +151,11 @@ The requirement is that you have setup the [`xiaomi aqara` integration](/integra - service: notify.html5 data: title: Gas alarm! - message: "Gas with a density of {% raw %}{{ state_attr('binary_sensor.natgas_sensor_158dxxxxxxxxxx', 'density') }}{% endraw %} detected." + message: "Gas with a density of {{ state_attr('binary_sensor.natgas_sensor_158dxxxxxxxxxx', 'density') }} detected." ``` +{% endraw %} + #### Xiaomi Wireless Button As indicated in the table on top of this page there are 3 versions of the button. For the round shaped button the available events are `single`, `double`, `hold`, `long_click_press` and `long_click_release`. Aqara branded buttons are square shaped. Model WXKG11LM only supports `single`, `double`, `long_click_press`and `hold` events. WXKG12LM supports `single`, `double`, `long_click_press` and `shake` events. For the Aqara versions the delay between two clicks to generate a double click must be larger than with the round button. Clicking too quickly generates a single click event. @@ -263,6 +267,8 @@ Available events are `flip90`, `flip180`, `move`, `tap_twice`, `shake_air`, `swi The Aqara Wireless Switch is available as single-key and double-key version. Each key behaves like the Wireless Button limited to the click event `single`. The double key version adds a third device called `binary_sensor.wall_switch_both_158xxxxxxxxx12` which reports a click event called `both` if both keys are pressed. +{% raw %} + ```yaml - alias: Decrease brightness of the gateway light trigger: @@ -275,7 +281,7 @@ The Aqara Wireless Switch is available as single-key and double-key version. Eac service: light.turn_on entity_id: light.gateway_light_34xxxxxxxx13 data: - brightness: {% raw %}>- + brightness: >- {% if state_attr('light.gateway_light_34xxxxxxxx13', 'brightness') %} {% if state_attr('light.gateway_light_34xxxxxxxx13', 'brightness') - 60 >= 10 %} {{state_attr('light.gateway_light_34xxxxxxxx13', 'brightness') - 60}} @@ -284,7 +290,7 @@ The Aqara Wireless Switch is available as single-key and double-key version. Eac {% endif %} {% else %} 10 - {% endif %}{% endraw %} + {% endif %} - alias: Increase brightness of the gateway light trigger: @@ -297,7 +303,7 @@ The Aqara Wireless Switch is available as single-key and double-key version. Eac service: light.turn_on entity_id: light.gateway_light_34xxxxxxxx13 data: - brightness: {% raw %}>- + brightness: >- {% if state_attr('light.gateway_light_34xxxxxxxx13', 'brightness') %} {% if state_attr('light.gateway_light_34xxxxxxxx13', 'brightness') + 60 <= 255 %} {{state_attr('light.gateway_light_34xxxxxxxx13', 'brightness') + 60}} @@ -306,7 +312,7 @@ The Aqara Wireless Switch is available as single-key and double-key version. Eac {% endif %} {% else %} 10 - {% endif %}{% endraw %} + {% endif %} - alias: Turn off the gateway light trigger: @@ -320,6 +326,8 @@ The Aqara Wireless Switch is available as single-key and double-key version. Eac entity_id: light.gateway_light_34xxxxxxxx13 ``` +{% endraw %} + #### Vibration Sensor This automation toggles the living room lamp on vibration/tilt. diff --git a/source/_integrations/braviatv.markdown b/source/_integrations/braviatv.markdown index e88d1f867dd..5897a83239c 100644 --- a/source/_integrations/braviatv.markdown +++ b/source/_integrations/braviatv.markdown @@ -86,6 +86,9 @@ Users of TVs older than 2013 have another option for controlling their TV via Ho If you have a Raspberry Pi connected to your TV: + +{% raw %} + ```yaml switch: - platform: command_line @@ -94,9 +97,11 @@ switch: command_on: ssh root@[IP] "echo 'on 0' | cec-client -s" command_off: ssh root@[IP] "echo 'standby 0' | cec-client -s" command_state: ssh root@[IP] "echo 'pow 0' | cec-client -s |grep 'power status:'" - value_template: {% raw %}'{{ value == "power status: on" }}{% endraw %}' + value_template: '{{ value == "power status: on" }}' ``` +{% endraw %} + Using `cec-client` is a great method to turn your TV off/on, however the trade off is if you're using Kodi, it will no longer be able to control your TV using the TV Remote. This is because only one process can control the CEC functionality within the Raspberry Pi at a time and running the above commands terminates the functionality inside libCEC within Kodi. Kodi must be restarted for TV remove functionality to work again. diff --git a/source/_integrations/broadlink.markdown b/source/_integrations/broadlink.markdown index a2323fdef0e..bade655d1ce 100644 --- a/source/_integrations/broadlink.markdown +++ b/source/_integrations/broadlink.markdown @@ -499,13 +499,17 @@ First get or learn all the remotes you want to add to Home Assistant in e-Contro 7. Drag a Template node on the Flow to the right of the RM node and link it to the RM node. 8. Double click the Template node to edit it, select: + {% raw %} + ```bash Property: msg.payload Format: Mustache template - Template field: enter '{% raw %}{{payload.data}}{% endraw %}'. + Template field: enter '{{payload.data}}'. Output as: Plain text ``` + {% endraw %} + 9. Drag a Debug node to the right of the Template node and link them. 10. Show the debug messages, deploy the flow and click on the inject button. 11. A message will show in the debug window: diff --git a/source/_integrations/conversation.markdown b/source/_integrations/conversation.markdown index 16cdea1e7fb..1cb56d2bdd8 100644 --- a/source/_integrations/conversation.markdown +++ b/source/_integrations/conversation.markdown @@ -41,6 +41,8 @@ By default, it will support turning devices on and off. You can say things like Here is a simple example to be able to ask what the temperature in the living room is. +{% raw %} + ```yaml # Example configuration.yaml entry conversation: @@ -51,9 +53,11 @@ conversation: intent_script: LivingRoomTemperature: speech: - text: It is currently {% raw %}{{ states.sensor.temperature }}{% endraw %} degrees in the living room. + text: It is currently {{ states.sensor.temperature }} degrees in the living room. ``` +{% endraw %} + ## Adding advanced custom sentences Sentences can contain slots (marked with curly braces: `{name}`) and optional words (marked with square brackets: `[the]`). The values of slots will be passed on to the intent and are available inside the templates. diff --git a/source/_integrations/cover.command_line.markdown b/source/_integrations/cover.command_line.markdown index a6345c281f2..ed6a6749731 100644 --- a/source/_integrations/cover.command_line.markdown +++ b/source/_integrations/cover.command_line.markdown @@ -66,7 +66,7 @@ covers: description: Defines number of seconds for command timeout. required: false type: integer - default: 15 + default: 15 {% endconfiguration %} ## Examples @@ -75,6 +75,9 @@ In this section you find some real-life examples of how to use this sensor. ### Full configuration + +{% raw %} + ```yaml # Example configuration.yaml entry cover: @@ -85,11 +88,12 @@ cover: command_close: move_command down garage command_stop: move_command stop garage command_state: state_command garage - value_template: {% raw %}> + value_template: > {% if value == 'open' %} 100 {% elif value == 'closed' %} 0 {% endif %} - {% endraw %} ``` + +{% endraw %} diff --git a/source/_integrations/emoncms.markdown b/source/_integrations/emoncms.markdown index a9fd4ae6024..6dd50cf76d7 100644 --- a/source/_integrations/emoncms.markdown +++ b/source/_integrations/emoncms.markdown @@ -141,6 +141,8 @@ sensor: Use a `value_template` to add 1500 to the feed value for all specified feed IDs in `include_feed_id`. +{% raw %} + ```yaml # Example configuration.yaml entry sensor: @@ -149,12 +151,14 @@ sensor: url: https://emoncms.org scan_interval: 15 id: 1 - value_template: {% raw %}"{{ value | float + 1500 }}"{% endraw %} + value_template: "{{ value | float + 1500 }}" include_only_feed_id: - 107 - 106 ``` +{% endraw %} + Display feeds from the same Emoncms instance with 2 groups of feeds, different `scan_interval` and a different `unit_of_measurement`. ```yaml diff --git a/source/_integrations/enocean.markdown b/source/_integrations/enocean.markdown index 524ffd4fd8b..55f35ea72dd 100644 --- a/source/_integrations/enocean.markdown +++ b/source/_integrations/enocean.markdown @@ -123,6 +123,8 @@ EnOcean binary sensors have no state, they only generate 'button_pressed' events Sample automation to switch lights on and off: +{% raw %} + ```yaml # Example automation to turn lights on/off on button release automation: @@ -134,11 +136,13 @@ automation: id: [0xYY, 0xYY, 0xYY, 0xYY] pushed: 0 action: - service: "{% raw %}{% if trigger.event.data.onoff %} light.turn_on {% else %} light.turn_off {%endif %}{% endraw %}" + service: "{% if trigger.event.data.onoff %} light.turn_on {% else %} light.turn_off {%endif %}" data: - entity_id: "{% raw %}{% if trigger.event.data.which == 1 %} light.hall_left {% else %} light.hall_right {%endif %}{% endraw %}" + entity_id: "{% if trigger.event.data.which == 1 %} light.hall_left {% else %} light.hall_right {%endif %}" ``` +{% endraw %} + ## Light An EnOcean light can take many forms. Currently only one type has been tested: Eltako FUD61 dimmer. diff --git a/source/_integrations/feedreader.markdown b/source/_integrations/feedreader.markdown index e7f3379d720..5040a7e7ee2 100644 --- a/source/_integrations/feedreader.markdown +++ b/source/_integrations/feedreader.markdown @@ -65,6 +65,8 @@ automation: entity_id: script.my_action ``` +{% raw %} + ```yaml automation: - alias: Send notification of RSS feed title when updated @@ -75,10 +77,12 @@ automation: service: persistent_notification.create data: title: "New HA Podcast available" - message: {% raw %}"New Podcast available - {{ as_timestamp(now()) | timestamp_custom('%I:%M:%S %p %d%b%Y', true) }}"{% endraw %} - notification_id: {% raw %}"{{ trigger.event.data.title }}"{% endraw %} + message: "New Podcast available - {{ as_timestamp(now()) | timestamp_custom('%I:%M:%S %p %d%b%Y', true) }}" + notification_id: "{{ trigger.event.data.title }}" ``` +{% endraw %} + Any field under the `` tag in the feed can be used for example `trigger.event.data.content` will get the body of the feed entry. For more advanced use cases, a custom integration registering to the `feedreader` event type could be used instead: diff --git a/source/_integrations/file.markdown b/source/_integrations/file.markdown index 353866358b4..dce127c2542 100644 --- a/source/_integrations/file.markdown +++ b/source/_integrations/file.markdown @@ -99,12 +99,16 @@ Assuming that the log file contains multiple values formatted as JSON like shown This would require the following entry in the `configuration.yaml` file to extract the temperature: +{% raw %} + ```yaml # Example configuration.yaml entry sensor: - platform: file name: Temperature file_path: /home/user/.homeassistant/sensor.json - value_template: {% raw %}'{{ value_json.temperature }}'{% endraw %} + value_template: '{{ value_json.temperature }}' unit_of_measurement: "°C" ``` + +{% endraw %} diff --git a/source/_integrations/flic.markdown b/source/_integrations/flic.markdown index 464f0ed73a6..ea9423d5f37 100644 --- a/source/_integrations/flic.markdown +++ b/source/_integrations/flic.markdown @@ -91,6 +91,8 @@ Event data: To help detect and debug flic button clicks, you can use this automation that send a notification on very click type of every button. This example uses the [HTML5 push notification platform](/integrations/html5). Visit the [notification integration page](/integrations/notify/) for more information on setting up notifications. +{% raw %} + ```yaml automation: - alias: FLIC Html5 notify on every click @@ -101,9 +103,11 @@ automation: - service: notify.html5 data: title: "flic click" - message: {% raw %}"flic {{ trigger.event.data.button_name }} was {{ trigger.event.data.click_type }} clicked"{% endraw %} + message: "flic {{ trigger.event.data.button_name }} was {{ trigger.event.data.click_type }} clicked" ``` +{% endraw %} + ### Ignoring Click Types For some purposes it might make sense to exclude a specific click type from triggering click events. For example when ignoring double clicks, pressing the button twice fast results in two `single` instead of a `double` click event. This is very useful for applications where you want to click fast. diff --git a/source/_integrations/homematic.markdown b/source/_integrations/homematic.markdown index e8e2e433891..89b8bbf92eb 100644 --- a/source/_integrations/homematic.markdown +++ b/source/_integrations/homematic.markdown @@ -205,16 +205,21 @@ This does *not* affect the entities in Home Assistant. They all use their own co Most devices have, besides their state, additional attributes like their battery state or valve position. These can be accessed using templates in automations, or even as their own entities using the [template sensor](/integrations/template) component. Here's an example of a template sensor that exposes the valve position of a thermostat. + +{% raw %} + ```yaml sensor: - platform: template sensors: bedroom_valve: - value_template: "{% raw %}{{ state_attr('climate.leq123456', 'level') }}{% endraw %}" + value_template: "{{ state_attr('climate.leq123456', 'level') }}" entity_id: climate.leq123456 friendly_name: "Bedroom valve" ``` +{% endraw %} + ### Variables It is possible to read and set values of system variables you have setup on the CCU/Homegear. The supported types for setting values are float- and bool-variables. With the CCU a user with Admin-access is required. @@ -472,15 +477,19 @@ automation: 3. Set up a template sensor in Home Assistant, which contains the value of the system variable: + {% raw %} + ```yaml - platform: template sensors: v_last_reboot: - value_template: "{% raw %}{{ state_attr('homematic.ccu2', 'V_Last_Reboot') or '01.01.1970 00:00:00' }}{% endraw %}" + value_template: "{{ state_attr('homematic.ccu2', 'V_Last_Reboot') or '01.01.1970 00:00:00' }}" icon_template: "mdi:clock" entity_id: homematic.ccu2 ``` + {% endraw %} + 4. Set up an automation which calls *homematic.reconnect* whenever the sensor variable changes: ```yaml diff --git a/source/_integrations/hp_ilo.markdown b/source/_integrations/hp_ilo.markdown index 52704ea4ecc..b9a183ff93c 100644 --- a/source/_integrations/hp_ilo.markdown +++ b/source/_integrations/hp_ilo.markdown @@ -93,6 +93,8 @@ Valid sensor_types: In order to get two sensors reporting CPU fan speed and Ambient Inlet Temperature, as well as a dump of `server_health` on a HP Microserver Gen8, you could use the following in your `configuration.yaml` file +{% raw %} + ```yaml sensor: - platform: hp_ilo @@ -103,16 +105,17 @@ sensor: - name: CPU fanspeed sensor_type: server_health unit_of_measurement: "%" - value_template: '{% raw %}{{ ilo_data.fans["Fan 1"].speed[0] }}{% endraw %}' + value_template: '{{ ilo_data.fans["Fan 1"].speed[0] }}' - name: Inlet temperature sensor_type: server_health unit_of_measurement: "°C" - value_template: '{% raw %}{{ ilo_data.temperature["01-Inlet Ambient"].currentreading[0] }}{% endraw %}' + value_template: '{{ ilo_data.temperature["01-Inlet Ambient"].currentreading[0] }}' - name: Server Health sensor_type: server_health - ``` +{% endraw %} +

diff --git a/source/_integrations/influxdb.markdown b/source/_integrations/influxdb.markdown index abc8a21fa24..c14089a4fce 100644 --- a/source/_integrations/influxdb.markdown +++ b/source/_integrations/influxdb.markdown @@ -503,6 +503,8 @@ The example configuration entry below create two request to your local InfluxDB - `select last(value) as value from "°C" where "name" = "foo"` - `select min(tmp) as value from "%" where "entity_id" = ''salon'' and time > now() - 1h` +{% raw %} + ```yaml sensor: platform: influxdb @@ -513,7 +515,7 @@ username: home-assistant queries: - name: last value of foo unit_of_measurement: °C - value_template: '{% raw %}{{ value | round(1) }}{% endraw %}' + value_template: '{{ value | round(1) }}' group_function: last where: '"name" = ''foo''' measurement: '"°C"' @@ -521,7 +523,7 @@ username: home-assistant database: db1 - name: Min for last hour unit_of_measurement: "%" - value_template: '{% raw %}{{ value | round(1) }}{% endraw %}' + value_template: '{{ value | round(1) }}' group_function: min where: '"entity_id" = ''salon'' and time > now() - 1h' measurement: '"%"' @@ -529,8 +531,12 @@ username: home-assistant database: db2 ``` +{% endraw %} + ### Full configuration for 2.xx installations +{% raw %} + ```yaml sensor: - platform: influxdb @@ -542,9 +548,9 @@ sensor: - range_start: "-1d" name: "How long have I been here" query: > - filter(fn: (r) => r._domain == "person" and r._entity_id == "me" and r._value != "{% raw %} {{ states('person.me') }} {% endraw %}") + filter(fn: (r) => r._domain == "person" and r._entity_id == "me" and r._value != "{{ states('person.me') }}") |> map(fn: (r) => ({ _value: r._time })) - value_template: "{% raw %} {{ relative_time(strptime(value, '%Y-%m-%d %H:%M:%S %Z')) }} {% endraw %}" + value_template: "{{ relative_time(strptime(value, '%Y-%m-%d %H:%M:%S %Z')) }}" - range_start: "-1d" name: "Cost of my house today across all power sensor" query: > @@ -553,7 +559,7 @@ sensor: |> sort(columns: ["_time"], desc: false) |> integral(unit: 5s, column: "_value") imports: regexp - value_template: "{% raw %} {{ value|float / 24.0 / 1000.0 * states('sensor.current_cost_per_kwh')|float }} {% endraw %}" + value_template: "{{ value|float / 24.0 / 1000.0 * states('sensor.current_cost_per_kwh')|float }}" - range_start: "-1d" bucket: Glances Bucket name: "Average CPU temp today" @@ -561,6 +567,8 @@ sensor: group_function: mean ``` +{% endraw %} + Note that when working with Flux queries, the resultset is broken into tables, you can see how this works in the Data Explorer of the UI. If you are operating on data created by the InfluxDB history component, this means by default, you will have a table for each entity and each attribute of each entity (other then `unit_of_measurement` and any others you promoted to tags). This is a lot more tables compared to 1.xx queries, where you essentially had one table per `unit_of_measurement` across all entities. You can still create aggregate metrics across multiple sensors though. As you can see in the example above, a good way to do this is with the [keep](https://v2.docs.influxdata.com/v2.0/reference/flux/stdlib/built-in/transformations/keep/) or [drop](https://v2.docs.influxdata.com/v2.0/reference/flux/stdlib/built-in/transformations/drop/) filters. When you remove key columns Influx merges tables, allowing you to make many tables that share a schema for `_value` into one. diff --git a/source/_integrations/intent_script.markdown b/source/_integrations/intent_script.markdown index ca584851e58..408434dd4f8 100644 --- a/source/_integrations/intent_script.markdown +++ b/source/_integrations/intent_script.markdown @@ -11,18 +11,22 @@ ha_iot_class: The `intent_script` integration allows users to configure actions and responses to intents. Intents can be fired by any integration that supports it. Examples are [Alexa](/integrations/alexa/) (Amazon Echo), [Dialogflow](/integrations/dialogflow/) (Google Assistant) and [Snips](/integrations/snips/). +{% raw %} + ```yaml # Example configuration.yaml entry intent_script: GetTemperature: # Intent type speech: - text: We have {% raw %}{{ states.sensor.temperature }}{% endraw %} degrees + text: We have {{ states.sensor.temperature }} degrees action: service: notify.notify data: message: Hello from an intent! ``` +{% endraw %} + Inside an intent we can define these variables: {% configuration %} diff --git a/source/_integrations/light.mqtt.markdown b/source/_integrations/light.mqtt.markdown index cc90c43854c..bf6abbdc195 100644 --- a/source/_integrations/light.mqtt.markdown +++ b/source/_integrations/light.mqtt.markdown @@ -936,6 +936,8 @@ In this section you find some real-life examples of how to use this light. For a simple string payload with the format `state,brightness,r-g-b` (e.g., `on,255,255-255-255`), add the following to your `configuration.yaml` file: +{% raw %} + ```yaml # Example configuration.yaml entry light: @@ -943,19 +945,23 @@ light: schema: template command_topic: "home/rgb1/set" state_topic: "home/rgb1/status" - command_on_template: "{% raw %}on,{{ brightness|d }},{{ red|d }}-{{ green|d }}-{{ blue|d }}{% endraw %}" + command_on_template: "on,{{ brightness|d }},{{ red|d }}-{{ green|d }}-{{ blue|d }}" command_off_template: "off" - state_template: "{% raw %}{{ value.split(',')[0] }}{% endraw %}" # must return `on` or `off` - brightness_template: "{% raw %}{{ value.split(',')[1] }}{% endraw %}" - red_template: "{% raw %}{{ value.split(',')[2].split('-')[0] }}{% endraw %}" - green_template: "{% raw %}{{ value.split(',')[2].split('-')[1] }}{% endraw %}" - blue_template: "{% raw %}{{ value.split(',')[2].split('-')[2] }}{% endraw %}" + state_template: "{{ value.split(',')[0] }}" # must return `on` or `off` + brightness_template: "{{ value.split(',')[1] }}" + red_template: "{{ value.split(',')[2].split('-')[0] }}" + green_template: "{{ value.split(',')[2].split('-')[1] }}" + blue_template: "{{ value.split(',')[2].split('-')[2] }}" ``` +{% endraw %} + ### JSON payload For a JSON payload with the format `{"state": "on", "brightness": 255, "color": [255, 255, 255], "effect": "rainbow"}`, add the following to your `configuration.yaml` file: +{% raw %} + ```yaml # Example configuration.yaml entry light: @@ -966,7 +972,7 @@ light: - colorloop command_topic: "home/rgb1/set" state_topic: "home/rgb1/status" - command_on_template: >{% raw %} + command_on_template: > {"state": "on" {%- if brightness is defined -%} , "brightness": {{ brightness }} @@ -977,16 +983,18 @@ light: {%- if effect is defined -%} , "effect": "{{ effect }}" {%- endif -%} - }{% endraw %} + } command_off_template: '{"state": "off"}' - state_template: '{% raw %}{{ value_json.state }}{% endraw %}' - brightness_template: '{% raw %}{{ value_json.brightness }}{% endraw %}' - red_template: '{% raw %}{{ value_json.color[0] }}{% endraw %}' - green_template: '{% raw %}{{ value_json.color[1] }}{% endraw %}' - blue_template: '{% raw %}{{ value_json.color[2] }}{% endraw %}' - effect_template: '{% raw %}{{ value_json.effect }}{% endraw %}' + state_template: '{{ value_json.state }}' + brightness_template: '{{ value_json.brightness }}' + red_template: '{{ value_json.color[0] }}' + green_template: '{{ value_json.color[1] }}' + blue_template: '{{ value_json.color[2] }}' + effect_template: '{{ value_json.effect }}' ``` +{% endraw %} + ### Template schema - No brightness or color support If you don't want brightness, color or effect support, just omit the corresponding configuration sections. diff --git a/source/_integrations/london_air.markdown b/source/_integrations/london_air.markdown index 4f93deb4fab..d4a0a9ced86 100644 --- a/source/_integrations/london_air.markdown +++ b/source/_integrations/london_air.markdown @@ -58,17 +58,21 @@ locations: To explore the data available within the `data` attribute of a sensor use the `dev-template` tool on the Home Assistant frontend. `data` contains a list of monitored sites, where the number of monitored sites are given by the `sites` attribute. If a sensor has four sites, access the fourth site by indexing the list of sites using data[3]. Each site is a dictionary with multiple fields, with entries for the `latitude` and `longitude` of that site, a `pollution_status`, `site_code`, `site_name` and `site_type`. The field `number_of_pollutants` states how many pollutants are monitored (of the possible six) and the field `pollutants` returns a list with data for each pollutant. To access the first pollutant in the list for site zero use `attributes.data[0].pollutants[0]`. Each entry in `pollutants` is a dictionary with fields for the pollutant `code`, `description`, `index`, `quality` and a `summary`. [Template sensors](/integrations/template) can then be added to display these attributes, for example: +{% raw %} + ```yaml # Example template sensors - platform: template sensors: updated: friendly_name: "Updated" - value_template: {% raw %}'{{state_attr('sensor.merton', 'updated')}}'{% endraw %} + value_template: '{{state_attr('sensor.merton', 'updated')}}' merton_pm10: friendly_name: "Merton PM10" - value_template: {% raw %}'{{state_attr('sensor.merton', 'data')[0].pollutants[0].summary}}'{% endraw %} + value_template: '{{state_attr('sensor.merton', 'data')[0].pollutants[0].summary}}' westminster_s02: friendly_name: "Westminster S02" - value_template: {% raw %}'{{state_attr('sensor.westminster', 'data')[0].pollutants[3].summary}}'{% endraw %} + value_template: '{{state_attr('sensor.westminster', 'data')[0].pollutants[3].summary}}' ``` + +{% endraw %} diff --git a/source/_integrations/notify.markdown b/source/_integrations/notify.markdown index 1a0aee0d2be..929b62be4fe 100644 --- a/source/_integrations/notify.markdown +++ b/source/_integrations/notify.markdown @@ -42,17 +42,25 @@ action: After you setup a [notifier](/integrations/#notifications) a simple way to test if you have set up your notify platform correctly, is to open **Developer Tools** from the sidebar and then select the **Services** tab. Choose your service from the **Service** dropdown menu, enter the sample below into the **Service Data** field, and press the **CALL SERVICE** button. +{% raw %} + ```json { - "message": "The sun is {% raw %}{% if is_state('sun.sun', 'above_horizon') %}up{% else %}down{% endif %}{% endraw %}!" + "message": "The sun is {% if is_state('sun.sun', 'above_horizon') %}up{% else %}down{% endif %}!" } ``` +{% endraw %} + The automation equivalent would be: +{% raw %} + ```yaml action: service: notify.notify data: - message: "The sun is {% raw %}{% if is_state('sun.sun', 'above_horizon') %}up{% else %}down{% endif %}{% endraw %}!" + message: "The sun is {% if is_state('sun.sun', 'above_horizon') %}up{% else %}down{% endif %}!" ``` + +{% endraw %} diff --git a/source/_integrations/nuimo_controller.markdown b/source/_integrations/nuimo_controller.markdown index d88b11af7c8..c4c023b6f70 100644 --- a/source/_integrations/nuimo_controller.markdown +++ b/source/_integrations/nuimo_controller.markdown @@ -31,6 +31,8 @@ name: Example for testing rotation value and sending to the LED matrix: +{% raw %} + ```yaml automation Nuimo_rotate_right: trigger: @@ -40,7 +42,7 @@ automation Nuimo_rotate_right: type: ROTATE condition: condition: template - value_template: {% raw %}'{{ trigger.event.data.value > 100 }}'{% endraw %} + value_template: '{{ trigger.event.data.value > 100 }}' action: service: nuimo_controller.led_matrix data: @@ -57,6 +59,8 @@ automation Nuimo_rotate_right: interval: 0.5 ``` +{% endraw %} + Troubleshooting: - use `hcitool lescan` to see the mac address of your device diff --git a/source/_integrations/rest.markdown b/source/_integrations/rest.markdown index bcd3bdc8100..3ef18c4abc5 100644 --- a/source/_integrations/rest.markdown +++ b/source/_integrations/rest.markdown @@ -146,42 +146,54 @@ In this section you find some real-life examples of how to use this sensor. You can find your external IP address using the service [JSON Test](https://www.jsontest.com/) at their [http://ip.jsontest.com/](http://ip.jsontest.com/) URL. +{% raw %} + ```yaml sensor: - platform: rest resource: http://ip.jsontest.com name: External IP - value_template: '{% raw %}{{ value_json.ip }}{% endraw %}' + value_template: '{{ value_json.ip }}' ``` +{% endraw %} + ### Single value from a local Glances instance The [glances](/integrations/glances) sensor is doing the exact same thing for all exposed values. +{% raw %} + ```yaml sensor: - platform: rest resource: http://IP_ADRRESS:61208/api/2/mem/used name: Used mem - value_template: '{% raw %}{{ value_json.used| multiply(0.000000954) | round(0) }}{% endraw %}' + value_template: '{{ value_json.used| multiply(0.000000954) | round(0) }}' unit_of_measurement: MB ``` +{% endraw %} + ### Value from another Home Assistant instance The Home Assistant [API](/developers/rest_api/) exposes the data from your attached sensors. If you are running multiple Home Assistant instances which are not [connected](/developers/architecture/#multiple-connected-instances) you can still get information from them. If the Home Assistant instance in the resource variable is protected by an API password, you can append `?api_password=YOUR_PASSWORD` to the resource URL to authenticate or use `headers:`. +{% raw %} + ```yaml sensor: - platform: rest resource: http://IP_ADDRESS:8123/api/states/sensor.weather_temperature name: Temperature - value_template: {% raw %}'{{ value_json.state }}'{% endraw %} + value_template: '{{ value_json.state }}' unit_of_measurement: "°C" ``` +{% endraw %} + ### Accessing an HTTP authentication protected endpoint The REST sensor supports HTTP authentication and customized headers. @@ -229,6 +241,8 @@ my_sensor_secret_token: Bearer gh_DHQIXKVf6Pr4H8Yqz8uhApk_mnV6Zje6Pr4H8Yqz8A8nCx This sample is very similar to the [`updater`](/integrations/updater/) integration but the information is received from GitHub. +{% raw %} + ```yaml sensor: - platform: rest @@ -236,13 +250,15 @@ sensor: username: YOUR_GITHUB_USERNAME password: YOUR_GITHUB_ACCESS_TOKEN authentication: basic - value_template: '{% raw %}{{ value_json.tag_name }}{% endraw %}' + value_template: '{{ value_json.tag_name }}' headers: Accept: application/vnd.github.v3+json Content-Type: application/json User-Agent: Home Assistant REST sensor ``` +{% endraw %} + ### Fetch multiple JSON values and present them as attributes [JSON Test](https://www.jsontest.com/) returns the current time, date and milliseconds since epoch from [http://date.jsontest.com/](http://date.jsontest.com/). diff --git a/source/_integrations/rss_feed_template.markdown b/source/_integrations/rss_feed_template.markdown index a09ce42f236..8fb34685106 100644 --- a/source/_integrations/rss_feed_template.markdown +++ b/source/_integrations/rss_feed_template.markdown @@ -13,6 +13,8 @@ The `rss_feed_template` integration can export any information from Home Assista For example, on Android, the app "Simple RSS Widget" can be used to display temperatures on the home screen. +{% raw %} + ```yaml # Example configuration.yaml entry rss_feed_template: @@ -20,12 +22,14 @@ rss_feed_template: # Example: https://localhost:8123/api/rss_template/garden garden: requires_api_password: false - title: "Garden {% raw %}{{ as_timestamp(now())|timestamp_custom('%H:%M', True) }}{% endraw %}" + title: "Garden {{ as_timestamp(now())|timestamp_custom('%H:%M', True) }}" items: - title: "Outside temperature" - description: "{% raw %}{% if is_state('sensor.temp_outside','unknown') %}---{% else %}{{states('sensor.temp_outside')}} °C{% endif %}{% endraw %}" + description: "{% if is_state('sensor.temp_outside','unknown') %}---{% else %}{{states('sensor.temp_outside')}} °C{% endif %}" ``` +{% endraw %} + {% configuration %} requires_api_password: description: If true and an API password is set, the password must be passed via '?api_password=...' parameter. diff --git a/source/_integrations/script.markdown b/source/_integrations/script.markdown index a2dfa5b5ff4..fff9c7a9643 100644 --- a/source/_integrations/script.markdown +++ b/source/_integrations/script.markdown @@ -195,6 +195,8 @@ automation: Using the variables in the script requires the use of templates: +{% raw %} + ```yaml # Example configuration.yaml entry script: @@ -213,10 +215,12 @@ script: state: "on" - service: notify.pushover data: - title: "{% raw %}{{ title }}{% endraw %}" - message: "{% raw %}{{ message }}{% endraw %}" + title: "{{ title }}" + message: "{{ message }}" ``` +{% endraw %} + ### Waiting for Script to Complete When calling a script "directly" (e.g., `script.NAME`) the calling script will wait for the called script to finish. diff --git a/source/_integrations/spc.markdown b/source/_integrations/spc.markdown index 7512750a979..875d68f7518 100644 --- a/source/_integrations/spc.markdown +++ b/source/_integrations/spc.markdown @@ -46,6 +46,8 @@ The `spc` alarm control panel platform allows you to control your [Vanderbilt SP The `changed_by` attribute enables one to be able to take different actions depending on who armed/disarmed the alarm in [automation](/getting-started/automation/). +{% raw %} + ```yaml automation: - alias: Alarm status changed @@ -56,11 +58,13 @@ automation: - service: notify.notify data: message: > - {% raw %}Alarm changed from {{ trigger.from_state.state }} + Alarm changed from {{ trigger.from_state.state }} to {{ trigger.to_state.state }} - by {{ trigger.to_state.attributes.changed_by }}{% endraw %} + by {{ trigger.to_state.attributes.changed_by }} ``` +{% endraw %} + ## Binary Sensor The `spc` platform allows you to get data from your [Vanderbilt SPC](https://www.spcsupportinfo.com/SPCConnectPro/) binary sensors from within Home Assistant. diff --git a/source/_integrations/switch.command_line.markdown b/source/_integrations/switch.command_line.markdown index cdc92ccfe5d..a521bee6098 100644 --- a/source/_integrations/switch.command_line.markdown +++ b/source/_integrations/switch.command_line.markdown @@ -88,6 +88,8 @@ The example below is doing the same as the The command line tool [`curl`](https://curl.haxx.se/) is used to toggle a pin which is controllable through REST. +{% raw %} + ```yaml # Example configuration.yaml entry switch: @@ -97,10 +99,12 @@ switch: command_on: "/usr/bin/curl -X GET http://192.168.1.10/digital/4/1" command_off: "/usr/bin/curl -X GET http://192.168.1.10/digital/4/0" command_state: "/usr/bin/curl -X GET http://192.168.1.10/digital/4" - value_template: '{% raw %}{{ value == "1" }}{% endraw %}' + value_template: '{{ value == "1" }}' friendly_name: Kitchen Lightswitch ``` +{% endraw %} + Given this example, in the UI one would see the `friendly_name` of "Kitchen Light". However, the `identifier` is `arest_pin_four`, making the `entity_id` `switch.arest_pin_four`, which is what one would use in @@ -145,6 +149,8 @@ Commands ([Source](https://www.iltucci.com/blog/wp-content/uploads/2018/12/Fosca This switch supports statecmd, which checks the current state of motion detection. +{% raw %} + ```yaml # Example configuration.yaml entry switch: @@ -154,8 +160,10 @@ switch: command_on: 'curl -k "https://ipaddress:443/cgi-bin/CGIProxy.fcgi?cmd=setMotionDetectConfig&isEnable=1&usr=admin&pwd=password"' command_off: 'curl -k "https://ipaddress:443/cgi-bin/CGIProxy.fcgi?cmd=setMotionDetectConfig&isEnable=0&usr=admin&pwd=password"' command_state: 'curl -k --silent "https://ipaddress:443/cgi-bin/CGIProxy.fcgi?cmd=getMotionDetectConfig&usr=admin&pwd=password" | grep -oP "(?<=isEnable>).*?(?=)"' - value_template: {% raw %}'{{ value == "1" }}'{% endraw %} + value_template: '{{ value == "1" }}' ``` +{% endraw %} + - Replace admin and password with an "Admin" privileged Foscam user - Replace ipaddress with the local IP address of your Foscam diff --git a/source/_integrations/tcp.markdown b/source/_integrations/tcp.markdown index b57289c0a1e..e77897fc665 100644 --- a/source/_integrations/tcp.markdown +++ b/source/_integrations/tcp.markdown @@ -81,6 +81,8 @@ $ echo "r WaterPressure" | nc 10.0.0.127 8888 You will notice that the output from the service is not just a single value (it contains ";ok" as well). To grab the value we're interested in, we can use a Jinja2 template. The response received is injected into the template as the `value` variable. To use this value within Home Assistant, use the following configuration: +{% raw %} + ```yaml sensor: # Example configuration.yaml entry @@ -90,10 +92,12 @@ sensor: port: 8888 timeout: 5 payload: "r WaterPressure\n" - value_template: "{% raw %}{{ value.split(';')[0] }}{% endraw %}" + value_template: "{{ value.split(';')[0] }}" unit_of_measurement: Bar ``` +{% endraw %} + #### hddtemp The tool `hddtemp` collects the temperature of your hard disks. @@ -115,6 +119,8 @@ Escape character is '^]'. The entry for the `configuration.yaml` file for a `hddtemp` sensor could look like the example below. +{% raw %} + ```yaml sensor: # Example configuration.yaml entry @@ -124,10 +130,13 @@ sensor: port: 7634 timeout: 5 payload: "\n" - value_template: "{% raw %}{{ value.split('|')[3] }}{% endraw %}" + value_template: "{{ value.split('|')[3] }}" unit_of_measurement: "°C" ``` +{% endraw %} + + ## Binary Sensor The TCP Binary Sensor is a type of [TCP Sensor](#sensor) which is either "off" or "on". In order to use this sensor type, in addition to the configuration for the TCP Sensor, you must supply a `value_on` value to represent what is returned when the device is turned on. diff --git a/source/_integrations/tensorflow.markdown b/source/_integrations/tensorflow.markdown index e887ec83bda..86636ab9d5f 100644 --- a/source/_integrations/tensorflow.markdown +++ b/source/_integrations/tensorflow.markdown @@ -158,6 +158,8 @@ model: `categories` can also be defined as dictionary providing an `area` for each category as seen in the advanced configuration below: +{% raw %} + ```yaml # Example advanced configuration.yaml entry image_processing: @@ -166,8 +168,8 @@ image_processing: - entity_id: camera.driveway - entity_id: camera.backyard file_out: - - "/tmp/{% raw %}{{ camera_entity.split('.')[1] }}{% endraw %}_latest.jpg" - - "/tmp/{% raw %}{{ camera_entity.split('.')[1] }}_{{ now().strftime('%Y%m%d_%H%M%S') }}{% endraw %}.jpg" + - "/tmp/{{ camera_entity.split('.')[1] }}_latest.jpg" + - "/tmp/{{ camera_entity.split('.')[1] }}_{{ now().strftime('%Y%m%d_%H%M%S') }}.jpg" model: graph: /config/tensorflow/models/efficientdet_d0_coco17_tpu-32/ categories: @@ -181,6 +183,8 @@ image_processing: - truck ``` +{% endraw %} + ## Optimizing resources [Image processing components](/integrations/image_processing/) process the image from a camera at a fixed period given by the `scan_interval`. This leads to excessive processing if the image on the camera hasn't changed, as the default `scan_interval` is 10 seconds. You can override this by adding to your configuration `scan_interval: 10000` (setting the interval to 10,000 seconds), and then call the `image_processing.scan` service when you actually want to perform processing. diff --git a/source/_integrations/tts.markdown b/source/_integrations/tts.markdown index f48ccf11c62..06a1a554970 100644 --- a/source/_integrations/tts.markdown +++ b/source/_integrations/tts.markdown @@ -134,13 +134,17 @@ data: With a template: +{% raw %} + ```yaml service: tts.google_translate_say data: - message: "Temperature is {% raw %}{{states('sensor.temperature')}}{% endraw %}." + message: "Temperature is {{states('sensor.temperature')}}." cache: false ``` +{% endraw %} + ## Cache The integration has two caches. Both caches can be controlled with the `cache` option in the platform configuration or the service call `say`. A long time cache will be located on the file system. The in-memory cache for fast responses to media players will be auto-cleaned after a short period. diff --git a/source/_integrations/uk_transport.markdown b/source/_integrations/uk_transport.markdown index de6455acf5a..fd5a805f887 100644 --- a/source/_integrations/uk_transport.markdown +++ b/source/_integrations/uk_transport.markdown @@ -135,24 +135,28 @@ sensor: And the template sensor for viewing the next bus attributes. +{% raw %} + ```yaml # Example configuration.yaml entry for a template sensor to access the attributes of the next departing bus. - platform: template sensors: next_bus_route: friendly_name: "Next bus route" - value_template: {% raw %}"{{state_attr('sensor.next_bus_to_wantage', 'next_buses')[0].route}}"{% endraw %} + value_template: "{{state_attr('sensor.next_bus_to_wantage', 'next_buses')[0].route}}" next_bus_direction: friendly_name: "Next bus direction" - value_template: {% raw %}"{{state_attr('sensor.next_bus_to_wantage', 'next_buses')[0].direction}}"{% endraw %} + value_template: "{{state_attr('sensor.next_bus_to_wantage', 'next_buses')[0].direction}}" next_bus_scheduled: friendly_name: "Next bus scheduled" - value_template: {% raw %}"{{state_attr('sensor.next_bus_to_wantage', 'next_buses')[0].scheduled}}"{% endraw %} + value_template: "{{state_attr('sensor.next_bus_to_wantage', 'next_buses')[0].scheduled}}" next_bus_estimated: friendly_name: "Next bus estimated" - value_template: {% raw %}"{{state_attr('sensor.next_bus_to_wantage', 'next_buses')[0].estimated}}"{% endraw %} + value_template: "{{state_attr('sensor.next_bus_to_wantage', 'next_buses')[0].estimated}}" ``` +{% endraw %} + ## Managing API requests If you wish to manage the rate of API requests (e.g., to disable requests when you aren't interested in travel, so that you can request updates more frequently when you do travel) set a really long `scan_interval` in the configuration options, and use the service `homeassistant.update_entity` to request the update of an entity, rather than waiting for the next scheduled update. diff --git a/source/_integrations/xmpp.markdown b/source/_integrations/xmpp.markdown index f213113c352..318e83dc452 100644 --- a/source/_integrations/xmpp.markdown +++ b/source/_integrations/xmpp.markdown @@ -164,6 +164,8 @@ Number 4 sends a text-file, retrieved from Github, renamed to `Hass_Cheatsheet.t Number 5 sends an image retrieved from a URL, and an additional text message with `title` and `message`. +{% raw %} + ```yaml # Example script.yaml entry 5_send_jabber_message_with_image_and_text: @@ -172,13 +174,17 @@ Number 5 sends an image retrieved from a URL, and an additional text message wit - service: notify.jabber data: title: "The Time is now" - message: "{% raw %} {{ {% endraw %}now(){% raw %} }} {% endraw %}, templating works as well..." + message: "{{ now() }}, templating works as well..." data: url: "https://github.com/home-assistant/home-assistant.io/raw/next/source/images/favicon-192x192.png" ``` +{% endraw %} + Number 6 sends an image from a templated URL. +{% raw %} + ```yaml # Example script.yaml entry 6_send_jabber_message_with_image_from_url_template: @@ -189,9 +195,11 @@ Number 6 sends an image from a templated URL. title: "" message: "" data: - url_template: "https://www.foto-webcam.eu/webcam/dornbirn/{% raw %}{{ now().year }}/{{ '%02d' % now().month }}/{{ '%02d' % now().day }}/{{ '%02d' % now().hour }}{{ (now().minute + 58) % 60 // 10}}{% endraw %}0_hd.jpg" + url_template: "https://www.foto-webcam.eu/webcam/dornbirn/{{ now().year }}/{{ '%02d' % now().month }}/{{ '%02d' % now().day }}/{{ '%02d' % now().hour }}{{ (now().minute + 58) % 60 // 10}}0_hd.jpg" ``` +{% endraw %} + The possible source of a file is prioritized and only one will be picked up. `url_template` has the hightest priority; next is `url` then `path_template` and finally if none of them are defined `path` would be used. `path` will be used to eliminate file extension guessing for unknown URL downloads. Only the file extension will be left, as Home Assistant changes the filename to a random string for added privacy. To find out more about notifications, please see the [getting started with automation page](/getting-started/automation/). diff --git a/source/_posts/2015-12-20-amazon-echo-icloud-and-templates.markdown b/source/_posts/2015-12-20-amazon-echo-icloud-and-templates.markdown index 4e5a3f5f93e..a18b3bbfd54 100644 --- a/source/_posts/2015-12-20-amazon-echo-icloud-and-templates.markdown +++ b/source/_posts/2015-12-20-amazon-echo-icloud-and-templates.markdown @@ -59,10 +59,14 @@ Alrighty, it's time for Home Assistant 0.10. A lot amazing things have changed a This release introduces templates. This will allow you to parse data before it gets processed or create messages for notifications on the fly based on data within Home Assistant. The notification component and the new Alexa/Amazon Echo component are both using the new template functionality to render responses. A template editor has been added to the developer tool section in the app so you can get instant feedback if your templates are working or not. +{% raw %} + ```text -The temperature at home is {% raw %}{{ states('sensor.temperature') }}{% endraw %}. +The temperature at home is {{ states('sensor.temperature') }}. ``` +{% endraw %} + More information and examples can be found in the [template documentation][Template]. ### Breaking changes diff --git a/source/_posts/2016-05-26-ibeacons-how-to-track-things-that-cant-track-themselves-part-ii.markdown b/source/_posts/2016-05-26-ibeacons-how-to-track-things-that-cant-track-themselves-part-ii.markdown index 8788212344d..50a6bffed20 100644 --- a/source/_posts/2016-05-26-ibeacons-how-to-track-things-that-cant-track-themselves-part-ii.markdown +++ b/source/_posts/2016-05-26-ibeacons-how-to-track-things-that-cant-track-themselves-part-ii.markdown @@ -77,15 +77,17 @@ automation: Or warn you if you leave your keys behind +{% raw %} + ```yaml automation: - alias: 'Forgotten keys' trigger: platform: template - value_template: '{% raw %}{{ states.device_tracker.greg_gregphone.state != states.device_tracker.beacon_keys.state}}{% endraw %}' + value_template: '{{ states.device_tracker.greg_gregphone.state != states.device_tracker.beacon_keys.state}}' condition: condition: template - value_template: '{% raw %}{{ states.device_tracker.greg_gregphone.state != "home" }}{% endraw %}' + value_template: '{{ states.device_tracker.greg_gregphone.state != "home" }}' action: service: script.turn_on entity_id: script.send_key_alert @@ -93,7 +95,7 @@ automation: - alias: 'Forgotten keys - cancel' trigger: platform: template - value_template: '{% raw %}{{ states.device_tracker.greg_gregphone.state == states.device_tracker.beacon_keys.state }}{% endraw %}' + value_template: '{{ states.device_tracker.greg_gregphone.state == states.device_tracker.beacon_keys.state }}' condition: - condition: state entity_id: script.send_key_alert @@ -103,6 +105,8 @@ automation: entity_id: script.send_key_alert ``` +{% endraw %} + ```yaml script: send_key_alert: diff --git a/source/_posts/2016-10-08-hassbian-rest-digital-ocean.markdown b/source/_posts/2016-10-08-hassbian-rest-digital-ocean.markdown index fbe4f362187..b3d262fd0a3 100644 --- a/source/_posts/2016-10-08-hassbian-rest-digital-ocean.markdown +++ b/source/_posts/2016-10-08-hassbian-rest-digital-ocean.markdown @@ -42,6 +42,8 @@ There was a lot of work done on our implementation which are working with RESTfu The [REST sensor][rest-sensor] supports now HTTP authentication (basic and digest) and custom headers. This will allow you to access resources which are protected. This sample sensor will access GitHub and retrieve the latest release number while by-passing the rate limit for non-authenticated requests. +{% raw %} + ```yaml sensor - platform: rest @@ -49,13 +51,15 @@ sensor username: YOUR_GITHUB_USERNAME password: YOUR_GITHUB_ACCESS_TOKEN authentication: basic - value_template: "{% raw %}{{ value_json.tag_name }}{% endraw %}" + value_template: "{{ value_json.tag_name }}" headers: Accept: application/vnd.github.v3+json Content-Type: application/json User-Agent: Home Assistant REST sensor ``` +{% endraw %} + ### Misc - GitHub released with a recent update a review feature. This will give you more control over your comments while you review an open Pull Request.