diff --git a/source/_integrations/alert.markdown b/source/_integrations/alert.markdown index de89f3a3ff6..af22b2763e2 100644 --- a/source/_integrations/alert.markdown +++ b/source/_integrations/alert.markdown @@ -156,6 +156,7 @@ than one input. For all of these situations, it is best to use the alert in conjunction with a `Template Binary Sensor`. The following example does that. {% raw %} + ```yaml binary_sensor: - platform: template @@ -173,6 +174,7 @@ alert: - ryans_phone - kristens_phone ``` + {% endraw %} This example will begin firing as soon as the entity `sensor.motion`'s `battery` @@ -219,6 +221,7 @@ The following will show for a plant how to include the problem `attribute` of the entity. {% raw %} + ```yaml # Example configuration.yaml entry alert: @@ -235,6 +238,7 @@ alert: - ryans_phone - kristens_phone ``` + {% endraw %} The resulting message could be `Plant Officeplant needs help (moisture low)`. diff --git a/source/_integrations/alexa.flash_briefings.markdown b/source/_integrations/alexa.flash_briefings.markdown index 966af47af26..146cc641ef1 100644 --- a/source/_integrations/alexa.flash_briefings.markdown +++ b/source/_integrations/alexa.flash_briefings.markdown @@ -29,8 +29,10 @@ You can use [templates] for the `title`, `audio`, `text` and `display_url` confi Here's an example configuration of a Flash briefing skill that will tell you who is at home: +{% raw %} + ```yaml -{% raw %}# Example configuration.yaml entry +# Example configuration.yaml entry alexa: flash_briefings: password: YOUR_PASSWORD @@ -43,9 +45,11 @@ alexa: {%- else -%} Anne Therese is at {{ states("device_tracker.anne_therese") }} and Paulus is at {{ states("device_tracker.paulus") }} - {% endif %}{% endraw %} + {% endif %} ``` +{% endraw %} + You can add multiple items for a feed if you want. The Amazon required UID and timestamp will be randomly generated at startup and change at every restart of Home Assistant. Please refer to the [Amazon documentation][flash-briefing-api-docs] for more information about allowed configuration parameters and formats. diff --git a/source/_integrations/alexa.intent.markdown b/source/_integrations/alexa.intent.markdown index 67c651913cb..eb6fb562bfd 100644 --- a/source/_integrations/alexa.intent.markdown +++ b/source/_integrations/alexa.intent.markdown @@ -303,27 +303,30 @@ In the examples above, we told Alexa to say `OK` when she successfully completed First create a file called `alexa_confirm.yaml` with something like the following in it (go on, be creative!): +{% raw %} + ```text -{% raw %} > - {{ [ - "OK", - "Sure", - "If you insist", - "Done", - "No worries", - "I can do that", - "Leave it to me", - "Consider it done", - "As you wish", - "By your command", - "Affirmative", - "Yes oh revered one", - "I will", - "As you decree, so shall it be", - "No Problem" - ] | random }} {% endraw %} +{{ [ + "OK", + "Sure", + "If you insist", + "Done", + "No worries", + "I can do that", + "Leave it to me", + "Consider it done", + "As you wish", + "By your command", + "Affirmative", + "Yes oh revered one", + "I will", + "As you decree, so shall it be", + "No Problem" +] | random }} ``` +{% endraw %} + Then, wherever you would put some simple text for a response like `OK`, replace it with a reference to the file so that: ```yaml diff --git a/source/_integrations/alexa.smart_home.markdown b/source/_integrations/alexa.smart_home.markdown index 48430e16079..980d3fdebac 100644 --- a/source/_integrations/alexa.smart_home.markdown +++ b/source/_integrations/alexa.smart_home.markdown @@ -368,8 +368,6 @@ The `endpoint`, `client_id` and `client_secret` are optional, and are only requi By default, no entity will be excluded. To limit which entities are being exposed to Alexa, you can use the `filter` parameter. Keep in mind that only [supported platforms](#supported-platforms) can be added. -{% raw %} - ```yaml # Example filter to include specified domains and exclude specified entities alexa: @@ -384,8 +382,6 @@ alexa: - light.kitchen_light ``` -{% endraw %} - Filters are applied as follows: 1. No includes or excludes - pass all entities diff --git a/source/_integrations/apache_kafka.markdown b/source/_integrations/apache_kafka.markdown index d93abf50bfa..5caa5860ae3 100644 --- a/source/_integrations/apache_kafka.markdown +++ b/source/_integrations/apache_kafka.markdown @@ -87,8 +87,6 @@ filter: By default, no entity will be excluded. To limit which entities are being exposed to `Apache Kafka`, you can use the `filter` parameter. -{% raw %} - ```yaml # Example filter to include specified domains and exclude specified entities apache_kafka: @@ -105,8 +103,6 @@ apache_kafka: - light.kitchen_light ``` -{% endraw %} - Filters are applied as follows: 1. No includes or excludes - pass all entities diff --git a/source/_integrations/azure_event_hub.markdown b/source/_integrations/azure_event_hub.markdown index e3324f32f3e..4379094428d 100644 --- a/source/_integrations/azure_event_hub.markdown +++ b/source/_integrations/azure_event_hub.markdown @@ -119,8 +119,6 @@ Event Hubs have a retention time of at most 7 days, if you do not capture or use By default, no entity will be excluded. To limit which entities are being exposed to `Azure Event Hub`, you can use the `filter` parameter. -{% raw %} - ```yaml # Example filter to include specified domains and exclude specified entities azure_event_hub: @@ -138,8 +136,6 @@ azure_event_hub: - light.kitchen_light ``` -{% endraw %} - Filters are applied as follows: 1. No includes or excludes - pass all entities diff --git a/source/_integrations/bayesian.markdown b/source/_integrations/bayesian.markdown index 5b78e1fadf2..0202a87ddb7 100644 --- a/source/_integrations/bayesian.markdown +++ b/source/_integrations/bayesian.markdown @@ -135,6 +135,7 @@ binary_sensor: Finally, here's an example for `template` observation platform, as seen in the configuration it requires `value_template`. {% raw %} + ```yaml # Example configuration.yaml entry binary_sensor: @@ -148,6 +149,7 @@ binary_sensor: {{is_state('device_tracker.paulus','not_home') and ((as_timestamp(now()) - as_timestamp(states.device_tracker.paulus.last_changed)) > 300)}} prob_given_true: 0.95 ``` + {% endraw %} The template is re-evaluated whenever an entity ID that it references changes state. If you use non-deterministic functions like `now()` in the template it will not be continuously re-evaluated, but only when an entity ID that is referenced is updated. diff --git a/source/_integrations/binary_sensor.rest.markdown b/source/_integrations/binary_sensor.rest.markdown index 19fa8e56b44..5c5c339d1c5 100644 --- a/source/_integrations/binary_sensor.rest.markdown +++ b/source/_integrations/binary_sensor.rest.markdown @@ -49,6 +49,7 @@ binary_sensor: resource: http://IP_ADDRESS/ENDPOINT method: POST ``` + or a template based request: ```yaml diff --git a/source/_integrations/binary_sensor.template.markdown b/source/_integrations/binary_sensor.template.markdown index 8a9ea63e9bf..394a321224e 100644 --- a/source/_integrations/binary_sensor.template.markdown +++ b/source/_integrations/binary_sensor.template.markdown @@ -228,9 +228,10 @@ binary_sensor: ### Device Tracker sensor with Latitude and Longitude Attributes -This example shows how to combine a non-GPS (e.g., NMAP) and GPS device tracker while still including latitude and longitude attributes +This example shows how to combine a non-GPS (e.g., NMAP) and GPS device tracker while still including latitude and longitude attributes {% raw %} + ```yaml binary_sensor: - platform: template @@ -253,6 +254,7 @@ binary_sensor: {{ state_attr('device_tracker.my_device_gps','longitude') }} {% endif %} ``` + {% endraw %} ### Change the icon when state changes @@ -293,6 +295,7 @@ thousands state changed events per day, templates may re-render more than desira In the below example, re-renders are limited to once per minute: {% raw %} + ```yaml binary_sensor: - platform: template @@ -300,11 +303,13 @@ binary_sensor: has_unavailable_states: value_template: '{{ states | selectattr('state', 'in', ['unavailable', 'unknown', 'none']) | list | count }}' ``` + {% endraw %} In the below example, re-renders are limited to once per second: {% raw %} + ```yaml binary_sensor: - platform: template @@ -312,6 +317,7 @@ binary_sensor: has_sensor_unavailable_states: value_template: '{{ states.sensor | selectattr('state', 'in', ['unavailable', 'unknown', 'none']) | list | count }}' ``` + {% endraw %} If the template accesses every state on the system, a rate limit of one update per minute is applied. If the template accesses all states under a specific domain, a rate limit of one update per second is applied. If the template only accesses specific states, receives update events for specifically referenced entities, or the `homeassistant.update_entity` service is used, no rate limit is applied. diff --git a/source/_integrations/blink.markdown b/source/_integrations/blink.markdown index 7b511ef78b4..9b58835328f 100644 --- a/source/_integrations/blink.markdown +++ b/source/_integrations/blink.markdown @@ -150,6 +150,7 @@ When motion is detected, you can use the Blink Home Assistant integration to sav Again, this example assumes your camera's name (in the blink app) is `My Camera` and your sync module name is `My Sync Module`. The file will be saved to `/tmp/videos/blink_video_{YYYMMDD_HHmmSS}.mp4` where `{YYYYMMDD_HHmmSS}` will be a timestamp create via the use of [templating](/docs/configuration/templating/). {% raw %} + ```yaml - id: save_blink_video_on_motion alias: Save Blink Video on Motion @@ -162,6 +163,6 @@ Again, this example assumes your camera's name (in the blink app) is `My Camera` data: name: "My Camera" filename: "/tmp/videos/blink_video_{{ now().strftime('%Y%m%d_%H%M%S') }}.mp4" - ``` + {% endraw %} diff --git a/source/_integrations/calendar.google.markdown b/source/_integrations/calendar.google.markdown index 1f2591c813a..82a4830f3cc 100644 --- a/source/_integrations/calendar.google.markdown +++ b/source/_integrations/calendar.google.markdown @@ -217,9 +217,11 @@ By using specific text in the event title, you can set conditions to initiate pa For example, the actions following this condition will only be executed for events named 'vacation': {% raw %} + ```yaml condition: condition: template value_template: "{{is_state_attr('calendar.calendar_name', 'message', 'vacation') }}" ``` + {% endraw %} diff --git a/source/_integrations/camera.markdown b/source/_integrations/camera.markdown index eb595cde8a9..452f64974cc 100644 --- a/source/_integrations/camera.markdown +++ b/source/_integrations/camera.markdown @@ -83,6 +83,7 @@ The path part of `filename` must be an entry in the `allowlist_external_dirs` in For example, the following action in an automation would take a recording from "yourcamera" and save it to /tmp with a timestamped filename. {% raw %} + ```yaml action: service: camera.record @@ -90,6 +91,7 @@ action: entity_id: camera.yourcamera filename: '/tmp/{{ entity_id.name }}_{{ now().strftime("%Y%m%d-%H%M%S") }}.mp4' ``` + {% endraw %} #### Service `snapshot` @@ -106,6 +108,7 @@ The path part of `filename` must be an entry in the `allowlist_external_dirs` in For example, the following action in an automation would take a snapshot from "yourcamera" and save it to /tmp with a timestamped filename. {% raw %} + ```yaml action: service: camera.snapshot @@ -113,6 +116,7 @@ action: entity_id: camera.yourcamera filename: '/tmp/yourcamera_{{ now().strftime("%Y%m%d-%H%M%S") }}.jpg' ``` + {% endraw %} #### Service `turn_off` diff --git a/source/_integrations/climate.mqtt.markdown b/source/_integrations/climate.mqtt.markdown index 09018eee112..9b8cda82871 100644 --- a/source/_integrations/climate.mqtt.markdown +++ b/source/_integrations/climate.mqtt.markdown @@ -322,6 +322,7 @@ For all `*_state_topic`s, a template can be specified that will be used to rende Say you receive the operation mode `"auto"` via your `mode_state_topic`, but the mode is actually called just `auto`, here's what you could do: {% raw %} + ```yaml climate: - platform: mqtt @@ -334,11 +335,11 @@ climate: mode_state_topic: "study/ac/mode/state" mode_state_template: "{{ value_json }}" ``` + {% endraw %} This will parse the incoming `"auto"` as JSON, resulting in `auto`. Obviously, in this case you could also just set `value_template: {% raw %}"{{ value_json }}"{% endraw %}`. - ### Example A full configuration example looks like the one below. diff --git a/source/_integrations/climate.mysensors.markdown b/source/_integrations/climate.mysensors.markdown index f497322ce5d..ccde1215a4f 100644 --- a/source/_integrations/climate.mysensors.markdown +++ b/source/_integrations/climate.mysensors.markdown @@ -39,7 +39,9 @@ You can use V_TEMP to send the current temperature from the node to Home Assista For more information, visit the [serial API](https://www.mysensors.org/download) of MySensors. ## Example sketch for MySensors 2.x + {% raw %} + ```cpp /** * The MySensors Arduino library handles the wireless radio link and protocol @@ -266,6 +268,7 @@ void sendHeatpumpCommand() { heatpumpIR->send(irSender, POWER_STATE, MODE_STATE, FAN_STATE, TEMP_STATE, VDIR_AUTO, HDIR_AUTO); } ``` + {% endraw %} ## Example sketch for MySensors 1.x diff --git a/source/_integrations/conversation.markdown b/source/_integrations/conversation.markdown index f0213cff4cb..16cdea1e7fb 100644 --- a/source/_integrations/conversation.markdown +++ b/source/_integrations/conversation.markdown @@ -60,12 +60,14 @@ Sentences can contain slots (marked with curly braces: `{name}`) and optional wo The following configuration can handle the following sentences: - - Change the lights to red - - Change the lights to green - - Change the lights to blue - - Change the lights to the color red - - Change the lights to the color green - - Change the lights to the color blue +- Change the lights to red +- Change the lights to green +- Change the lights to blue +- Change the lights to the color red +- Change the lights to the color green +- Change the lights to the color blue + +{% raw %} ```yaml # Example configuration.yaml entry @@ -73,7 +75,6 @@ conversation: intents: ColorLight: - Change the lights to [the color] {color} -{% raw %} intent_script: ColorLight: speech: @@ -85,9 +86,10 @@ intent_script: - "{% if color == 'red' %}255{% else %}0{% endif %}" - "{% if color == 'green' %}255{% else %}0{% endif %}" - "{% if color == 'blue' %}255{% else %}0{% endif %}" -{% endraw %} ``` +{% endraw %} + #### Service `conversation.process` | Service data attribute | Optional | Description | diff --git a/source/_integrations/dialogflow.markdown b/source/_integrations/dialogflow.markdown index 88cd7f1904d..1beea88b1f4 100644 --- a/source/_integrations/dialogflow.markdown +++ b/source/_integrations/dialogflow.markdown @@ -68,6 +68,7 @@ When activated, the [`alexa` integration](/integrations/alexa/) will have Home A Download [this zip](https://github.com/home-assistant/home-assistant.io/blob/next/source/assets/HomeAssistant_APIAI.zip) and load it in your Dialogflow agent (**Settings** -> **Export and Import**) for examples intents to use with this configuration: {% raw %} + ```yaml # Example configuration.yaml entry dialogflow: @@ -114,4 +115,5 @@ intent_script: data: entity_id: "switch.light_{{ Room | striptags | replace(' ', '_') }}" ``` + {% endraw %} diff --git a/source/_integrations/dweet.markdown b/source/_integrations/dweet.markdown index 5191378e924..ee755d4ab81 100644 --- a/source/_integrations/dweet.markdown +++ b/source/_integrations/dweet.markdown @@ -96,6 +96,7 @@ unit_of_measurement: A full configuration entry could look like the sample below. {% raw %} + ```yaml # Example configuration.yaml entry sensor: @@ -105,6 +106,7 @@ sensor: value_template: '{{ value_json.VARIABLE }}' unit_of_measurement: "°C" ``` + {% endraw %} ### Interacting with Dweet.io diff --git a/source/_integrations/ecovacs.markdown b/source/_integrations/ecovacs.markdown index c36ffe3e167..9699d5c664d 100644 --- a/source/_integrations/ecovacs.markdown +++ b/source/_integrations/ecovacs.markdown @@ -82,6 +82,7 @@ The remaining lifespan of components on your Deebot vacuum will be reported as a Here's an example of how to extract the filter's lifespan to its own sensor using a [template sensor](/integrations/template): {% raw %} + ```yaml # Example configuration.yaml entry sensor: @@ -92,11 +93,13 @@ sensor: unit_of_measurement: '%' value_template: "{{ state_attr('vacuum.my_vacuum_id', 'component_filter') }}" ``` + {% endraw %} Or, if you want a simple binary sensor that becomes `On` when the filter needs to be replaced (5% or less): {% raw %} + ```yaml # Example configuration.yaml entry binary_sensor: @@ -107,6 +110,7 @@ binary_sensor: device_class: problem value_template: "{{ state_attr('vacuum.my_vacuum_id', 'component_filter') <= 5 }}" ``` + {% endraw %} ### Handling Errors diff --git a/source/_integrations/edimax.markdown b/source/_integrations/edimax.markdown index f53fdd8e93e..0871a5c912a 100644 --- a/source/_integrations/edimax.markdown +++ b/source/_integrations/edimax.markdown @@ -46,6 +46,7 @@ name: Starting with [version 2 of the firmware](https://www.edimax.com/edimax/download/download/data/edimax/global/download/), the Edimax switches can also report the current and accumulated daily power consumption in their state objects. Use a [template sensor](/integrations/template) to extract their values: {% raw %} + ```yaml - platform: template sensors: @@ -59,6 +60,7 @@ Starting with [version 2 of the firmware](https://www.edimax.com/edimax/download unit_of_measurement: 'kWh' value_template: "{{ state_attr('switch.edimax_smart_plug', 'today_energy_kwh') | replace('None', 0) }}" ``` + {% endraw %} Note that if the smart plug is off, these states report the string `None`. By using a `replace()` in the template, these sensors report purely numerical values. diff --git a/source/_integrations/emulated_kasa.markdown b/source/_integrations/emulated_kasa.markdown index 7f621331ab8..486f911fd69 100644 --- a/source/_integrations/emulated_kasa.markdown +++ b/source/_integrations/emulated_kasa.markdown @@ -60,6 +60,7 @@ entities: A full configuration sample looks like the one below. {% raw %} + ```yaml # Example configuration.yaml entry emulated_kasa: @@ -90,4 +91,5 @@ emulated_kasa: name: UPS Power power: "{{ float(states('sensor.ups_kw')) * 1000 }}" ``` + {% endraw %} diff --git a/source/_integrations/environment_canada.markdown b/source/_integrations/environment_canada.markdown index bc1e5feef89..9b670102f06 100644 --- a/source/_integrations/environment_canada.markdown +++ b/source/_integrations/environment_canada.markdown @@ -157,6 +157,7 @@ scan_interval: If you would like to have alerts announced via a text-to-speech service, you can use a script similar to the following: {% raw %} + ```yaml weather_alert_tts: sequence: @@ -164,6 +165,7 @@ weather_alert_tts: data: message: "{{ states('sensor.warnings') }} in effect." ``` + {% endraw %} ## Camera diff --git a/source/_integrations/facebox.markdown b/source/_integrations/facebox.markdown index 8bea4a1c80c..8ebe2ee0af5 100644 --- a/source/_integrations/facebox.markdown +++ b/source/_integrations/facebox.markdown @@ -96,6 +96,7 @@ source: Use the `image_processing.detect_face` events to trigger automations, and breakout the `trigger.event.data` using a [template](/docs/automation/templating/). The following example automation sends a notification when Ringo Star is recognized: {% raw %} + ```yaml - id: '12345' alias: Ringo Starr recognised @@ -110,6 +111,7 @@ Use the `image_processing.detect_face` events to trigger automations, and breako message: Ringo_Starr recognised with probability {{ trigger.event.data.confidence }} title: Door-cam notification ``` + {% endraw %} ## Service `facebox.teach_face` @@ -125,6 +127,7 @@ The service `facebox.teach_face` can be used to teach Facebox faces. A valid service data example: {% raw %} + ```yaml { "entity_id": "image_processing.facebox_local_file", @@ -132,11 +135,13 @@ A valid service data example: "file_path": "/images/superman_1.jpeg" } ``` + {% endraw %} You can use an automation to receive a notification when you train a face: {% raw %} + ```yaml - id: '1533703568569' alias: Face taught @@ -153,6 +158,7 @@ You can use an automation to receive a notification when you train a face: with file {{ trigger.event.data.service_data.file_path }}' title: Face taught notification ``` + {% endraw %} Any errors on teaching will be reported in the logs. If you enable [system_log](/integrations/system_log/) events: @@ -165,6 +171,7 @@ system_log: you can create an automation to receive notifications on Facebox errors: {% raw %} + ```yaml - id: '1533703568577' alias: Facebox error @@ -180,4 +187,5 @@ you can create an automation to receive notifications on Facebox errors: message: '{{ trigger.event.data.message }}' title: Facebox error ``` + {% endraw %} diff --git a/source/_integrations/fints.markdown b/source/_integrations/fints.markdown index 533b908e9fd..c0e581f0cd4 100644 --- a/source/_integrations/fints.markdown +++ b/source/_integrations/fints.markdown @@ -16,7 +16,6 @@ To find out the configuration for your bank, check their website or call their h For each account you have with the bank, a separate sensor is created. If you have several accounts with a bank, you can select which ones you want to have, and you can also give the accounts a name. -{% raw %} ```yaml # Example configuration.yaml entry sensor: @@ -26,7 +25,6 @@ sensor: pin: YOUR_PIN url: URL_FOR_YOUR_BANK ``` -{% endraw %} {% configuration %} name: diff --git a/source/_integrations/folder_watcher.markdown b/source/_integrations/folder_watcher.markdown index 769cd193414..2cce5d200ee 100644 --- a/source/_integrations/folder_watcher.markdown +++ b/source/_integrations/folder_watcher.markdown @@ -22,12 +22,10 @@ Configured folders must be added to [allowlist_external_dirs](/docs/configuratio To enable the Folder Watcher integration in your installation, add the following to your `configuration.yaml` file: -{% raw %} ```yaml folder_watcher: - folder: /config ``` -{% endraw %} {% configuration %} folder: @@ -45,7 +43,6 @@ patterns: Pattern matching using [fnmatch](https://docs.python.org/3.6/library/fnmatch.html) can be used to limit filesystem monitoring to only files which match the configured patterns. The following example shows the configuration required to only monitor filetypes `.yaml` and `.txt`. -{% raw %} ```yaml folder_watcher: - folder: /config @@ -53,13 +50,13 @@ folder_watcher: - '*.yaml' - '*.txt' ``` -{% endraw %} ## Automations Automations can be triggered on filesystem event data using a template. The following automation will send a notification with the name and folder of new files added to that folder: {% raw %} + ```yaml #Send notification for new image (including the image itself) automation: @@ -77,4 +74,5 @@ automation:     data:       file: "{{ trigger.event.data.path }}" ``` + {% endraw %} diff --git a/source/_integrations/fritzbox_callmonitor.markdown b/source/_integrations/fritzbox_callmonitor.markdown index fd029e77e01..1bc5260117f 100644 --- a/source/_integrations/fritzbox_callmonitor.markdown +++ b/source/_integrations/fritzbox_callmonitor.markdown @@ -86,6 +86,7 @@ sensor: This example shows how to send notifications whenever the sensor's state changes. You will get notified both when you receive a call and also when a call is placed. {% raw %} + ```yaml # Example configuration.yaml entry. automation: @@ -108,4 +109,5 @@ automation: Talking to {{ state_attr('sensor.phone', 'with_name') }} ({{ state_attr('sensor.phone', 'with') }}) {% endif %} ``` + {% endraw %} diff --git a/source/_integrations/garadget.markdown b/source/_integrations/garadget.markdown index eface9f7f3f..1c627804a19 100644 --- a/source/_integrations/garadget.markdown +++ b/source/_integrations/garadget.markdown @@ -68,6 +68,7 @@ covers:

{% raw %} + ```yaml # Related configuration.yaml entry cover: @@ -107,6 +108,7 @@ customize: sensor.garage_door_wifi_signal_strength: icon: mdi:wifi ``` + {% endraw %} Some of the Garadget sensors can create a lot of clutter in the logbook. Use this section of code in your `configuration.yaml` to exclude those entries. diff --git a/source/_integrations/geniushub.markdown b/source/_integrations/geniushub.markdown index eac41e90fae..28237497e5e 100644 --- a/source/_integrations/geniushub.markdown +++ b/source/_integrations/geniushub.markdown @@ -77,6 +77,7 @@ There are three `Sensor` entities that will indicate the number of **Errors**, * Each such entity has a state attribute that will contain a list of any such issues which can be used in automations, etc. For example: {% raw %} + ```yaml - alias: GeniusHub Error Alerts trigger: @@ -91,11 +92,13 @@ Each such entity has a state attribute that will contain a list of any such issu Genius Hub has the following {{ states('sensor.geniushub_errors') }} errors: {{ state_attr('sensor.geniushub_errors', 'error_list') }} ``` + {% endraw %} This alert may be useful to see if the CH is being turned on whilst you're on a holiday! {% raw %} + ```yaml - alias: GeniusHub CH State Change Alert trigger: @@ -109,6 +112,7 @@ This alert may be useful to see if the CH is being turned on whilst you're on a {{ trigger.to_state.attributes.friendly_name }} has changed from {{ trigger.from_state.state }} to {{ trigger.to_state.state }}. ``` + {% endraw %} ## State Attributes @@ -146,17 +150,21 @@ Many zone/device properties are available via the corresponding entity's state a This data can be accessed in automations, etc. via a value template. For example: {% raw %} + ```yaml value_template: "{{ state_attr('water_heater.genius_zone_2', 'status').override.setpoint }}" ``` + {% endraw %} In the specific case of **Radiator** zones with room sensors: {% raw %} + ```yaml value_template: "{{ state_attr('climate.genius_zone_12', 'status').occupied }}" ``` + {% endraw %} ## Configuration diff --git a/source/_integrations/geo_location.markdown b/source/_integrations/geo_location.markdown index f1181b6b1b3..99bb17982af 100644 --- a/source/_integrations/geo_location.markdown +++ b/source/_integrations/geo_location.markdown @@ -34,6 +34,7 @@ Conditions can be used to further filter entities, for example by inspecting the The following example automation creates a notification on the screen when a fire classified as 'Bush Fire' is reported within a predefined bush fire alert zone: {% raw %} + ```yaml geo_location: - platform: nsw_rural_fire_service_feed @@ -65,4 +66,5 @@ automation: message: "{{ trigger.to_state.name }} - {{ trigger.to_state.attributes.status }}" title: "Bush Fire Alert" ``` + {% endraw %} diff --git a/source/_integrations/google_pubsub.markdown b/source/_integrations/google_pubsub.markdown index 58512256a91..2ae53c68ee6 100644 --- a/source/_integrations/google_pubsub.markdown +++ b/source/_integrations/google_pubsub.markdown @@ -87,8 +87,6 @@ filter: By default, no entity will be excluded. To limit which entities are being exposed to `Google Pub/Sub`, you can use the `filter` parameter. -{% raw %} - ```yaml # Example filter to include specified domains and exclude specified entities google_pubsub: @@ -105,8 +103,6 @@ google_pubsub: - light.kitchen_light ``` -{% endraw %} - Filters are applied as follows: 1. No includes or excludes - pass all entities diff --git a/source/_integrations/harmony.markdown b/source/_integrations/harmony.markdown index 5038e5b4b74..291042ce0c9 100644 --- a/source/_integrations/harmony.markdown +++ b/source/_integrations/harmony.markdown @@ -203,6 +203,7 @@ Force synchronization between the Harmony device and the Harmony cloud. Template sensors can be utilized to display current activity in the frontend. {% raw %} + ```yaml sensor: - platform: template @@ -214,11 +215,13 @@ sensor: value_template: '{{ state_attr("remote.bedroom", "current_activity") }}' friendly_name: 'bedroom' ``` + {% endraw %} The example below shows how to control an `input_boolean` switch using the Harmony remote's current activity. The switch will turn on when the remote's state changes and the Kodi activity is started and off when the remote's state changes and the current activity is "PowerOff". {% raw %} + ```yaml automation: - alias: "Watch TV started from harmony hub" @@ -242,4 +245,5 @@ automation: service: input_boolean.turn_off entity_id: input_boolean.notify ``` + {% endraw %} diff --git a/source/_integrations/history_stats.markdown b/source/_integrations/history_stats.markdown index 0d836cf1b18..b9f62f2e38f 100644 --- a/source/_integrations/history_stats.markdown +++ b/source/_integrations/history_stats.markdown @@ -25,6 +25,7 @@ Examples of what you can track: To enable the history statistics sensor, add the following lines to your `configuration.yaml`: {% raw %} + ```yaml # Example configuration.yaml entry sensor: @@ -36,6 +37,7 @@ sensor: start: '{{ now().replace(hour=0, minute=0, second=0) }}' end: '{{ now() }}' ``` + {% endraw %} {% configuration %} @@ -131,30 +133,36 @@ Here are some examples of periods you could work with, and what to write in your **Today**: starts at 00:00 of the current day and ends right now. {% raw %} + ```yaml start: '{{ now().replace(hour=0, minute=0, second=0) }}' end: '{{ now() }}' ``` + {% endraw %} **Yesterday**: ends today at 00:00, lasts 24 hours. {% raw %} + ```yaml end: '{{ now().replace(hour=0, minute=0, second=0) }}' duration: hours: 24 ``` + {% endraw %} **This morning (6AM - 11AM)**: starts today at 6, lasts 5 hours. {% raw %} + ```yaml start: '{{ now().replace(hour=6, minute=0, second=0) }}' duration: hours: 5 ``` + {% endraw %} **Current week**: starts last Monday at 00:00, ends right now. @@ -162,29 +170,35 @@ Here are some examples of periods you could work with, and what to write in your Here, last Monday is _today_ as a timestamp, minus 86400 times the current weekday (86400 is the number of seconds in one day, the weekday is 0 on Monday, 6 on Sunday). {% raw %} + ```yaml start: '{{ as_timestamp( now().replace(hour=0, minute=0, second=0) ) - now().weekday() * 86400 }}' end: '{{ now() }}' ``` + {% endraw %} **Last 30 days**: ends today at 00:00, lasts 30 days. Easy one. {% raw %} + ```yaml end: '{{ now().replace(hour=0, minute=0, second=0) }}' duration: days: 30 ``` + {% endraw %} **All your history** starts at timestamp = 0, and ends right now. {% raw %} + ```yaml start: '{{ 0 }}' end: '{{ now() }}' ``` + {% endraw %}
diff --git a/source/_integrations/homekit.markdown b/source/_integrations/homekit.markdown index 35e72004bb5..342e13dc5ac 100644 --- a/source/_integrations/homekit.markdown +++ b/source/_integrations/homekit.markdown @@ -328,8 +328,6 @@ Please remember that you can only have a single `automation` entry. Add the auto
-{% raw %} - ```yaml # Example for Z-Wave homekit: @@ -348,12 +346,8 @@ automation: - service: homekit.start ``` -{% endraw %} - For a general delay where your integration doesn't generate an event, you can also do: -{% raw %} - ```yaml # Example using a delay after the start of Home Assistant homekit: @@ -369,8 +363,6 @@ automation: - service: homekit.start ``` -{% endraw %} - In some cases it might be desirable to check that all entities are available before starting `HomeKit`. This can be accomplished by adding an additional `binary_sensor` as follows: {% raw %} @@ -406,8 +398,6 @@ automation: By default, no entity will be excluded. To limit which entities are being exposed to `HomeKit`, you can use the `filter` parameter. Keep in mind only [supported components](#supported-components) can be added. -{% raw %} - ```yaml # Example filter to include specified domains and exclude specified entities homekit: @@ -421,8 +411,6 @@ homekit: - light.kitchen_light ``` -{% endraw %} - Filters are applied as follows: 1. No includes or excludes - pass all entities diff --git a/source/_integrations/homematic.markdown b/source/_integrations/homematic.markdown index 2bd51136f71..b5768e51c32 100644 --- a/source/_integrations/homematic.markdown +++ b/source/_integrations/homematic.markdown @@ -428,28 +428,30 @@ When the connection to your Homematic CCU or Homegear is lost, Home Assistant wi - If you have a sensor which you know will be updated frequently (e.g., an outdoor temperature sensor, voltage sensor or light sensor) you could set up a helper binary sensor and an automation like this: {% raw %} - ```yaml - binary_sensor: - - platform: template - sensors: - homematic_up: - friendly_name: "Homematic is sending updates" - entity_id: - - sensor.office_voltage - - sensor.time - value_template: >- - {{as_timestamp(now()) - as_timestamp(states.sensor.office_voltage.last_changed) < 600}} - automation: - - alias: Homematic Reconnect - trigger: - platform: state - entity_id: binary_sensor.homematic_up - to: "off" - action: - # Reconnect, if sensor has not been updated for over 3 hours - service: homematic.reconnect - ``` +```yaml +binary_sensor: + - platform: template + sensors: + homematic_up: + friendly_name: "Homematic is sending updates" + entity_id: + - sensor.office_voltage + - sensor.time + value_template: >- + {{as_timestamp(now()) - as_timestamp(states.sensor.office_voltage.last_changed) < 600}} + +automation: + - alias: Homematic Reconnect + trigger: + platform: state + entity_id: binary_sensor.homematic_up + to: "off" + action: + # Reconnect, if sensor has not been updated for over 3 hours + service: homematic.reconnect +``` + {% endraw %} The important part is the `sensor.time` entity (from time_date component). This will update the binary sensor on every change of the sensor and every minute. If the Homematic sensor does not send any updates anymore, the `sensor.time` will set the binary sensor to `off` 10 minutes after the last sensor update. This will trigger the automation. @@ -553,6 +555,7 @@ Only the `data` part of the event payload is processed. This part can specify or It is possible to provide a template in order to compute the value: {% raw %} + ```json { "data": { @@ -560,11 +563,13 @@ It is possible to provide a template in order to compute the value: } } ``` + {% endraw %} You can also specify the event payload using a group notification (instead of specifying the value for the notify itself): {% raw %} + ```yaml notify: - name: my_hm @@ -587,6 +592,7 @@ alert: notifiers: - group_hm ``` + {% endraw %} Please note that the first `data` element belongs to the service `my_hm`, while the second one belongs to the event payload. diff --git a/source/_integrations/html5.markdown b/source/_integrations/html5.markdown index 43027ceb179..361374b63b0 100644 --- a/source/_integrations/html5.markdown +++ b/source/_integrations/html5.markdown @@ -167,6 +167,7 @@ data: Example of adding a tag to your notification. This won't create new notification if there already exists one with the same tag. {% raw %} + ```yaml - alias: Push/update notification of sensor state with tag trigger: @@ -180,6 +181,7 @@ Example of adding a tag to your notification. This won't create new notification data: tag: 'notification-about-sensor' ``` + {% endraw %} #### Targets diff --git a/source/_integrations/ifttt.markdown b/source/_integrations/ifttt.markdown index 988c1378ce2..5a14221833b 100644 --- a/source/_integrations/ifttt.markdown +++ b/source/_integrations/ifttt.markdown @@ -32,6 +32,7 @@ For example, set the body of the IFTTT webhook to: You then need to consume that incoming information with the following automation: {% raw %} + ```yaml automation: - id: this_is_the_automation_id @@ -47,6 +48,7 @@ automation: entity_id: '{{ trigger.event.data.entity_id }}' service: '{{ trigger.event.data.service }}' ``` + {% endraw %} ## Sending events to IFTTT @@ -59,7 +61,6 @@ ifttt: `key` is your API key which can be obtained by viewing the **Settings** of the [Webhooks applet](https://ifttt.com/services/maker_webhooks/settings). It's the last part of the URL (e.g., https://maker.ifttt.com/use/MYAPIKEY) you will find under **My Applets** > **Webhooks** > **Settings**. -

Property screen of the Maker Channel @@ -83,7 +84,6 @@ ifttt: YOUR_KEY_NAME2: YOUR_API_KEY2 ``` - ### Testing your trigger You can use **Developer Tools** to test your [Webhooks](https://ifttt.com/maker_webhooks) trigger. To do this, open the Home Assistant sidebar, click on Developer Tools, and then the **Services** tab. Fill in the following values: @@ -125,6 +125,7 @@ You need to setup a unique trigger for each event you sent to IFTTT.

{% raw %} + ```yaml # Example configuration.yaml Automation entry automation: @@ -136,11 +137,13 @@ automation: service: ifttt.trigger data: {"event":"TestHA_Trigger", "value1":"Hello World!"} ``` + {% endraw %} IFTTT can also be used in scripts and with templates. Here is the above automation broken into an automation and script using variables and templates. {% raw %} + ```yaml # Example configuration.yaml Automation entry automation: @@ -155,9 +158,11 @@ automation: value2: "{{ trigger.event.data.entity_id.split('_')[1] }} is " value3: "{{ trigger.event.data.to_state.state }}" ``` + {% endraw %} {% raw %} + ```yaml #Example Script to send TestHA_Trigger to IFTTT but with some other data (homeassistant UP). ifttt_notify: @@ -165,4 +170,5 @@ ifttt_notify: - service: ifttt.trigger data: {"event":"TestHA_Trigger", "value1":"{{ value1 }}", "value2":"{{ value2 }}", "value3":"{{ value3 }}"} ``` + {% endraw %} diff --git a/source/_integrations/imap_email_content.markdown b/source/_integrations/imap_email_content.markdown index 343ae525e98..1751269b6f3 100644 --- a/source/_integrations/imap_email_content.markdown +++ b/source/_integrations/imap_email_content.markdown @@ -78,6 +78,7 @@ value_template: The following example shows the usage of the IMAP email content sensor to scan the subject of an email for text, in this case, an email from the APC SmartConnect service which tells whether the UPS is running on battery or not. {% raw %} + ```yaml sensor: - platform: imap_email_content @@ -95,6 +96,7 @@ sensor: power_on {% endif %} ``` + {% endraw %} The same template structure can scan the date, body or sender for matching text before setting the state of the sensor. @@ -115,6 +117,7 @@ To view your account for details about your energy use, please click here. Below is the template sensor which extracts the information from the body of the email in our IMAP email sensor (named sensor.energy_email) into 3 sensors for the energy use, daily cost, and billing cycle total. {% raw %} + ```yaml sensor: - platform: template @@ -138,6 +141,7 @@ sensor: {{ state_attr('sensor.energy_email', 'body') |regex_findall_index("\ days:\* \$([0-9.]+)") }} ``` + {% endraw %} By making small changes to the regular expressions defined above, a similar structure can parse other types of data out of the body of other emails. diff --git a/source/_integrations/incomfort.markdown b/source/_integrations/incomfort.markdown index 13304ee7f59..6300ca7be0f 100644 --- a/source/_integrations/incomfort.markdown +++ b/source/_integrations/incomfort.markdown @@ -34,6 +34,7 @@ Any room thermostats (there can be 0, 1 or 2) are represented as **Climate** dev To send an alert if the CV pressure is too low or too high, consider the following example: {% raw %} + ```yaml - alias: Low CV Pressure Alert trigger: @@ -48,6 +49,7 @@ To send an alert if the CV pressure is too low or too high, consider the followi {{ trigger.to_state.attributes.friendly_name }} is low, {{ trigger.to_state.state }} bar. ``` + {% endraw %} Other properties are available via each device's attributes. diff --git a/source/_integrations/influxdb.markdown b/source/_integrations/influxdb.markdown index 1958298020e..0ada21fbecf 100644 --- a/source/_integrations/influxdb.markdown +++ b/source/_integrations/influxdb.markdown @@ -208,8 +208,6 @@ component_config_glob: By default, no entity will be excluded. To limit which entities are being exposed to `InfluxDB`, you can use the `include` and `exclude` parameters. -{% raw %} - ```yaml # Example filter to include specified domains and exclude specified entities influxdb: @@ -224,8 +222,6 @@ influxdb: - light.kitchen_light ``` -{% endraw %} - Filters are applied as follows: 1. No includes or excludes - pass all entities diff --git a/source/_integrations/input_datetime.markdown b/source/_integrations/input_datetime.markdown index ae23d9a9c01..41c85478a33 100644 --- a/source/_integrations/input_datetime.markdown +++ b/source/_integrations/input_datetime.markdown @@ -112,7 +112,6 @@ To set both the date and time in the same call, use `date` and `time` together, The following example shows the usage of the `input_datetime` as a trigger in an automation: -{% raw %} ```yaml # Example configuration.yaml entry # Turns on bedroom light at the time specified. @@ -124,13 +123,13 @@ automation: service: light.turn_on entity_id: light.bedroom ``` -{% endraw %} To dynamically set the `input_datetime` you can call `input_datetime.set_datetime`. The values for `date`, `time` and/or `datetime` must be in a certain format for the call to be successful. (See service description above.) If you have a `datetime` object you can use its `timestamp` method. Of if you have a timestamp you can just use it directly. {% raw %} + ```yaml # Sets time to 05:30:00 - service: input_datetime.set_datetime @@ -170,4 +169,5 @@ If you have a `datetime` object you can use its `timestamp` method. Of if you ha entity_id: input_datetime.XXX timestamp: "{{ now().timestamp() }}" ``` + {% endraw %} diff --git a/source/_integrations/input_number.markdown b/source/_integrations/input_number.markdown index 463ad017943..f02fbbcf74f 100644 --- a/source/_integrations/input_number.markdown +++ b/source/_integrations/input_number.markdown @@ -114,6 +114,7 @@ scene: Here's an example of `input_number` being used as a trigger in an automation. {% raw %} + ```yaml # Example configuration.yaml entry using 'input_number' as a trigger in an automation input_number: @@ -134,11 +135,13 @@ automation: entity_id: light.bedroom brightness: "{{ trigger.to_state.state | int }}" ``` + {% endraw %} Another code example using `input_number`, this time being used in an action in an automation. {% raw %} + ```yaml # Example configuration.yaml entry using 'input_number' in an action in an automation input_select: @@ -171,11 +174,13 @@ automation: entity_id: light.bedroom brightness: "{{ states('input_number.bedroom_brightness') | int }}" ``` + {% endraw %} Example of `input_number` being used in a bidirectional manner, both being set by and controlled by an MQTT action in an automation. {% raw %} + ```yaml # Example configuration.yaml entry using 'input_number' in an action in an automation input_number: @@ -213,11 +218,13 @@ automation: retain: true payload: "{{ states('input_number.target_temp') | int }}" ``` + {% endraw %} Here's an example of `input_number` being used as a delay in an automation. {% raw %} + ```yaml # Example configuration.yaml entry using 'input_number' as a delay in an automation input_number: @@ -248,4 +255,5 @@ automation: - service: switch.turn_off entity_id: switch.something ``` + {% endraw %} diff --git a/source/_integrations/input_select.markdown b/source/_integrations/input_select.markdown index fb941c3b400..e360b2ee912 100644 --- a/source/_integrations/input_select.markdown +++ b/source/_integrations/input_select.markdown @@ -149,6 +149,7 @@ automation: Example of `input_select` being used in a bidirectional manner, both being set by and controlled by an MQTT action in an automation. {% raw %} + ```yaml # Example configuration.yaml entry using 'input_select' in an action in an automation @@ -190,4 +191,5 @@ input_select: retain: true payload: "{{ states('input_select.thermostat_mode') }}" ``` + {% endraw %} diff --git a/source/_integrations/input_text.markdown b/source/_integrations/input_text.markdown index 59cf2696b52..b6c55104860 100644 --- a/source/_integrations/input_text.markdown +++ b/source/_integrations/input_text.markdown @@ -108,6 +108,7 @@ scene: Here's an example using `input_text` in an action in an automation. {% raw %} + ```yaml # Example configuration.yaml entry using 'input_text' in an action in an automation input_select: @@ -136,4 +137,5 @@ automation: entity_id: input_text.bedroom value: "{{ states('input_select.scene_bedroom') }}" ``` + {% endraw %} diff --git a/source/_integrations/iss.markdown b/source/_integrations/iss.markdown index 5b16be2a82b..19e7c57d130 100644 --- a/source/_integrations/iss.markdown +++ b/source/_integrations/iss.markdown @@ -53,6 +53,7 @@ The [generic camera platform](/integrations/mjpeg) offers the possibility to show the location of the ISS on OpenStreetMap. {% raw %} + ```yaml # Example configuration.yaml entry - platform: iss @@ -64,4 +65,5 @@ camera: still_image_url: http://staticmap.openstreetmap.de/staticmap.php?center={{ state_attr('binary_sensor.iss', 'lat') }},{{ state_attr('binary_sensor.iss', 'long') }}&zoom=4&size=865x512&maptype=mapnik&markers={{ state_attr('binary_sensor.iss', 'lat') }},{{ state_attr('binary_sensor.iss', 'long') }},lightblue limit_refetch_to_url_change: true ``` + {% endraw %} diff --git a/source/_integrations/kodi.markdown b/source/_integrations/kodi.markdown index e709daf3efc..5efdd1264fe 100644 --- a/source/_integrations/kodi.markdown +++ b/source/_integrations/kodi.markdown @@ -223,6 +223,7 @@ This example and the following requires to have the [script.json-cec](https://gi #### Simple script to turn on the PVR in some channel as a time function {% raw %} + ```yaml script: play_kodi_pvr: @@ -252,11 +253,13 @@ script: 10 {% endif %} ``` + {% endraw %} #### Simple script to play a smart playlist {% raw %} + ```yaml script: play_kodi_smp: @@ -272,6 +275,7 @@ script: media_content_type: DIRECTORY media_content_id: special://profile/playlists/video/feuerwehrmann_sam.xsp ``` + {% endraw %} #### Trigger a Kodi video library update diff --git a/source/_integrations/lacrosse.markdown b/source/_integrations/lacrosse.markdown index a9350f3a47c..9363f800f58 100644 --- a/source/_integrations/lacrosse.markdown +++ b/source/_integrations/lacrosse.markdown @@ -98,7 +98,6 @@ sensor: To setup a LaCrosse sensor with multiple sensors, add the following to your `configuration.yaml` file: -{% raw %} ```yaml # Example configuration.yaml entry sensor: @@ -119,4 +118,3 @@ sensor: type: battery id: 72 ``` -{% endraw %} diff --git a/source/_integrations/life360.markdown b/source/_integrations/life360.markdown index f214625a2d6..00e0e6906ef 100644 --- a/source/_integrations/life360.markdown +++ b/source/_integrations/life360.markdown @@ -163,8 +163,6 @@ Therefore, an optional filtering mechanism has been implemented to prevent incon ### Typical configuration -{% raw %} - ```yaml life360: # MPH, assuming imperial units. @@ -184,12 +182,8 @@ life360: error_threshold: 3 ``` -{% endraw %} - ### Circle and Member Filtering Example -{% raw %} - ```yaml life360: # Only track Members that are in these Circles. @@ -200,12 +194,8 @@ life360: exclude: John Doe ``` -{% endraw %} - ### Entering accounts in configuration -{% raw %} - ```yaml life360: accounts: @@ -213,8 +203,6 @@ life360: password: LIFE360_PASSWORD ``` -{% endraw %} - ### Example overdue update automations {% raw %} diff --git a/source/_integrations/light.mqtt.markdown b/source/_integrations/light.mqtt.markdown index c57dd58d5e9..64432bb60da 100644 --- a/source/_integrations/light.mqtt.markdown +++ b/source/_integrations/light.mqtt.markdown @@ -315,6 +315,7 @@ In this section you will find some real-life examples of how to use this sensor. To enable a light with brightness and RGB support in your installation, add the following to your `configuration.yaml` file: {% raw %} + ```yaml # Example configuration.yaml entry light: @@ -334,6 +335,7 @@ light: payload_off: "OFF" optimistic: false ``` + {% endraw %} ### Brightness and no RGB support diff --git a/source/_integrations/logbook.markdown b/source/_integrations/logbook.markdown index a32efb62dfe..d9f2ba10af5 100644 --- a/source/_integrations/logbook.markdown +++ b/source/_integrations/logbook.markdown @@ -66,8 +66,6 @@ include: By default, no entity will be excluded. To limit which entities are being exposed to `Logbook`, you can use the `include` and `exclude` parameters. -{% raw %} - ```yaml # Example filter to include specified domains and exclude specified entities logbook: @@ -82,8 +80,6 @@ logbook: - light.kitchen_light ``` -{% endraw %} - Filters are applied as follows: 1. No includes or excludes - pass all entities diff --git a/source/_integrations/manual.markdown b/source/_integrations/manual.markdown index 4d5975299f5..c3a0bd5effa 100644 --- a/source/_integrations/manual.markdown +++ b/source/_integrations/manual.markdown @@ -209,6 +209,7 @@ automation: Sending a Notification when the Alarm is Armed (Away/Home), Disarmed and in Pending Status {% raw %} + ```yaml - alias: 'Send notification when alarm is Disarmed' trigger: @@ -220,9 +221,7 @@ Sending a Notification when the Alarm is Armed (Away/Home), Disarmed and in Pend data: message: "ALARM! The alarm is Disarmed at {{ states('sensor.date_time') }}" ``` -{% endraw %} -{% raw %} ```yaml - alias: 'Send notification when alarm is in pending status' trigger: @@ -234,9 +233,7 @@ Sending a Notification when the Alarm is Armed (Away/Home), Disarmed and in Pend data: message: "ALARM! The alarm is in pending status at {{ states('sensor.date_time') }}" ``` -{% endraw %} -{% raw %} ```yaml - alias: 'Send notification when alarm is Armed in Away mode' trigger: @@ -248,9 +245,7 @@ Sending a Notification when the Alarm is Armed (Away/Home), Disarmed and in Pend data: message: "ALARM! The alarm is armed in Away mode {{ states('sensor.date_time') }}" ``` -{% endraw %} -{% raw %} ```yaml - alias: 'Send notification when alarm is Armed in Home mode' trigger: @@ -264,4 +259,5 @@ Sending a Notification when the Alarm is Armed (Away/Home), Disarmed and in Pend message: > ALARM! The alarm is armed in Home mode {{ states('sensor.date_time') }} ``` + {% endraw %} diff --git a/source/_integrations/matrix.markdown b/source/_integrations/matrix.markdown index b446f03f6f7..e8bf91af00a 100644 --- a/source/_integrations/matrix.markdown +++ b/source/_integrations/matrix.markdown @@ -91,6 +91,7 @@ If the command is a word command, the `data` field contains a list of the comman This example also uses the [matrix `notify` platform](#notifications). {% raw %} + ```yaml # The Matrix component matrix: @@ -135,6 +136,7 @@ automation: data: message: "Hello {{trigger.event.data.args['name']}}" ``` + {% endraw %} This configuration will: diff --git a/source/_integrations/mediaroom.markdown b/source/_integrations/mediaroom.markdown index 79afe14bb62..e4f295ff462 100644 --- a/source/_integrations/mediaroom.markdown +++ b/source/_integrations/mediaroom.markdown @@ -56,6 +56,7 @@ If the STB is on the same network segment as Home Assistant, it can determine wh The `play_media` function can be used in scripts to change channels: {% raw %} + ```yaml # Example play_media script to change channel # @@ -67,11 +68,13 @@ change_channel: media_content_id: "{{ channel_number }}" media_content_type: "channel" ``` + {% endraw %} The `play_media` function can also be used to trigger actions on the set-up-box such opening the videoclub: {% raw %} + ```yaml # Example play_media script to trigger an action # @@ -83,6 +86,7 @@ press_button: media_content_id: "{{ action }}" media_content_type: "mediaroom" ``` + {% endraw %} Check [here](https://github.com/dgomes/pymediaroom) for the list of possible media_content_id's diff --git a/source/_integrations/meteoalarm.markdown b/source/_integrations/meteoalarm.markdown index a14bdc1d240..90b8db94f6a 100644 --- a/source/_integrations/meteoalarm.markdown +++ b/source/_integrations/meteoalarm.markdown @@ -86,6 +86,7 @@ Example automation Below you find an example of an automation. {% raw %} + ```yaml automation: - alias: Alert me about weather warnings @@ -99,6 +100,7 @@ automation: title: "{{state_attr('binary_sensor.meteoalarm', 'headline')}}" message: "{{state_attr('binary_sensor.meteoalarm', 'description')}} is effective on {{state_attr('binary_sensor.meteoalarm', 'effective')}}" ``` + {% endraw %}
diff --git a/source/_integrations/min_max.markdown b/source/_integrations/min_max.markdown index 0fd106fabd7..9098a36bc37 100644 --- a/source/_integrations/min_max.markdown +++ b/source/_integrations/min_max.markdown @@ -17,12 +17,14 @@ The `min_max` sensor platform consumes the state from other sensors to determine This sensor is an alternative to the [template sensor](/integrations/template)'s `value_template:` to get the average or the median of multiple sensors. {% raw %} + ```yaml {{ ((float(states('sensor.kitchen_temperature')) + float(states('sensor.living_room_temperature')) + float(states('sensor.office_temperature'))) / 3) | round(2) }} ``` + {% endraw %} Sensors with an unknown state will be ignored in the calculation. If the unit of measurement of the sensors differs, the `min_max` sensor will go to an error state where the value is `UNKNOWN` and unit of measurement is `ERR`. diff --git a/source/_integrations/minio.markdown b/source/_integrations/minio.markdown index 03ae9cd6387..5d3457f8503 100644 --- a/source/_integrations/minio.markdown +++ b/source/_integrations/minio.markdown @@ -81,6 +81,7 @@ listen: Automations can be triggered on new files created on the Minio server using the `data_template`. {% raw %} + ```yaml #Automatically upload new local files automation: @@ -115,6 +116,7 @@ automation: key: "{{trigger.event.data.key}}" file_path: "/tmp/{{ trigger.event.data.file_name }}" ``` + {% endraw %} ## Platform Services diff --git a/source/_integrations/modem_callerid.markdown b/source/_integrations/modem_callerid.markdown index 3ab1f7a3c7a..3cc85a6d979 100644 --- a/source/_integrations/modem_callerid.markdown +++ b/source/_integrations/modem_callerid.markdown @@ -66,6 +66,7 @@ Depending on what's plugged into your USB ports, the name found above may change Some example automations: {% raw %} + ```yaml automation: - alias: Notify CallerID @@ -97,4 +98,5 @@ automation: data: message: 'Call from {{ state_attr('sensor.modem_callerid', 'cid_name') }}' ``` + {% endraw %} diff --git a/source/_integrations/mqtt_statestream.markdown b/source/_integrations/mqtt_statestream.markdown index 9eff9a93cdc..a2e5cd610b0 100644 --- a/source/_integrations/mqtt_statestream.markdown +++ b/source/_integrations/mqtt_statestream.markdown @@ -77,8 +77,6 @@ include: By default, no entity will be excluded. To limit which entities are being exposed to `MQTT Statestream`, you can use the `include` and `exclude` parameters. -{% raw %} - ```yaml # Example filter to include specified domains and exclude specified entities mqtt_statestream: @@ -94,8 +92,6 @@ mqtt_statestream: - light.kitchen_light ``` -{% endraw %} - Filters are applied as follows: 1. No includes or excludes - pass all entities diff --git a/source/_integrations/netatmo.markdown b/source/_integrations/netatmo.markdown index 771ff1a3d25..cd66fcf12dc 100644 --- a/source/_integrations/netatmo.markdown +++ b/source/_integrations/netatmo.markdown @@ -111,8 +111,6 @@ You can find the available event types at the [official Netatmo API documentatio Example: -{% raw %} - ```yaml # Example automation for webhooks based Netatmo events - alias: Netatmo event example @@ -127,8 +125,6 @@ Example: service: counter.increment ``` -{% endraw %} - Example: {% raw %} diff --git a/source/_integrations/notify.group.markdown b/source/_integrations/notify.group.markdown index e14e8d0f829..d5647ad4f7f 100644 --- a/source/_integrations/notify.group.markdown +++ b/source/_integrations/notify.group.markdown @@ -49,10 +49,12 @@ services: An example on how to use it in an automation: {% raw %} + ```yaml action: service: notify.NAME_OF_NOTIFIER_GROUP data: message: "The sun is {% if is_state('sun.sun', 'above_horizon') %}up{% else %}down{% endif %}!" ``` + {% endraw %} diff --git a/source/_integrations/nzbget.markdown b/source/_integrations/nzbget.markdown index a10096fbf09..68354db04f3 100644 --- a/source/_integrations/nzbget.markdown +++ b/source/_integrations/nzbget.markdown @@ -44,6 +44,7 @@ Possible events are: The event includes the name, category, and status of the downloaded nzb. Example automation to send a Telegram message on a completed download: + {% raw %} ```yaml diff --git a/source/_integrations/openuv.markdown b/source/_integrations/openuv.markdown index 17b4a89ffb6..30774af808f 100644 --- a/source/_integrations/openuv.markdown +++ b/source/_integrations/openuv.markdown @@ -107,7 +107,9 @@ automation: ``` Update the UV index data every 20 minutes while the sun is at least 10 degrees above the horizon: + {% raw %} + ```yaml automation: - alias: Update OpenUV every 20 minutes while the sun is at least 10 degrees above the horizon @@ -122,9 +124,11 @@ automation: action: service: openuv.update_uv_index_data ``` + {% endraw %} Update the protection window once a day: + ```yaml automation: - alias: Update OpenUV protection window once a day diff --git a/source/_integrations/plex.markdown b/source/_integrations/plex.markdown index 86ce2486850..f89573fb5b6 100644 --- a/source/_integrations/plex.markdown +++ b/source/_integrations/plex.markdown @@ -238,7 +238,9 @@ Refresh a Plex library to scan for new and updated media. Scan for new controllable Plex clients. This may be necessary in scripts or automations which control a Plex `media_player` entity, but where the underlying device must be turned on first. Example script: + {% raw %} + ```yaml play_plex_on_tv: sequence: @@ -258,6 +260,7 @@ play_plex_on_tv: media_content_id: '{"library_name": "Movies", "title": "Zoolander"}' media_content_type: movie ``` + {% endraw %} ## Notes diff --git a/source/_integrations/point.markdown b/source/_integrations/point.markdown index f09739b61c5..fd2b0ed8d0c 100644 --- a/source/_integrations/point.markdown +++ b/source/_integrations/point.markdown @@ -93,7 +93,6 @@ The binary sensors **button_press**, **sound** and **tamper** are switched `On` The following example show how to implement an automation for the **button_press** binary sensor. -{% raw %} ```yaml # Example configuration.yaml Automation entry automation: @@ -108,13 +107,13 @@ automation: title: Point button press message: Point button was pressed. ``` -{% endraw %} ### Webhook events The events shown as [binary sensors](#binary-sensor) are sent to Home Assistant as webhooks with the `event_type` set to `point_webhook_received`. Below is an example of how to use such a webhook do note the `trigger.event.data.event.device_id` which translates to the id of the Point device that sent the event. {% raw %} + ```yaml # Example configuration.yaml Automation entry automation: @@ -132,6 +131,7 @@ automation: title: Point button press (webhook) message: "Button press on Point {{ trigger.event.data.event.device_id }}" ``` + {% endraw %} ## Sensor diff --git a/source/_integrations/prometheus.markdown b/source/_integrations/prometheus.markdown index 28450367127..67f96ca0e71 100644 --- a/source/_integrations/prometheus.markdown +++ b/source/_integrations/prometheus.markdown @@ -98,8 +98,6 @@ component_config_glob: By default, no entity will be excluded. To limit which entities are being exposed to `Prometheus`, you can use the `filter` parameter. -{% raw %} - ```yaml # Example filter to include specified domains and exclude specified entities prometheus: @@ -113,8 +111,6 @@ prometheus: - light.kitchen_light ``` -{% endraw %} - Filters are applied as follows: 1. No includes or excludes - pass all entities diff --git a/source/_integrations/recorder.markdown b/source/_integrations/recorder.markdown index 158b62da944..220cb4a466a 100644 --- a/source/_integrations/recorder.markdown +++ b/source/_integrations/recorder.markdown @@ -112,8 +112,6 @@ recorder: By default, no entity will be excluded. To limit which entities are being exposed to `Recorder`, you can use the `include` and `exclude` parameters. -{% raw %} - ```yaml # Example filter to include specified domains and exclude specified entities recorder: @@ -128,8 +126,6 @@ recorder: - light.kitchen_light ``` -{% endraw %} - Filters are applied as follows: 1. No includes or excludes - pass all entities diff --git a/source/_integrations/remember_the_milk.markdown b/source/_integrations/remember_the_milk.markdown index 5409b5d7094..4ee511dc029 100644 --- a/source/_integrations/remember_the_milk.markdown +++ b/source/_integrations/remember_the_milk.markdown @@ -105,8 +105,8 @@ Here's an example for an automation that creates a new task whenever `sensor.mys - service: remember_the_milk.myaccount_complete_task data: id: "{{trigger.entity_id}}" - ``` + {% endraw %} ## Disclaimer diff --git a/source/_integrations/rest.markdown b/source/_integrations/rest.markdown index 361f81dfb06..61a82a08135 100644 --- a/source/_integrations/rest.markdown +++ b/source/_integrations/rest.markdown @@ -244,6 +244,7 @@ sensor: [JSON Test](https://www.jsontest.com/) returns the current time, date and milliseconds since epoch from [http://date.jsontest.com/](http://date.jsontest.com/). {% raw %} + ```yaml sensor: - platform: rest @@ -262,6 +263,7 @@ sensor: friendly_name: 'milliseconds' value_template: '{{ states.sensor.json_time.attributes["milliseconds_since_epoch"] }}' ``` + {% endraw %} [JSONPlaceholder](https://jsonplaceholder.typicode.com/) provides sample JSON data for testing. In the below example, JSONPath locates the attributes in the JSON document. [JSONPath Online Evaluator](https://jsonpath.com/) provides a tool to test your JSONPath. If the endpoint returns XML, it will be converted to JSON using `xmltodict` before searching for attributes. You may find the [XMLtoDict debug tool](https://xmltodict-debugger.glitch.me/) helpful for testing how your XML converts to JSON. @@ -287,6 +289,7 @@ sensor: This sample fetches a weather report from [OpenWeatherMap](https://openweathermap.org/), maps the resulting data into attributes of the RESTful sensor and then creates a set of [template](/integrations/template) sensors that monitor the attributes and present the values in a usable form. {% raw %} + ```yaml sensor: - platform: rest @@ -318,11 +321,13 @@ sensor: unit_of_measurement: "%" entity_id: sensor.owm_report ``` + {% endraw %} This configuration shows how to extract multiple values from a dictionary with `json_attributes` and `template`. This avoids flooding the REST service by only requesting the result once, then creating multiple attributes from that single result using templates. By default, the sensor state would be set to the full JSON — here, that would exceed the 255-character maximum allowed length for the state, so we override that default by using `value_template` to set a static value of `OK`. {% raw %} + ```json { "bedroom1": { @@ -345,9 +350,11 @@ This configuration shows how to extract multiple values from a dictionary with ` } } ``` + {% endraw %} {% raw %} + ```yaml sensor: - platform: rest @@ -377,6 +384,7 @@ sensor: device_class: temperature unit_of_measurement: '°C' ``` + {% endraw %} The below example allows shows how to extract multiple values from a dictionary with `json_attributes` and `json_attributes_path` from the XML of a Steamist Steambath Wi-Fi interface and use them to create a switch and multiple sensors without having to poll the endpoint numerous times. diff --git a/source/_integrations/rest_command.markdown b/source/_integrations/rest_command.markdown index 6105f75bc8d..e5b9e51ca01 100644 --- a/source/_integrations/rest_command.markdown +++ b/source/_integrations/rest_command.markdown @@ -96,6 +96,7 @@ The commands can be dynamic, using templates to insert values of other entities. In this example, uses [templates](/docs/configuration/templating/) for dynamic parameters. {% raw %} + ```yaml # Example configuration.yaml entry rest_command: @@ -110,6 +111,7 @@ rest_command: content_type: 'application/json; charset=utf-8' verify_ssl: true ``` + {% endraw %} ### How to test your new REST command @@ -122,6 +124,7 @@ Call the new service from [developer tools](/docs/tools/dev-tools/) in the sideb "emoji":":plex:" } ``` + ### Using a REST command as an action in an automation ```yaml diff --git a/source/_integrations/rfxtrx.markdown b/source/_integrations/rfxtrx.markdown index 0f5c0bc8825..d04c2784e87 100644 --- a/source/_integrations/rfxtrx.markdown +++ b/source/_integrations/rfxtrx.markdown @@ -283,7 +283,7 @@ automation: - `rfxtrx.send`: Send a custom event using the RFXtrx device. -#### Service: Send +### Service: Send Simulate a button being pressed: @@ -295,7 +295,6 @@ action: event: 0b1111e003af16aa10000060 ``` - ## Generate codes If you need to generate codes for switches and lights, you can use a template (useful, for example, COCO switches). @@ -303,7 +302,7 @@ If you need to generate codes for switches and lights, you can use a template (u - Go to home-assistant-IP:8123/dev-template - Use the following codes to generate an event: -*Switch: ARC* +### Switch: ARC {% raw %} @@ -313,7 +312,7 @@ If you need to generate codes for switches and lights, you can use a template (u {% endraw %} -*Light: ARC* +### Light: ARC {% raw %} @@ -323,8 +322,8 @@ If you need to generate codes for switches and lights, you can use a template (u {% endraw %} +### Light: Lightwave RF -*Light: Lightwave RF* {% raw %} ```yaml @@ -333,7 +332,6 @@ If you need to generate codes for switches and lights, you can use a template (u {% endraw %} - - Use this code to add a new switch in the options menu. - Launch your Home Assistant and go to the website. - Enable learning mode on your switch (i.e., push learn button or plug it in a wall socket) diff --git a/source/_integrations/ring.markdown b/source/_integrations/ring.markdown index d6b7a3c5db3..f98d6589e7f 100644 --- a/source/_integrations/ring.markdown +++ b/source/_integrations/ring.markdown @@ -59,6 +59,7 @@ downloader: Then you can use the following automation, with the entities from your system, which will save the video file under `/downloads/ring_/`: {% raw %} + ```yaml automation: alias: 'Save the video when the doorbell is pushed' @@ -73,6 +74,7 @@ automation: subdir: "{{state_attr('camera.front_door', 'friendly_name')}}" filename: "{{state_attr('camera.front_door', 'friendly_name')}}" ``` + {% endraw %} If you want to use `python_script`, enable it your `configuration.yaml` file first: diff --git a/source/_integrations/scrape.markdown b/source/_integrations/scrape.markdown index 793998ff6d4..a643ead125f 100644 --- a/source/_integrations/scrape.markdown +++ b/source/_integrations/scrape.markdown @@ -85,6 +85,7 @@ In this section you find some real-life examples of how to use this sensor. Ther The current release Home Assistant is published on [https://www.home-assistant.io/](/) {% raw %} + ```yaml sensor: # Example configuration.yaml entry @@ -94,6 +95,7 @@ sensor: select: ".current-version h1" value_template: '{{ value.split(":")[1] }}' ``` + {% endraw %} ### Available implementations @@ -101,6 +103,7 @@ sensor: Get the counter for all our implementations from the [Component overview](/integrations/) page. {% raw %} + ```yaml # Example configuration.yaml entry sensor: @@ -110,6 +113,7 @@ sensor: select: 'a[href="#all"]' value_template: '{{ value.split("(")[1].split(")")[0] }}' ``` + {% endraw %} ### Get a value out of a tag @@ -160,6 +164,7 @@ sensor: This example tries to retrieve the price for electricity. {% raw %} + ```yaml # Example configuration.yaml entry sensor: @@ -170,6 +175,7 @@ sensor: value_template: '{{ ((value.split(" ")[0]) | replace (",", ".")) }}' unit_of_measurement: "öre/kWh" ``` + {% endraw %} ### BOM Weather @@ -177,6 +183,7 @@ sensor: The Australian Bureau of Meteorology website returns an error if the User Agent header is not sent. {% raw %} + ```yaml # Example configuration.yaml entry sensor: @@ -190,4 +197,5 @@ sensor: headers: User-Agent: Mozilla/5.0 ``` + {% endraw %} diff --git a/source/_integrations/script.markdown b/source/_integrations/script.markdown index 3739d0ed09b..6e45c642dd1 100644 --- a/source/_integrations/script.markdown +++ b/source/_integrations/script.markdown @@ -233,6 +233,7 @@ Following is an example of the calling script not waiting. It performs some othe This technique can also be used for the calling script to wait for the called script, but _not_ be aborted if the called script aborts due to errors. {% raw %} + ```yaml script: script_1: @@ -247,4 +248,5 @@ script: sequence: # Do some things at the same time as the first script... ``` + {% endraw %} diff --git a/source/_integrations/sensor.mqtt.markdown b/source/_integrations/sensor.mqtt.markdown index b3566daaf68..b524bffa421 100644 --- a/source/_integrations/sensor.mqtt.markdown +++ b/source/_integrations/sensor.mqtt.markdown @@ -250,7 +250,6 @@ home/bathroom/analog/brightness 290.00 The configuration will look like the example below: -{% raw %} ```yaml # Example configuration.yaml entry sensor: @@ -258,4 +257,3 @@ sensor: name: "Brightness" state_topic: "home/bathroom/analog/brightness" ``` -{% endraw %} diff --git a/source/_integrations/serial.markdown b/source/_integrations/serial.markdown index d75b4df2f1d..c7a2da30576 100644 --- a/source/_integrations/serial.markdown +++ b/source/_integrations/serial.markdown @@ -84,9 +84,11 @@ value_template: ### TMP36 {% raw %} + ```yaml "{{ (((states('sensor.serial_sensor') | float * 5 / 1024 ) - 0.5) * 100) | round(1) }}" ``` + {% endraw %} ## Examples @@ -127,6 +129,7 @@ $,24.3,51,12.8,1029.76,0.0,0.00,* To parse this into individual sensors, split using the comma delimiter and then create a template sensor for each item of interest. {% raw %} + ```yaml # Example configuration.yaml entry sensor: @@ -149,6 +152,7 @@ sensor: unit_of_measurement: "mbar" value_template: "{{ states('sensor.serial_sensor').split(',')[4] | float }}" ``` + {% endraw %} ### Digispark USB Development Board diff --git a/source/_integrations/seventeentrack.markdown b/source/_integrations/seventeentrack.markdown index 4e6b1d99188..2f32705306b 100644 --- a/source/_integrations/seventeentrack.markdown +++ b/source/_integrations/seventeentrack.markdown @@ -58,6 +58,7 @@ show_delivered: Use the following templated Markdown card to list all packages in transit along their status: {% raw %} + ```yaml type: markdown title: Packages in transit @@ -69,4 +70,5 @@ content: >- {% endfor %} ``` + {% endraw %} diff --git a/source/_integrations/shell_command.markdown b/source/_integrations/shell_command.markdown index a5028bf72e3..bb6871df323 100644 --- a/source/_integrations/shell_command.markdown +++ b/source/_integrations/shell_command.markdown @@ -38,7 +38,6 @@ Any service data passed into the service call to activate the shell command will `stdout` and `stderr` output from the command are both captured and will be logged by setting the [log level](/integrations/logger/) to debug. ```yaml - # Apply value of a GUI slider to the shell_command automation: - alias: run_set_ac diff --git a/source/_integrations/snips.markdown b/source/_integrations/snips.markdown index 0390657c49c..445fc66de4b 100644 --- a/source/_integrations/snips.markdown +++ b/source/_integrations/snips.markdown @@ -145,6 +145,7 @@ In Home Assistant, we trigger actions based on intents produced by Snips using t Note: If your Snips action is prefixed with a username (e.g., `john:playmusic` or `john__playmusic`), the Snips integration in Home Assistant will try and strip off the username. Bear this in mind if you get the error `Received unknown intent` even when what you see on the MQTT bus looks correct. Internally the Snips integration is trying to match the non-username version of the intent (i.e., just `playmusic`). {% raw %} + ```yaml snips: @@ -156,6 +157,7 @@ intent_script: entity_id: 'light.{{ objectLocation | replace(" ","_") }}' color_name: '{{ objectColor }}' ``` + {% endraw %} In the `data` block, we have access to special variables, corresponding to the slot names for the intent. In the present case, the `ActivateLightColor` has two slots, `objectLocation` and `objectColor`. @@ -169,6 +171,7 @@ In the above example, the slots are plain strings. However, Snips has a duration In this example if we had an intent triggered with 'Set a timer for five minutes', `duration:` would equal 300 and `duration_raw:` would be set to 'five minutes'. The duration can be easily used to trigger Home Assistant events and the `duration_raw:` could be used to send a human readable response or alert. {% raw %} + ```yaml SetTimer: speech: @@ -184,6 +187,7 @@ SetTimer: duration_raw: "{{ raw_value }}" probability: "{{ probability }}" ``` + {% endraw %} ### Sending TTS Notifications @@ -288,6 +292,7 @@ So now you can open and close your garage door, let's check the weather. Add the Then add this to your configuration file. {% raw %} + ```yaml intent_script: searchWeatherForecast: @@ -301,4 +306,5 @@ intent_script: {{ states('sensor.dark_sky_weather_daily_high_temperature') | round(0)}} and {{ states('sensor.dark_sky_weather_hourly_summary') }} ``` + {% endraw %} diff --git a/source/_integrations/snmp.markdown b/source/_integrations/snmp.markdown index d2796785792..3ae76681929 100644 --- a/source/_integrations/snmp.markdown +++ b/source/_integrations/snmp.markdown @@ -225,6 +225,7 @@ According to the most common SNMP standard, the uptime of a device is accessible To create a sensor that displays the uptime for your printer in minutes, you can use this configuration: {% raw %} + ```yaml # Example configuration.yaml entry sensor: @@ -236,6 +237,7 @@ sensor: unit_of_measurement: 'minutes' value_template: '{{((value | int) / 6000) | int}}' ``` + {% endraw %} The `accept_errors` option will allow the sensor to work even if the printer is not on when Home Assistant is first started: the sensor will just display a `-` instead of a minute count. diff --git a/source/_integrations/solaredge.markdown b/source/_integrations/solaredge.markdown index b75f010fdd9..ae5c74ed33b 100644 --- a/source/_integrations/solaredge.markdown +++ b/source/_integrations/solaredge.markdown @@ -24,14 +24,12 @@ There are 2 options in configuring the SolarEdge integration: - Via the Home Assistant user interface where it will let you enter the port string to connect to the Velbus bus. - Via the Home Assistant `configuration.yaml` file. -{% raw %} ```yaml # Example configuration.yaml entry solaredge: api_key: API_KEY site_id: SITE_ID ``` -{% endraw %} {% configuration %} api_key: @@ -54,6 +52,7 @@ name: In case you would like to convert the values for example to kWh instead of the default Wh, you can use the [template platform](/integrations/template). {% raw %} + ```yaml # Example configuration.yaml entry for template platform sensor: @@ -62,4 +61,5 @@ sensor: solaredge_energy_this_year_template: value_template: "{{ (states('sensor.solaredge_energy_this_year') | float / 1000) | round(2) }}" ``` + {% endraw %} diff --git a/source/_integrations/solaredge_local.markdown b/source/_integrations/solaredge_local.markdown index d71162add9f..e79e009e8f9 100644 --- a/source/_integrations/solaredge_local.markdown +++ b/source/_integrations/solaredge_local.markdown @@ -64,6 +64,7 @@ sensor: In case you would like to convert the values for example to kWh instead of the default Wh, you can use the [template platform](/integrations/template). {% raw %} + ```yaml # Example configuration.yaml entry for sensor template platform sensor: @@ -74,4 +75,5 @@ sensor: unit_of_measurement: 'KWh' icon_template: "mdi:solar-power" ``` + {% endraw %} diff --git a/source/_integrations/solarlog.markdown b/source/_integrations/solarlog.markdown index 239311e65b3..dcf5e9264ea 100644 --- a/source/_integrations/solarlog.markdown +++ b/source/_integrations/solarlog.markdown @@ -62,6 +62,7 @@ sensor: In case you would like to convert the values, for example, to Wh instead of the default kWh, you can use the [template platform](/integrations/template/). {% raw %} + ```yaml # Example configuration.yaml entry for sensor template platform sensor: @@ -70,6 +71,7 @@ sensor: solarlog_yield_day_template: value_template: "{{ (states('sensor.solarlog_yield_day') | float * 1000) | round(0) }}" ``` + {% endraw %} ## Sensors diff --git a/source/_integrations/solax.markdown b/source/_integrations/solax.markdown index 7ed262eecf1..fb7d708b853 100644 --- a/source/_integrations/solax.markdown +++ b/source/_integrations/solax.markdown @@ -41,6 +41,7 @@ port: If you would like to convert the values from multiple panels or view the total power the house is using, you can use the [template platform](/integrations/template). {% raw %} + ```yaml # Example configuration.yaml entry for template platform sensors: @@ -55,6 +56,7 @@ sensors: unit_of_measurement: 'W' value_template: "{{ (states('sensor.power_now') | float) - (states('sensor.exported_power') | float) }}" ``` + {% endraw %} ### Note diff --git a/source/_integrations/speedtestdotnet.markdown b/source/_integrations/speedtestdotnet.markdown index e83ae950d96..4ec5fb1fac7 100644 --- a/source/_integrations/speedtestdotnet.markdown +++ b/source/_integrations/speedtestdotnet.markdown @@ -101,6 +101,7 @@ speedtestdotnet: ### Using as a trigger in an automation {% raw %} + ```yaml # Example configuration.yaml entry automation: @@ -118,6 +119,7 @@ automation: action: - service: shell_command.red ``` + {% endraw %} ## Notes diff --git a/source/_integrations/splunk.markdown b/source/_integrations/splunk.markdown index 6a680d058d3..b8dd423be27 100644 --- a/source/_integrations/splunk.markdown +++ b/source/_integrations/splunk.markdown @@ -87,8 +87,6 @@ filter: By default, no entity will be excluded. To limit which entities are being exposed to `Splunk`, you can use the `filter` parameter. -{% raw %} - ```yaml # Example filter to include specified domains and exclude specified entities splunk: @@ -103,8 +101,6 @@ splunk: - light.kitchen_light ``` -{% endraw %} - Filters are applied as follows: 1. No includes or excludes - pass all entities diff --git a/source/_integrations/sql.markdown b/source/_integrations/sql.markdown index 8de5999f1e1..59681e16faf 100644 --- a/source/_integrations/sql.markdown +++ b/source/_integrations/sql.markdown @@ -86,7 +86,6 @@ The query will look like this: SELECT * FROM states WHERE entity_id = 'sensor.temperature_in' ORDER BY state_id DESC LIMIT 1; ``` -{% raw %} ```yaml # Example configuration.yaml sensor: @@ -96,7 +95,6 @@ sensor: query: "SELECT * FROM states WHERE entity_id = 'sensor.temperature_in' ORDER BY state_id DESC LIMIT 1;" column: 'state' ``` -{% endraw %} Note that the SQL sensor state corresponds to the last row of the SQL result set. @@ -113,6 +111,7 @@ SELECT * FROM states WHERE entity_id = 'binary_sensor.xyz789' GROUP BY state ORD #### Postgres {% raw %} + ```yaml sensor: - platform: sql @@ -123,6 +122,7 @@ sensor: column: "db_size" unit_of_measurement: MB ``` + {% endraw %} #### MariaDB/MySQL @@ -130,6 +130,7 @@ sensor: Change `table_schema="hass"` to the name that you use as the database name, to ensure that your sensor will work properly. {% raw %} + ```yaml sensor: - platform: sql @@ -140,6 +141,7 @@ sensor: column: 'value' unit_of_measurement: kB ``` + {% endraw %} #### SQLite @@ -147,6 +149,7 @@ sensor: If you are using the `recorder` integration then you don't need to specify the location of the database. For all other cases, add `db_url: sqlite:////path/to/database.db`. {% raw %} + ```yaml sensor: - platform: sql @@ -156,4 +159,5 @@ sensor: column: 'size' unit_of_measurement: 'MiB' ``` + {% endraw %} diff --git a/source/_integrations/switch.mqtt.markdown b/source/_integrations/switch.mqtt.markdown index 3f60cf4c92c..41f3214e673 100644 --- a/source/_integrations/switch.mqtt.markdown +++ b/source/_integrations/switch.mqtt.markdown @@ -215,7 +215,6 @@ mosquitto_pub -h 127.0.0.1 -t home/bathroom/gpio/13 -m "1" The configuration will look like the example below: -{% raw %} ```yaml # Example configuration.yaml entry switch: @@ -226,4 +225,3 @@ switch: payload_on: "1" payload_off: "0" ``` -{% endraw %} diff --git a/source/_integrations/system_log.markdown b/source/_integrations/system_log.markdown index 336d6535a02..ac2a61deedd 100644 --- a/source/_integrations/system_log.markdown +++ b/source/_integrations/system_log.markdown @@ -104,6 +104,7 @@ automation: This automation will create a persistent notification whenever an error or warning is logged that has the word "service" in the message: {% raw %} + ```yaml automation: - alias: Create notifications for "service" errors @@ -119,13 +120,13 @@ automation: title: Something bad happened message: '{{ trigger.event.data.message }}' ``` + {% endraw %} ### Writing to log This automation will create a new log entry when the door is opened: -{% raw %} ```yaml automation: - alias: Log door opened @@ -139,5 +140,4 @@ automation: data: message: 'Door opened!' level: info -``` -{% endraw %} +``` \ No newline at end of file diff --git a/source/_integrations/telnet.markdown b/source/_integrations/telnet.markdown index da958068bfa..d42a04af560 100644 --- a/source/_integrations/telnet.markdown +++ b/source/_integrations/telnet.markdown @@ -13,6 +13,7 @@ The `telnet` switch platform allows you to control devices with telnet commands. To enable this switch, add the following lines to your `configuration.yaml` file: {% raw %} + ```yaml # Example configuration.yaml entry switch: @@ -27,6 +28,7 @@ switch: value_template: '{{ value == "PWR=01" }}' timeout: 0.9 ``` + {% endraw %} {% configuration %} diff --git a/source/_integrations/template.markdown b/source/_integrations/template.markdown index 7f73ab9e8e2..34638fdebd9 100644 --- a/source/_integrations/template.markdown +++ b/source/_integrations/template.markdown @@ -289,6 +289,7 @@ sensor: This example shows how to add custom attributes. {% raw %} + ```yaml sensor: - platform: template diff --git a/source/_integrations/thermoworks_smoke.markdown b/source/_integrations/thermoworks_smoke.markdown index 751b7bcfafc..694110dfa59 100644 --- a/source/_integrations/thermoworks_smoke.markdown +++ b/source/_integrations/thermoworks_smoke.markdown @@ -53,7 +53,6 @@ This section includes some examples of how to use this sensor. This will show only Probe 1 with min and max data. -{% raw %} ```yaml # Example configuration.yaml entry sensor: @@ -65,13 +64,11 @@ sensor: - probe1_min - probe1_max ``` -{% endraw %} ### Ignore a Device This will exclude a device from creating sensors. You would replace `"00:00:00:00:00:00"` with your device's serial number. -{% raw %} ```yaml # Example configuration.yaml entry sensor: @@ -81,7 +78,6 @@ sensor: exclude: - "00:00:00:00:00:00" ``` -{% endraw %} ### Notify when Probe 1 goes above a certain temperature @@ -89,6 +85,7 @@ This will use an automation to trigger a notification when Probe 1 goes above a By default, your smoke is named "My Smoke" in the app. If you have changed it you will need to change the sensor name from `my_smoke_probe_1` to `your_name_probe_1`. {% raw %} + ```yaml # Example configuration.yaml entry sensor: @@ -125,4 +122,5 @@ automation: {{- ' '+states("sensor.my_smoke_probe_1") -}} {{- state_attr('sensor.my_smoke_probe_1','unit_of_measurement') }} ``` + {% endraw %} diff --git a/source/_integrations/threshold.markdown b/source/_integrations/threshold.markdown index 4157085a22e..13a9cb5fad7 100644 --- a/source/_integrations/threshold.markdown +++ b/source/_integrations/threshold.markdown @@ -19,9 +19,11 @@ If the sensor is configured with no hysteresis and the sensor value is equal to It's an alternative to the template binary sensor's `value_template:` to get the abnormal/too high/too low states. {% raw %} + ```yaml {{ states('sensor.furnace') > 2.5 }} ``` + {% endraw %} ## Configuration diff --git a/source/_integrations/time_date.markdown b/source/_integrations/time_date.markdown index 0d2976fe4bd..294034b863b 100644 --- a/source/_integrations/time_date.markdown +++ b/source/_integrations/time_date.markdown @@ -65,6 +65,6 @@ sensor: friendly_name: "Date and time" value_template: "{{ as_timestamp(states('sensor.date_time_iso')) | timestamp_custom('%A %B %-m, %I:%M %p') }}" icon_template: mdi:calendar-clock -``` +``` {% endraw %} diff --git a/source/_integrations/tplink.markdown b/source/_integrations/tplink.markdown index 941d4cf3732..45a673422d5 100644 --- a/source/_integrations/tplink.markdown +++ b/source/_integrations/tplink.markdown @@ -145,6 +145,7 @@ In order to get the power consumption readings from a TP-Link HS110 device, you' In the example below, change all of the `my_tp_switch`'s to match your device's entity ID (without the domain). For example, if your entity is `switch.whale_heater` then replace `my_tp_switch` with `whale_heater`: {% raw %} + ```yaml sensor: - platform: template @@ -170,4 +171,5 @@ sensor: value_template: "{{ state_attr('switch.my_tp_switch','today_energy_kwh') | float }}" unit_of_measurement: 'kWh' ``` + {% endraw %} diff --git a/source/_integrations/transmission.markdown b/source/_integrations/transmission.markdown index 66e36b71661..dfc931ef4a9 100644 --- a/source/_integrations/transmission.markdown +++ b/source/_integrations/transmission.markdown @@ -93,6 +93,7 @@ Inside of the event, there is the name of the torrent that is started or complet Example of configuration of an automation with completed torrents: {% raw %} + ```yaml - alias: Completed Torrent trigger: @@ -104,6 +105,7 @@ Example of configuration of an automation with completed torrents: title: "Torrent completed!" message: "{{trigger.event.data.name}}" ``` + {% endraw %} ## Services @@ -135,6 +137,7 @@ Removes a torrent from the client. All `*_torrents` sensors e.g. `sensor.transmission_total_torrents` or `sensor.transmission_started_torrents` have a state attribute `torrent_info` that contains information about the torrents that are currently in a corresponding state. You can see this information in **Developer Tools** -> **States** -> `sensor.transmission_total_torrents` -> **Attributes**, or by adding a [Markdown card](/lovelace/markdown/) to Lovelace with the following code: {% raw %} + ```yaml content: > {% set payload = state_attr('sensor.transmission_total_torrents', 'torrent_info') %} @@ -144,4 +147,5 @@ content: > {{ name|truncate(20) }} is {{ data.percent_done }}% complete, {{ data.eta }} remaining {% endfor %} type: markdown ``` + {% endraw %} diff --git a/source/_integrations/transport_nsw.markdown b/source/_integrations/transport_nsw.markdown index 6989b0673d2..b6cdd039367 100644 --- a/source/_integrations/transport_nsw.markdown +++ b/source/_integrations/transport_nsw.markdown @@ -84,6 +84,7 @@ sensor: The sensor returns n/a if no stop event is found within the next 24h. A `template` sensor can help building a more meaningful string. {% raw %} + ```yaml # Sample template sensor - platform: template @@ -97,4 +98,5 @@ The sensor returns n/a if no stop event is found within the next 24h. A `templat {{ state_attr('sensor.bus', 'route') }} in {{ state_attr('sensor.bus', 'due') }}m ({{ state_attr('sensor.bus', 'delay') }}) {% endif %} ``` + {% endraw %} diff --git a/source/_integrations/utility_meter.markdown b/source/_integrations/utility_meter.markdown index 3e6c537b35d..0474017c858 100644 --- a/source/_integrations/utility_meter.markdown +++ b/source/_integrations/utility_meter.markdown @@ -193,6 +193,7 @@ utility_meter: Additionally, you can add template sensors to compute daily and monthly total usage. {% raw %} + ```yaml sensor: - platform: template @@ -206,4 +207,5 @@ sensor: unit_of_measurement: kWh value_template: "{{ states('sensor.monthly_energy_offpeak')|float + states('sensor.monthly_energy_peak')|float }}" ``` + {% endraw %} diff --git a/source/_integrations/vacuum.mqtt.markdown b/source/_integrations/vacuum.mqtt.markdown index 79ae720a7a7..0f2330d699b 100644 --- a/source/_integrations/vacuum.mqtt.markdown +++ b/source/_integrations/vacuum.mqtt.markdown @@ -203,6 +203,7 @@ unique_id: ### Legacy configuration example {% raw %} + ```yaml # Example configuration.yaml entry vacuum: @@ -241,6 +242,7 @@ vacuum: - max send_command_topic: 'vacuum/send_command' ``` + {% endraw %} ### Legacy MQTT Protocol @@ -441,7 +443,6 @@ unique_id: ### State configuration example -{% raw %} ```yaml # Example configuration.yaml entry vacuum: @@ -469,7 +470,6 @@ vacuum: - max send_command_topic: 'vacuum/send_command' ``` -{% endraw %} ### State MQTT Protocol diff --git a/source/_integrations/vacuum.template.markdown b/source/_integrations/vacuum.template.markdown index 1f4cbd74279..7ffcfe3aada 100644 --- a/source/_integrations/vacuum.template.markdown +++ b/source/_integrations/vacuum.template.markdown @@ -177,6 +177,7 @@ vacuum: This example shows how to add custom attributes. {% raw %} + ```yaml vacuum: - platform: template @@ -195,4 +196,5 @@ vacuum: Charging {% endif %} ``` + {% endraw %} diff --git a/source/_integrations/vallox.markdown b/source/_integrations/vallox.markdown index 977aa2f9fb5..c2c63600a84 100644 --- a/source/_integrations/vallox.markdown +++ b/source/_integrations/vallox.markdown @@ -44,6 +44,7 @@ name: For convenient switching of ventilation profiles in the GUI, consider using an [input_select](../input_select) hooked to an automation, for example: {% raw %} + ```yaml input_select: ventilation_profile: @@ -65,11 +66,13 @@ automation: data: profile: "{{ states('input_select.ventilation_profile') }}" ``` + {% endraw %} In order to also update the input select in case some external event changes the Vallox profile (web interface, mechanical switch, reboot, etc...) you can use the following automation: {% raw %} + ```yaml automation: - alias: Update Vallox input_select @@ -83,6 +86,7 @@ automation: entity_id: input_select.ventilation_profile option: "{{ states('sensor.vallox_current_profile') }}" ``` + {% endraw %} ## Fan Services diff --git a/source/_integrations/version.markdown b/source/_integrations/version.markdown index 1b3eb3ab844..8a19fc59dfa 100644 --- a/source/_integrations/version.markdown +++ b/source/_integrations/version.markdown @@ -89,6 +89,7 @@ too, but it will not as Home Assistant is not ready when the sensor gets initialized. {% raw %} + ```yaml sensor: - platform: rest @@ -96,4 +97,5 @@ sensor: name: Current Version value_template: '{{ value_json.version }}' ``` + {% endraw %} diff --git a/source/_integrations/vivotek.markdown b/source/_integrations/vivotek.markdown index 81381c07375..e926223cef7 100644 --- a/source/_integrations/vivotek.markdown +++ b/source/_integrations/vivotek.markdown @@ -151,6 +151,7 @@ The path part of `filename` must be an entry in the `allowlist_external_dirs` in For example, the following action is an automation that would take a snapshot from "front_door_camera" and save it to /tmp with a timestamped filename. {% raw %} + ```yaml action: service: camera.snapshot @@ -158,4 +159,5 @@ action: entity_id: camera.front_door_camera filename: '/tmp/yourcamera_{{ now().strftime("%Y%m%d-%H%M%S") }}.jpg' ``` + {% endraw %} diff --git a/source/_integrations/waze_travel_time.markdown b/source/_integrations/waze_travel_time.markdown index 640e9a7c44a..d86d8d7df25 100644 --- a/source/_integrations/waze_travel_time.markdown +++ b/source/_integrations/waze_travel_time.markdown @@ -90,6 +90,7 @@ Using the flexible option to set a sensor value to the `destination`, you can se In the following example, the `Input Select` is converted into an address which is used to modify the destination for Waze route calculation from `device_tracker.myphone` location (It takes a few minutes for the value to update due to the interval of Waze data fetching). {% raw %} + ```yaml input_select: destination: @@ -145,6 +146,7 @@ sensor: avoid_toll_roads: true avoid_subscription_roads: true ``` + {% endraw %} ## Using the live map in an iFrame diff --git a/source/_integrations/withings.markdown b/source/_integrations/withings.markdown index c753af7cc4e..bd1e92b784b 100644 --- a/source/_integrations/withings.markdown +++ b/source/_integrations/withings.markdown @@ -118,8 +118,7 @@ use_webhook: ## Bonus: Template Sensors to Convert Kilograms to Pounds -In a text editor, replace ```USER_PROFILE_NAME``` in the template sensors below with your Withings User Profile Name defined in the Withings integration configuration. - +In a text editor, replace ```USER_PROFILE_NAME``` in the template sensors below with your Withings User Profile Name defined in the Withings integration configuration. {% raw %}