👕 Markdown style changes (#15861)

This commit is contained in:
Klaas Schoute 2020-12-09 18:48:17 +01:00 committed by GitHub
parent 46c4eb97f5
commit d99252f613
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
102 changed files with 307 additions and 168 deletions

View File

@ -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)`.

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -49,6 +49,7 @@ binary_sensor:
resource: http://IP_ADDRESS/ENDPOINT
method: POST
```
or a template based request:
```yaml

View File

@ -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.

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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`

View File

@ -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.

View File

@ -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

View File

@ -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 |

View File

@ -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 %}

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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 %}

View File

@ -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

View File

@ -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 %}

View File

@ -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:

View File

@ -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 %}

View File

@ -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 %}

View File

@ -68,6 +68,7 @@ covers:
</p>
{% 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.

View File

@ -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

View File

@ -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 %}

View File

@ -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

View File

@ -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 %}

View File

@ -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 %}
<div class='note'>

View File

@ -328,8 +328,6 @@ Please remember that you can only have a single `automation` entry. Add the auto
</div>
{% 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

View File

@ -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.

View File

@ -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

View File

@ -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**.
<p class='img'>
<img src='/images/integrations/ifttt/finding_key.png' />
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.
</p>
{% 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 %}

View File

@ -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.

View File

@ -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.

View File

@ -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

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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

View File

@ -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

View File

@ -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 %}

View File

@ -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:

View File

@ -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

View File

@ -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 %}
<div class='note warning'>

View File

@ -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`.

View File

@ -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

View File

@ -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 %}

View File

@ -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

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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)

View File

@ -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 `<config>/downloads/ring_<camera_name>/`:
{% 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:

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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

View File

@ -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 %}

View File

@ -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

View File

@ -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 %}

View File

@ -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.

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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
@ -140,4 +141,3 @@ automation:
message: 'Door opened!'
level: info
```
{% endraw %}

View File

@ -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 %}

View File

@ -289,6 +289,7 @@ sensor:
This example shows how to add custom attributes.
{% raw %}
```yaml
sensor:
- platform: template

View File

@ -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 %}

View File

@ -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

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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

View File

@ -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 %}

View File

@ -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

View File

@ -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 %}

View File

@ -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 %}

View File

@ -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

Some files were not shown because too many files have changed in this diff Show More