Merge branch 'master' into next
Conflicts: source/_cookbook/custom_panel_using_react.markdown
This commit is contained in:
commit
1957efefb8
74 changed files with 845 additions and 311 deletions
|
@ -18,12 +18,12 @@ Most binary sensors support the `SENSOR_CLASSES` which let you specify the type
|
|||
- **None**: Generic on/off
|
||||
- **opening**: Door, window, etc
|
||||
- **motion**: Motion sensor
|
||||
- **gas'**: CO, CO2, etc
|
||||
- **smoke'**: Smoke detector
|
||||
- **gas**: CO, CO2, etc
|
||||
- **smoke**: Smoke detector
|
||||
- **moisture**: Specifically a wetness sensor
|
||||
- **light**: Lightness threshold
|
||||
- **power**: Power, over-current, etc
|
||||
- **safety**: Generic on=unsafe, off=safe
|
||||
- **safety**: On means unsafe, Off means safe
|
||||
- **heat**: On means hot (or too hot)
|
||||
- **cold**: On means cold (or too cold)
|
||||
- **moving**: On means moving, Off means stopped
|
||||
|
|
|
@ -17,11 +17,11 @@ To enable Template binary sensors in your installation, add the following to you
|
|||
```yaml
|
||||
# Example configuration.yaml entry
|
||||
binary_sensor:
|
||||
platform: template
|
||||
sensors:
|
||||
sun_up:
|
||||
value_template: {% raw %}'{{ states.sun.sun.attributes.elevation > 0}}'{% endraw %}
|
||||
friendly_name: 'Sun is up'
|
||||
- platform: template
|
||||
sensors:
|
||||
sun_up:
|
||||
value_template: {% raw %}'{{ states.sun.sun.attributes.elevation > 0}}'{% endraw %}
|
||||
friendly_name: 'Sun is up'
|
||||
```
|
||||
|
||||
Configuration variables:
|
||||
|
@ -30,8 +30,7 @@ Configuration variables:
|
|||
- **friendly_name** (*Optional*): Name to use in the Frontend.
|
||||
- **sensor_class** (*Optional*): The [type/class](/components/binary_sensor/) of the sensor to set the icon in the frontend.
|
||||
- **value_template** (*Optional*): Defines a [template](/topics/templating/) to extract a value from the payload.
|
||||
- **warnings** (*Optional*): Turn off warnings (useful if the sensor is loaded before devices it depends on).
|
||||
- **entity_id** (*Optional*): Add a list of entity_ids so the sensor only reacts to state changes of these entities. This will reduce the number of times the sensor will try to update it's state.
|
||||
- **entity_id** (*Optional*): Add a list of entity IDs so the sensor only reacts to state changes of these entities. This will reduce the number of times the sensor will try to update it's state.
|
||||
|
||||
## {% linkable_title Examples %}
|
||||
|
||||
|
@ -43,26 +42,26 @@ This example indicates true if a sensor is above a given threshold. Assuming a s
|
|||
|
||||
```yaml
|
||||
sensor:
|
||||
platform: template
|
||||
sensors:
|
||||
furnace_on:
|
||||
value_template: {% raw %}{{ states.sensor.furnace.state > 2.5 }}{% endraw %}
|
||||
friendly_name: 'Furnace Running
|
||||
sensor_class: heat
|
||||
- platform: template
|
||||
sensors:
|
||||
furnace_on:
|
||||
value_template: {% raw %}{{ states.sensor.furnace.state > 2.5 }}{% endraw %}
|
||||
friendly_name: 'Furnace Running
|
||||
sensor_class: heat
|
||||
```
|
||||
|
||||
### {% linkable_title Switch as sensor %}
|
||||
|
||||
Some movement sensors and door/window sensors will apear as a switch. By using a template binary sensor, the switch can be displayed as a binary sensors. The original switch can then be hidden by [customizing.](/getting-started/customizing-devices/)
|
||||
Some movement sensors and door/window sensors will appear as a switch. By using a template binary sensor, the switch can be displayed as a binary sensors. The original switch can then be hidden by [customizing.](/getting-started/customizing-devices/)
|
||||
|
||||
```yaml
|
||||
binary_sensor:
|
||||
platform: template
|
||||
sensors:
|
||||
movement:
|
||||
value_template: {% raw %}"{{ states.switch.movement.state == 'on' }}"{% endraw %}
|
||||
sensor_class: motion
|
||||
door:
|
||||
value_template: {% raw %}"{{ states.switch.door.state == 'on' }}"{% endraw %}
|
||||
sensor_class: opening
|
||||
- platform: template
|
||||
sensors:
|
||||
movement:
|
||||
value_template: {% raw %}"{{ states.switch.movement.state == 'on' }}"{% endraw %}
|
||||
sensor_class: motion
|
||||
door:
|
||||
value_template: {% raw %}"{{ states.switch.door.state == 'on' }}"{% endraw %}
|
||||
sensor_class: opening
|
||||
```
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
layout: page
|
||||
title: "Bluetooth Tracker"
|
||||
description: "Instructions how to integrate bluetooth tracking within Home Assistant."
|
||||
description: "Instructions for integrating bluetooth tracking within Home Assistant."
|
||||
date: 2016-04-10 17:24
|
||||
sidebar: true
|
||||
comments: false
|
||||
|
@ -13,11 +13,11 @@ ha_iot_class: "Local Poll"
|
|||
ha_release: 0.18
|
||||
---
|
||||
|
||||
This tracker discovers new devices on boot and tracks bluetooth devices periodically based on interval_seconds value. It is not requiered to pair the devices with eachother!
|
||||
Devices discovered are stored with 'bt_' as the prefix for device mac address in `known_devices.yaml`.
|
||||
This tracker discovers new devices on boot and tracks bluetooth devices periodically based on interval_seconds value. It is not required to pair the devices with each other!
|
||||
Devices discovered are stored with 'bt_' as the prefix for device mac addresses in `known_devices.yaml`.
|
||||
|
||||
<p class='note'>
|
||||
Requires PyBluez. If you are on raspbian, make sure you first install `bluetooth` and `libbluetooth-dev` by running `sudo apt install bluetooth libbluetooth-dev`
|
||||
Requires PyBluez. If you are on Raspbian, make sure you first install `bluetooth` and `libbluetooth-dev` by running `sudo apt install bluetooth libbluetooth-dev`
|
||||
</p>
|
||||
|
||||
To use the Bluetooth tracker in your installation, add the following to your `configuration.yaml` file:
|
||||
|
|
|
@ -10,7 +10,7 @@ footer: true
|
|||
logo: homematic.png
|
||||
ha_category: Hub
|
||||
ha_iot_class: "Local Push"
|
||||
featured: true
|
||||
featured: false
|
||||
---
|
||||
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@ http:
|
|||
ssl_certificate: /etc/letsencrypt/live/hass.example.com/fullchain.pem
|
||||
ssl_key: /etc/letsencrypt/live/hass.example.com/privkey.pem
|
||||
cors_allowed_origins:
|
||||
- google.com
|
||||
- home-assistant.io
|
||||
- https://google.com
|
||||
- https://home-assistant.io
|
||||
```
|
||||
|
||||
Configuration variables:
|
||||
|
@ -37,7 +37,7 @@ Configuration variables:
|
|||
- **development** (*Optional*): Disable caching and load unvulcanized assets. Useful for Frontend development.
|
||||
- **ssl_certificate** (*Optional*): Path to your TLS/SSL certificate to serve Home Assistant over a secure connection.
|
||||
- **ssl_key** (*Optional*): Path to your TLS/SSL key to serve Home Assistant over a secure connection.
|
||||
- **cors_allowed_origins** (*Optional*): A list of origin domain names to allow [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) requests from. Enabling this will set the `Access-Control-Allow-Origin` header to the Origin header if it is found in the list, and the `Access-Control-Allow-Headers` to `Origin, Accept, X-Requested-With, Content-type, X-HA-access`.
|
||||
- **cors_allowed_origins** (*Optional*): A list of origin domain names to allow [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) requests from. Enabling this will set the `Access-Control-Allow-Origin` header to the Origin header if it is found in the list, and the `Access-Control-Allow-Headers` header to `Origin, Accept, X-Requested-With, Content-type, X-HA-access`. You must provide the exact Origin, i.e. `https://home-assistant.io` will allow requests from `https://home-assistant.io` but __not__ `http://home-assistant.io`.
|
||||
|
||||
|
||||
The [Set up encryption using Let's Encrypt](/blog/2015/12/13/setup-encryption-using-lets-encrypt/) blog post gives you details about the encryption of your traffic using free certificates from [Let's Encrypt](https://letsencrypt.org/).
|
||||
|
|
|
@ -9,7 +9,7 @@ sharing: true
|
|||
footer: true
|
||||
ha_category: Light
|
||||
ha_iot_class: "Local Polling"
|
||||
featured: true
|
||||
featured: false
|
||||
ha_release: 0.25
|
||||
---
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ Turns one light on or multiple lights on using [groups]({{site_root}}/components
|
|||
| `transition` | yes | Integer that represents the time the light should take to transition to the new state in seconds. *not supported by Wink
|
||||
| `profile` | yes | String with the name of one of the built-in profiles (relax, energize, concentrate, reading) or one of the custom profiles defined in `light_profiles.csv` in the current working directory. Light profiles define a xy color and a brightness. If a profile is given and a brightness or xy color then the profile values will be overwritten.
|
||||
| `xy_color` | yes | A list containing two floats representing the xy color you want the light to be. Two comma seperated floats that represent the color in XY.
|
||||
| `rgb_color` | yes | A list containing three integers representing the xy color you want the light to be. Three comma seperated integers that represent the color in RGB
|
||||
| `rgb_color` | yes | A list containing three integers representing the rgb color you want the light to be. Three comma seperated integers that represent the color in RGB
|
||||
| `color_temp` | yes | An INT in mireds representing the color temperature you want the light to be.
|
||||
| `color_name` | yes | A human readable string of a color name, such as `blue` or `goldenrod` or [`chucknorris`](http://stackoverflow.com/questions/8318911/why-does-html-think-chucknorris-is-a-color). If your browser can display it, so can Home Assistant.
|
||||
| `brightness` | yes | Integer between 0 and 255 for how bright the color should be.
|
||||
|
|
|
@ -27,7 +27,7 @@ Steps to configure your Amazon Fire TV stick with Home Assistant:
|
|||
- From the main (Launcher) screen, select Settings.
|
||||
- Select System > About > Network.
|
||||
- `pip install firetv[firetv-server]` into a Python 2.x environment
|
||||
- If installed on Debian Jessie then the libssl-dev package is needed. Install it with `apt-get install libssl-dev`
|
||||
- If installed on Debian Jessie then the libssl-dev and python-dev packages are needed. Install them with `apt-get install libssl-dev python-dev`
|
||||
- `firetv-server -d <fire tv device IP>:5555`, background the process
|
||||
- Configure Home Assistant as follows:
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ sharing: true
|
|||
footer: true
|
||||
logo: mpchc.png
|
||||
ha_category: Media Player
|
||||
featured: true
|
||||
featured: false
|
||||
ha_release: 0.25.0
|
||||
---
|
||||
|
||||
|
|
|
@ -47,3 +47,12 @@ In case [discovery](/components/discovery/) does not work (GDM disabled or non-l
|
|||
- **TOKEN** (*Optional*): Only if authentication is required. Set to `null` (without quotes) otherwise.
|
||||
|
||||
At this moment, the Plex platform only supports one Plex Media Server.
|
||||
|
||||
It is possible to get errors that look like the following.
|
||||
|
||||
```
|
||||
ERROR:plexapi:http://192.168.1.10:32400: ('Connection aborted.', BadStatusLine("''",))
|
||||
INFO:homeassistant.components.media_player.plex:No server found at: http://192.168.1.10:32400
|
||||
```
|
||||
|
||||
If this occurs, try changing the setting `Secure connections` in your Plex Media Server to `Preferred` (instead of `Required`). The Plex component does not currently support HTTPS.
|
||||
|
|
|
@ -20,16 +20,7 @@ The requirements are:
|
|||
- You need a [Telegram bot](https://core.telegram.org/bots). Please follow those [instructions](https://core.telegram.org/bots#botfather) to create one and get the token for your bot. Keep in mind that bots are not allowed to contact users. You need to make the first contact with your user. Meaning that you need to send a message to the bot from your user.
|
||||
- The `chat_id` of an user.
|
||||
|
||||
An easy way to get your chat ID is described below:
|
||||
|
||||
```python
|
||||
import telegram
|
||||
bot = telegram.Bot(token='YOUR_API_TOKEN')
|
||||
chat_id = bot.getUpdates()[-1].message.chat_id
|
||||
print(chat_id)
|
||||
```
|
||||
|
||||
Another way to retrieve your `chat_id` is visiting [https://api.telegram.org/botYOUR_API_TOKEN/getUpdates](https://api.telegram.org/botYOUR_API_TOKEN/getUpdates).
|
||||
The quickest way to retrieve your `chat_id` is visiting [https://api.telegram.org/botYOUR_API_TOKEN/getUpdates](https://api.telegram.org/botYOUR_API_TOKEN/getUpdates).
|
||||
|
||||
The result set will include your chat ID as `id` in the `from` section:
|
||||
|
||||
|
@ -47,6 +38,16 @@ The result set will include your chat ID as `id` in the `from` section:
|
|||
...
|
||||
```
|
||||
|
||||
Another way to get your chat ID directly is described below:
|
||||
|
||||
```python
|
||||
import telegram
|
||||
bot = telegram.Bot(token='YOUR_API_TOKEN')
|
||||
chat_id = bot.getUpdates()[-1].message.chat_id
|
||||
print(chat_id)
|
||||
123456789
|
||||
```
|
||||
|
||||
To enable Telegram notifications in your installation, add the following to your `configuration.yaml` file:
|
||||
|
||||
```yaml
|
||||
|
|
|
@ -28,3 +28,5 @@ Configuration variables:
|
|||
|
||||
- **api_key** (*Required*): The retrieved api key.
|
||||
- **host** (*Required*): The octoprint host.
|
||||
|
||||
**NOTE** If your 3D printer isn't connected to the OctoPrint server during the startup of Home Assistant this component will fail to load.
|
||||
|
|
|
@ -15,6 +15,8 @@ ha_release: 0.25
|
|||
|
||||
The `panel_iframe` support allows you to add additional panels to your Home Assistant frontend. The panels are listed in the sidebar and can contain external resources like the web frontend of your router, your monitoring system, or your media server.
|
||||
|
||||
<p class='note warning'>If you are accessing home Assistant over HTTPS using SSL, you cannot access HTTP sites through an iframe panel.</p>
|
||||
|
||||
To enable Panel iFrames in your installation, add the following to your `configuration.yaml` file:
|
||||
|
||||
```yaml
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
layout: page
|
||||
title: "Vera Sensor"
|
||||
description: "Instructions how to integrate Vera sensors into Home Assistant."
|
||||
title: "Envisalink Sensor"
|
||||
description: "Instructions how to integrate Envisalink sensors into Home Assistant."
|
||||
date: 2016-07-01 10:00
|
||||
sidebar: true
|
||||
comments: false
|
||||
|
|
|
@ -61,3 +61,33 @@ sensor:
|
|||
value_template: {% raw %}'{{ value_json.batt }}'{% endraw %}
|
||||
```
|
||||
|
||||
### {% linkable_title Get temperature and humidity %}
|
||||
|
||||
If you are using a DHT sensor and a NodeMCU board (esp8266), you can retrieve temperature and humidity with a MQTT sensor. A code example can be found [here](https://github.com/mertenats/open-home-automation/tree/master/ha_mqtt_sensor_dht22). A regular MQTT message from this example looks like this:
|
||||
|
||||
```
|
||||
office/sensor1
|
||||
{
|
||||
"temperature": 23.20,
|
||||
"humidity": 43.70
|
||||
}
|
||||
```
|
||||
|
||||
Then use this configuration example to extract the data from the payload:
|
||||
|
||||
```yaml
|
||||
# Example configuration.yml entry
|
||||
sensor 1:
|
||||
platform: mqtt
|
||||
state_topic: 'office/sensor1'
|
||||
name: 'Temperature'
|
||||
unit_of_measurement: '°C'
|
||||
value_template: '{{ value_json.temperature }}'
|
||||
|
||||
sensor 2:
|
||||
platform: mqtt
|
||||
state_topic: 'office/sensor1'
|
||||
name: 'Humidity'
|
||||
unit_of_measurement: '%'
|
||||
value_template: '{{ value_json.humidity }}'
|
||||
```
|
||||
|
|
|
@ -8,6 +8,7 @@ comments: false
|
|||
sharing: true
|
||||
footer: true
|
||||
ha_category: Sensor
|
||||
logo: nzbget.png
|
||||
ha_iot_class: "Local Polling"
|
||||
ha_release: 0.17
|
||||
---
|
||||
|
|
|
@ -23,15 +23,16 @@ To enable this sensor, add the following lines to your `configuration.yaml` file
|
|||
```yaml
|
||||
# Example configuration.yaml entry
|
||||
sensor:
|
||||
platform: openexchangerates
|
||||
api_key: your_api_key
|
||||
base: USD #optional
|
||||
quote: EUR
|
||||
name: USDEUR #optional
|
||||
- platform: openexchangerates
|
||||
api_key: YOUR_API_KEY
|
||||
base: USD
|
||||
quote: EUR
|
||||
name: USDEUR
|
||||
```
|
||||
|
||||
Configuration variables:
|
||||
|
||||
- **api_key** (*Required*): API Key for [Open Exchange Rates](https://openexchangerates.org).
|
||||
- **name** (*Optional*): Name to use in the frontend.
|
||||
- **base** (*Optional*): The symbol of the base currency. Defaults to USD
|
||||
- **quote** (*Required*): The symbol of the quote or target currency.
|
||||
|
|
|
@ -50,7 +50,7 @@ Configuration variables:
|
|||
- **rain**: The rain volume.
|
||||
- **snow**: The snow volume
|
||||
|
||||
Details about the API are available in the [OpenWeatherMap documentation](http://bugs.openweathermap.org/projects/api/wiki).
|
||||
Details about the API are available in the [OpenWeatherMap documentation](http://openweathermap.org/api).
|
||||
|
||||
Only metric measurements are supported at the moment.
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ sharing: true
|
|||
footer: true
|
||||
ha_category: Sensor
|
||||
ha_release: pre 0.7
|
||||
ha_iot_class: "Local Push"
|
||||
---
|
||||
|
||||
The `systemmonitor` sensor platform to allow you to monitor disk usage, memory usage, CPU usage, and running processes. This platform has superseded the process component which is now considered deprecated.
|
||||
|
@ -18,12 +19,12 @@ To add this platform to your installation, add the following to your `configurat
|
|||
```yaml
|
||||
# Example configuration.yaml entry
|
||||
sensor:
|
||||
platform: systemmonitor
|
||||
resources:
|
||||
- type: disk_use_percent
|
||||
arg: /home
|
||||
- type: memory_free
|
||||
- type: processor_use
|
||||
- platform: systemmonitor
|
||||
resources:
|
||||
- type: disk_use_percent
|
||||
arg: /home
|
||||
- type: memory_free
|
||||
- type: processor_use
|
||||
```
|
||||
|
||||
Configuration variables:
|
||||
|
@ -34,7 +35,7 @@ Configuration variables:
|
|||
|
||||
The table contains types and their argument to use in your `configuration.yaml` file.
|
||||
|
||||
| Type (`- type:`) | Argument (`arg:`) |
|
||||
| Type (`type:`) | Argument (`arg:`) |
|
||||
| :------------------ |:-------------------------|
|
||||
| disk_use_percent | Path, eg. `/` |
|
||||
| disk_use | Path, eg. `/` |
|
||||
|
|
|
@ -18,14 +18,14 @@ To enable Template sensors in your installation, add the following to your `conf
|
|||
```yaml
|
||||
# Example configuration.yaml entry
|
||||
sensor:
|
||||
platform: template
|
||||
sensors:
|
||||
solar_angle:
|
||||
value_template: {% raw %}'{{ states.sun.sun.attributes.elevation }}'{% endraw %}
|
||||
friendly_name: 'Sun angle'
|
||||
unit_of_measurement: 'degrees'
|
||||
sunrise:
|
||||
value_template: {% raw %}'{{ states.sun.sun.attributes.next_rising }}'{% endraw %}
|
||||
- platform: template
|
||||
sensors:
|
||||
solar_angle:
|
||||
value_template: {% raw %}'{{ states.sun.sun.attributes.elevation }}'{% endraw %}
|
||||
friendly_name: 'Sun angle'
|
||||
unit_of_measurement: 'degrees'
|
||||
sunrise:
|
||||
value_template: {% raw %}'{{ states.sun.sun.attributes.next_rising }}'{% endraw %}
|
||||
```
|
||||
|
||||
Configuration variables:
|
||||
|
@ -34,8 +34,7 @@ Configuration variables:
|
|||
- **friendly_name** (*Optional*): Name to use in the Frontend.
|
||||
- **unit_of_measurement** (*Optional*): Defines the units of measurement of the sensor, if any.
|
||||
- **value_template** (*Optional*): Defines a [template](/topics/templating/) to extract a value from the payload.
|
||||
- **warnings** (*Optional*): Turn off warnings (useful if the sensor is loaded before devices it depends on).
|
||||
- **entity_id** (*Optional*): Add a list of entity_ids so the sensor only reacts to state changes of these entities. This will reduce the number of times the sensor will try to update it's state.
|
||||
- **entity_id** (*Optional*): Add a list of entity IDs so the sensor only reacts to state changes of these entities. This will reduce the number of times the sensor will try to update it's state.
|
||||
|
||||
|
||||
## {% linkable_title Examples %}
|
||||
|
@ -48,12 +47,12 @@ This example shows the sun angle in the frontend.
|
|||
|
||||
```yaml
|
||||
sensor:
|
||||
platform: template
|
||||
sensors:
|
||||
solar_angle:
|
||||
value_template: {% raw %}'{{ "%+.1f"|format(states.sun.sun.attributes.elevation) }}'{% endraw %}
|
||||
friendly_name: 'Sun Angle'
|
||||
unit_of_measurement: '°'
|
||||
- platform: template
|
||||
sensors:
|
||||
solar_angle:
|
||||
value_template: {% raw %}'{{ "%+.1f"|format(states.sun.sun.attributes.elevation) }}'{% endraw %}
|
||||
friendly_name: 'Sun Angle'
|
||||
unit_of_measurement: '°'
|
||||
```
|
||||
|
||||
### {% linkable_title Renaming sensor output %}
|
||||
|
@ -62,22 +61,22 @@ If you don't like the wording of a sensor output then the template sensor can he
|
|||
|
||||
```yaml
|
||||
sensor:
|
||||
platform: template
|
||||
sensors:
|
||||
sun_state:
|
||||
value_template: {% raw %}'{% if is_state("sun.sun", "above_horizon") %}up{% else %}down{% endif %}'{% endraw %}
|
||||
friendly_name: 'Sun state'
|
||||
- platform: template
|
||||
sensors:
|
||||
sun_state:
|
||||
value_template: {% raw %}'{% if is_state("sun.sun", "above_horizon") %}up{% else %}down{% endif %}'{% endraw %}
|
||||
friendly_name: 'Sun state'
|
||||
```
|
||||
|
||||
Processes monitored by the [System Monitor sensor](/components/sensor.systemmonitor/) show `on` or `off` if they are running or not. This example shows how the output of a monitored `glances` process can be renamed.
|
||||
|
||||
```yaml
|
||||
sensor:
|
||||
platform: template
|
||||
sensors:
|
||||
glances:
|
||||
value_template: {% raw %}'{% if is_state("sensor.process_glances", "off") %}not running{% else %}running{% endif %}'{% endraw %}
|
||||
friendly_name: 'Glances'
|
||||
- platform: template
|
||||
sensors:
|
||||
glances:
|
||||
value_template: {% raw %}'{% if is_state("sensor.process_glances", "off") %}not running{% else %}running{% endif %}'{% endraw %}
|
||||
friendly_name: 'Glances'
|
||||
```
|
||||
|
||||
By comparing the details published on the [template](/topics/templating/) page the same can be archived with a different approach:
|
||||
|
@ -88,31 +87,34 @@ value_template: {% raw %}"{%if states.sensor.ENTITY_ID.state == 'on' %}running{%
|
|||
|
||||
The [Binary template sensor](/components/binary_sensor.template/) is the one in similar cases if you prefer to see an icon instead of text.
|
||||
|
||||
### {% linkable_title Multiline example with an if test (and warnings disabled) %}
|
||||
### {% linkable_title Multiline example with an if test %}
|
||||
|
||||
This example shows a multiple line template with and if test. It looks at a sensing switch and shows on/off in the frontend. It disables warnings to avoid log messages where the switch it depends on isn't loaded yet.
|
||||
This example shows a multiple line template with and if test. It looks at a sensing switch and shows on/off in the frontend.
|
||||
|
||||
```yaml
|
||||
sensor:
|
||||
platform: template
|
||||
sensors:
|
||||
kettle:
|
||||
friendly_name: 'Kettle'
|
||||
{% raw %}value_template: >-
|
||||
{%- if is_state("switch.kettle", "off") %}
|
||||
off
|
||||
{% elif states.switch.kettle.attributes.kwh < 1000 %}
|
||||
standby
|
||||
{% elif is_state("switch.kettle", "on") %}
|
||||
on
|
||||
{% else %}
|
||||
failed
|
||||
{%- endif %}{% endraw %}
|
||||
- platform: template
|
||||
sensors:
|
||||
kettle:
|
||||
friendly_name: 'Kettle'
|
||||
{% raw %}value_template: >-
|
||||
{%- if is_state("switch.kettle", "off") %}
|
||||
off
|
||||
{% elif states.switch.kettle.attributes.kwh < 1000 %}
|
||||
standby
|
||||
{% elif is_state("switch.kettle", "on") %}
|
||||
on
|
||||
{% else %}
|
||||
failed
|
||||
{%- endif %}{% endraw %}
|
||||
|
||||
warnings: Off
|
||||
next_sensor:
|
||||
[...]
|
||||
```
|
||||
|
||||
(please note the blank line to close the multi-line template)
|
||||
<p class='note'>
|
||||
Please note the blank line to close the multi-line template.
|
||||
</p>
|
||||
|
||||
### {% linkable_title Change the unit of measurment %}
|
||||
|
||||
|
@ -120,15 +122,15 @@ With a template sensor it's easy to convert given values into others if the unit
|
|||
|
||||
```yaml
|
||||
sensor:
|
||||
platform: template
|
||||
sensors:
|
||||
transmission_down_speed_kbps:
|
||||
value_template: {% raw %}'{{ states.sensor.transmission_down_speed.state | multiply(1024) }}'{% endraw %}
|
||||
friendly_name: 'Transmission Down Speed'
|
||||
unit_of_measurement: 'kB/s'
|
||||
transmission_up_speed_kbps:
|
||||
value_template: {% raw %}'{{ states.sensor.transmission_up_speed.state | multiply(1024) }}'{% endraw %}
|
||||
friendly_name: 'Transmission Up Speed'
|
||||
unit_of_measurement: 'kB/s'
|
||||
- platform: template
|
||||
sensors:
|
||||
transmission_down_speed_kbps:
|
||||
value_template: {% raw %}'{{ states.sensor.transmission_down_speed.state | multiply(1024) }}'{% endraw %}
|
||||
friendly_name: 'Transmission Down Speed'
|
||||
unit_of_measurement: 'kB/s'
|
||||
transmission_up_speed_kbps:
|
||||
value_template: {% raw %}'{{ states.sensor.transmission_up_speed.state | multiply(1024) }}'{% endraw %}
|
||||
friendly_name: 'Transmission Up Speed'
|
||||
unit_of_measurement: 'kB/s'
|
||||
```
|
||||
|
||||
|
|
|
@ -11,30 +11,45 @@ logo: zigbee.png
|
|||
ha_category: Sensor
|
||||
---
|
||||
|
||||
There are two types of ZigBee sensor available to Home Assistant:
|
||||
There are two types of [ZigBee](http://www.zigbee.org/) sensor available to Home Assistant:
|
||||
|
||||
- [Analog input pin](#analog-input-pin)
|
||||
- [Temperature sensor](#temperature-sensor) (XBee Pro)
|
||||
|
||||
## {% linkable_title Analog Input Pin %}
|
||||
|
||||
The analog input pins on an XBee (non-Pro) will read 0V to 1.2V. This is translated by the [xbee-helper](https://github.com/flyte/xbee-helper) library into a percentage. The maximum voltage your ZigBee device will read is configurable using the `max_volts` configuration variable.
|
||||
|
||||
To configure an analog input pin sensor, use the following variables:
|
||||
|
||||
- **name** (*Required*): The name you'd like to give the sensor in Home Assistant.
|
||||
- **platform** (*Required*): Set to `zigbee`.
|
||||
- **type** (*Required*): Set to `analog`.
|
||||
- **pin** (*Required*): The number identifying which pin to sample.
|
||||
- **address**: The long 64bit address of the remote ZigBee device whose analog input pin you'd like to sample. Do not include this variable if you want to sample the local ZigBee device's pins.
|
||||
- **max_volts**: The maximum voltage which the analog input pin is able to read. Default: `1.2`
|
||||
|
||||
#### Example
|
||||
To configure an analog input pin sensor, add the following to your `configuration.yaml` file:
|
||||
|
||||
```yaml
|
||||
# Example configuration.yaml entry
|
||||
sensor:
|
||||
- name: My Analog Input
|
||||
platform: zigbee
|
||||
- platform: zigbee
|
||||
name: My Analog ZigBee Input
|
||||
type: analog
|
||||
pin: 0
|
||||
address: 0013A2004233D138
|
||||
```
|
||||
|
||||
Configuration variables:
|
||||
|
||||
- **name** (*Required*): The name you would like to give the sensor in Home Assistant.
|
||||
- **type** (*Required*): Set to `analog` or `temperature`.
|
||||
- **pin** (*Required*): The number identifying which pin to sample
|
||||
- **address** (*Optional*): The long 64 bit address of the remote ZigBee device whose pin you would like to sample. Do not include this variable if you want to sample the local ZigBee device's pins.
|
||||
- **max_volts** (*Optional*): The maximum voltage which the input pin is able to read. Defaults to `1.2`
|
||||
|
||||
|
||||
## {% linkable_title Examples %}
|
||||
|
||||
### {% linkable_title Analog Input Pin %}
|
||||
|
||||
The analog input pins on an XBee (non-Pro) will read 0V to 1.2 V. This is translated by the [xbee-helper](https://github.com/flyte/xbee-helper) library into a percentage. The maximum voltage your ZigBee device will read is configurable using the `max_volts` configuration variable.
|
||||
|
||||
To configure an analog input pin sensor, add the following to your `configuration.yaml` file:
|
||||
|
||||
```yaml
|
||||
## Example configuration.yaml entry
|
||||
sensor:
|
||||
- platform: zigbee
|
||||
name: My Analog ZigBee Input
|
||||
type: analog
|
||||
pin: 0
|
||||
address: 0013A2004233D138
|
||||
|
@ -44,19 +59,16 @@ See the [Digi knowledge base](http://knowledge.digi.com/articles/Knowledge_Base_
|
|||
|
||||
## {% linkable_title Temperature Sensor %}
|
||||
|
||||
The XBee Pro (and perhaps other third party modules) contains a thermometer device which can be read by using the `TP` AT command. To set this up as a temperature sensor device in Home Assistant use the following config variables:
|
||||
The XBee Pro (and perhaps other third party modules) contains a thermometer device which can be read by using the `TP` AT command.
|
||||
|
||||
- **name** (*Required*): The name you'd like to give the temperature sensor in Home Assistant
|
||||
- **platform** (*Required*): Set to `zigbee`
|
||||
- **type** (*Required*): Set to `temperature`
|
||||
- **address**: The long 64bit address of the remote ZigBee device whose temperature sensor you'd like to sample. Do not include this variable if you want to sample the local ZigBee device's temperature.
|
||||
|
||||
#### Example
|
||||
To configure a temperature sensor device, add the following to your `configuration.yaml` file:
|
||||
|
||||
```yaml
|
||||
# Example configuration.yaml entry
|
||||
sensor:
|
||||
- name: Living Room Temperature
|
||||
platform: zigbee
|
||||
- platform: zigbee
|
||||
name: Living Room Temperature ZigBee
|
||||
type: temperature
|
||||
address: 0013A20050E752C5
|
||||
```
|
||||
```
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ During the day (in between `start time` and `sunset time`), it will fade the lig
|
|||
|
||||
If you don't wish to have flux update on 30 second intervals, you can leave the switch turned off and use automation rules that call the service `switch.flux_update` whenever you want the lights updated.
|
||||
|
||||
To use your TPLink switch in your installation, add the following to your `configuration.yaml` file:
|
||||
To use the Flux switch in your installation, add the following to your `configuration.yaml` file:
|
||||
|
||||
```yaml
|
||||
# Example configuration.yaml entry
|
||||
|
|
|
@ -22,17 +22,17 @@ To enable Template switches in your installation, add the following to your `con
|
|||
```yaml
|
||||
# Example configuration.yaml entry
|
||||
switch:
|
||||
platform: template
|
||||
- platform: template
|
||||
switches:
|
||||
skylight:
|
||||
friendly_name: 'Skylight'
|
||||
value_template: {% raw %}'{{ states.sensor.skylight.state }}'{% endraw %}
|
||||
turn_on:
|
||||
service: switch.turn_on
|
||||
entity_id: switch.skylight_open
|
||||
turn_off:
|
||||
service: switch.turn_on
|
||||
entity_id: switch.skylight_close
|
||||
skylight:
|
||||
friendly_name: 'Skylight'
|
||||
value_template: {% raw %}'{{ is_state('sensor.skylight', 'on') }}'{% endraw %}
|
||||
turn_on:
|
||||
service: switch.turn_on
|
||||
entity_id: switch.skylight_open
|
||||
turn_off:
|
||||
service: switch.turn_on
|
||||
entity_id: switch.skylight_close
|
||||
```
|
||||
|
||||
Configuration variables:
|
||||
|
@ -42,7 +42,13 @@ Configuration variables:
|
|||
- **value_template** (*Required*): Defines a [template](/topics/templating/) to set the state of the switch.
|
||||
- **turn_on** (*Required*): Defines an [action](/getting-started/automation/) to run when the switch is turned on.
|
||||
- **turn_off** (*Required*): Defines an [action](/getting-started/automation/) to run when the switch is turned off.
|
||||
- **entity_id** (*Optional*): Add a list of entity_ids so the sensor only reacts to state changes of these entities. This will reduce the number of times the sensor will try to update it's state.
|
||||
- **entity_id** (*Optional*): Add a list of entity IDs so the switch only reacts to state changes of these entities. This will reduce the number of times the switch will try to update it's state.
|
||||
|
||||
|
||||
## {% linkable_title Considerations %}
|
||||
|
||||
If you are using the state of a platform that takes extra time to load, the template switch may get an 'unknown' state during startup. This results in error messages in your log file until that platform has completed loading. If you use is_state() function in your template, you can avoid this situation. For example, you would replace {% raw %}'{{ states.switch.source.state }}'{% endraw %} with this equivalent that returns true/false and never gives an unknown result:
|
||||
{% raw %}'{{ is_state('switch.source', 'on') }}'{% endraw %}
|
||||
|
||||
## {% linkable_title Examples %}
|
||||
|
||||
|
@ -54,16 +60,16 @@ This example shows a switch that copies another switch.
|
|||
|
||||
```yaml
|
||||
switch:
|
||||
platform: template
|
||||
- platform: template
|
||||
switches:
|
||||
copy:
|
||||
value_template: {% raw %}'{{ states.switch.source.state }}'{% endraw %}
|
||||
turn_on:
|
||||
service: switch.turn_on
|
||||
entity_id: switch.source
|
||||
turn_off:
|
||||
service: switch.turn_off
|
||||
entity_id: switch.source
|
||||
copy:
|
||||
value_template: {% raw %}'{{ is_state('switch.source', 'on') }}'{% endraw %}
|
||||
turn_on:
|
||||
service: switch.turn_on
|
||||
entity_id: switch.source
|
||||
turn_off:
|
||||
service: switch.turn_off
|
||||
entity_id: switch.source
|
||||
````
|
||||
|
||||
### {% linkable_title Toggle switch %}
|
||||
|
@ -72,17 +78,17 @@ This example shows a switch that takes its state from a sensor, and toggles a sw
|
|||
|
||||
```yaml
|
||||
switch:
|
||||
platform: template
|
||||
- platform: template
|
||||
switches:
|
||||
blind:
|
||||
friendly_name: 'Blind'
|
||||
value_template: {% raw %}'{{ state }}'{% endraw %}
|
||||
turn_on:
|
||||
service: switch.toggle
|
||||
entity_id: switch.blind_toggle
|
||||
turn_off:
|
||||
service: switch.toggle
|
||||
entity_id: switch.blind_toggle
|
||||
blind:
|
||||
friendly_name: 'Blind'
|
||||
value_template: {% raw %}'{{ state }}'{% endraw %}
|
||||
turn_on:
|
||||
service: switch.toggle
|
||||
entity_id: switch.blind_toggle
|
||||
turn_off:
|
||||
service: switch.toggle
|
||||
entity_id: switch.blind_toggle
|
||||
```
|
||||
|
||||
### {% linkable_title Sensor and two switches %}
|
||||
|
@ -91,15 +97,16 @@ This example shows a switch that takes its state from a sensor, and uses two mom
|
|||
|
||||
```yaml
|
||||
switch:
|
||||
platform: template
|
||||
- platform: template
|
||||
switches:
|
||||
skylight:
|
||||
friendly_name: 'Skylight'
|
||||
value_template: {% raw %}'{{ states.sensor.skylight.state }}'{% endraw %}
|
||||
turn_on:
|
||||
service: switch.turn_on
|
||||
entity_id: switch.skylight_open
|
||||
turn_off:
|
||||
service: switch.turn_on
|
||||
entity_id: switch.skylight_close
|
||||
skylight:
|
||||
friendly_name: 'Skylight'
|
||||
value_template: {% raw %}'{{ is_state('sensor.skylight.state', 'on') }}'{% endraw %}
|
||||
turn_on:
|
||||
service: switch.turn_on
|
||||
entity_id: switch.skylight_open
|
||||
turn_off:
|
||||
service: switch.turn_on
|
||||
entity_id: switch.skylight_close
|
||||
```
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue