mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-23 01:06:52 +00:00
Update configuration examples
This commit is contained in:
parent
bbacbdb73e
commit
8e8199ed41
@ -10,23 +10,22 @@ footer: true
|
|||||||
ha_category: Binary Sensor
|
ha_category: Binary Sensor
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
The TCP Binary Sensor is a type of [TCP Sensor](/components/sensor.tcp/) which is either "off" or "on". In order to use this sensor type, in addition to the configuration for the TCP Sensor, you must supply a `value_on` value to represent what is returned when the device is turned on.
|
The TCP Binary Sensor is a type of [TCP Sensor](/components/sensor.tcp/) which is either "off" or "on". In order to use this sensor type, in addition to the configuration for the TCP Sensor, you must supply a `value_on` value to represent what is returned when the device is turned on.
|
||||||
|
|
||||||
To enable this sensor, add the following lines to your `configuration.yaml`:
|
To enable this sensor, add the following lines to your `configuration.yaml`:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
sensor:
|
binary_sensor:
|
||||||
# Example configuration.yaml entry
|
# Example configuration.yaml entry
|
||||||
- platform: tcp
|
platform: tcp
|
||||||
name: TCP Binary Sensor
|
name: TCP Binary Sensor
|
||||||
host: IP_ADDRESS
|
host: IP_ADDRESS
|
||||||
port: PORT
|
port: PORT
|
||||||
payload: "r State\n"
|
payload: "r State\n"
|
||||||
value_on: 1
|
value_on: 1
|
||||||
timeout: 5
|
timeout: 5
|
||||||
value_template: "{% raw %}{{ value.split(';')[0] }}{% endraw %}"
|
value_template: "{% raw %}{{ value.split(';')[0] }}{% endraw %}"
|
||||||
unit: UNIT_OF_MEASUREMENT
|
buffer_size: BUFFER_SIZE
|
||||||
```
|
```
|
||||||
|
|
||||||
Configuration options for the a TCP Sensor:
|
Configuration options for the a TCP Sensor:
|
||||||
@ -38,6 +37,5 @@ Configuration options for the a TCP Sensor:
|
|||||||
- **value_on** (*Required*): The value returned when the device is "on".
|
- **value_on** (*Required*): The value returned when the device is "on".
|
||||||
- **timeout** (*Optional*): How long in seconds to wait for a response from the service before giving up and disconnecting. Defaults to 10.
|
- **timeout** (*Optional*): How long in seconds to wait for a response from the service before giving up and disconnecting. Defaults to 10.
|
||||||
- **value_template** (*Optional*): Defines a [template](/topics/templating/) to extract the value. By default it's assumed that the entire response is the value.
|
- **value_template** (*Optional*): Defines a [template](/topics/templating/) to extract the value. By default it's assumed that the entire response is the value.
|
||||||
- **unit** (*Optional*): The unit of measurement to use for the value.
|
|
||||||
- **buffer_size** (*Optional*): The size of the receive buffer in bytes. Set this to a larger value if you expect to receive a response larger than the default. Defaults to 1024.
|
- **buffer_size** (*Optional*): The size of the receive buffer in bytes. Set this to a larger value if you expect to receive a response larger than the default. Defaults to 1024.
|
||||||
|
|
||||||
|
@ -17,14 +17,14 @@ To enable this sensor, add the following lines to your `configuration.yaml`:
|
|||||||
```yaml
|
```yaml
|
||||||
sensor:
|
sensor:
|
||||||
# Example configuration.yaml entry
|
# Example configuration.yaml entry
|
||||||
- platform: tcp
|
platform: tcp
|
||||||
name: Central Heating Pressure
|
name: Central Heating Pressure
|
||||||
host: IP_ADDRESS
|
host: IP_ADDRESS
|
||||||
port: PORT
|
port: PORT
|
||||||
timeout: 5
|
timeout: 5
|
||||||
payload: PAYLOAD
|
payload: PAYLOAD
|
||||||
value_template: "{% raw %}{{ value.split(';')[0] }}{% endraw %}"
|
value_template: "{% raw %}{{ value.split(';')[0] }}{% endraw %}"
|
||||||
unit: UNIT_OF_MEASUREMENT
|
unit: UNIT_OF_MEASUREMENT
|
||||||
```
|
```
|
||||||
|
|
||||||
Configuration options for the a TCP Sensor:
|
Configuration options for the a TCP Sensor:
|
||||||
@ -56,14 +56,14 @@ You will notice that the output from the service is not just a single value (it
|
|||||||
```yaml
|
```yaml
|
||||||
sensor:
|
sensor:
|
||||||
# Example configuration.yaml entry
|
# Example configuration.yaml entry
|
||||||
- platform: tcp
|
platform: tcp
|
||||||
name: Central Heating Pressure
|
name: Central Heating Pressure
|
||||||
host: 10.0.0.127
|
host: 10.0.0.127
|
||||||
port: 8888
|
port: 8888
|
||||||
timeout: 5
|
timeout: 5
|
||||||
payload: "r WaterPressure\n"
|
payload: "r WaterPressure\n"
|
||||||
value_template: "{% raw %}{{ value.split(';')[0] }}{% endraw %}"
|
value_template: "{% raw %}{{ value.split(';')[0] }}{% endraw %}"
|
||||||
unit: Bar
|
unit: Bar
|
||||||
```
|
```
|
||||||
|
|
||||||
### {% linkable_title hddtemp %}
|
### {% linkable_title hddtemp %}
|
||||||
@ -90,12 +90,12 @@ The entry for the `configuration.yaml` file for a `hddtemp` sensor could look li
|
|||||||
```yaml
|
```yaml
|
||||||
sensor:
|
sensor:
|
||||||
# Example configuration.yaml entry
|
# Example configuration.yaml entry
|
||||||
- platform: tcp
|
platform: tcp
|
||||||
name: HDD temperature
|
name: HDD temperature
|
||||||
host: 127.0.0.1
|
host: 127.0.0.1
|
||||||
port: 7634
|
port: 7634
|
||||||
timeout: 5
|
timeout: 5
|
||||||
payload: "\n"
|
payload: "\n"
|
||||||
value_template: "{% raw %}{{ value.split('|')[3] }}{% endraw %}"
|
value_template: "{% raw %}{{ value.split('|')[3] }}{% endraw %}"
|
||||||
unit: "°C"
|
unit: "°C"
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user