mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-21 08:16:53 +00:00
Update configuration examples
This commit is contained in:
parent
bbacbdb73e
commit
8e8199ed41
@ -10,23 +10,22 @@ footer: true
|
||||
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.
|
||||
|
||||
To enable this sensor, add the following lines to your `configuration.yaml`:
|
||||
|
||||
```yaml
|
||||
sensor:
|
||||
binary_sensor:
|
||||
# Example configuration.yaml entry
|
||||
- platform: tcp
|
||||
name: TCP Binary Sensor
|
||||
host: IP_ADDRESS
|
||||
port: PORT
|
||||
payload: "r State\n"
|
||||
value_on: 1
|
||||
timeout: 5
|
||||
value_template: "{% raw %}{{ value.split(';')[0] }}{% endraw %}"
|
||||
unit: UNIT_OF_MEASUREMENT
|
||||
platform: tcp
|
||||
name: TCP Binary Sensor
|
||||
host: IP_ADDRESS
|
||||
port: PORT
|
||||
payload: "r State\n"
|
||||
value_on: 1
|
||||
timeout: 5
|
||||
value_template: "{% raw %}{{ value.split(';')[0] }}{% endraw %}"
|
||||
buffer_size: BUFFER_SIZE
|
||||
```
|
||||
|
||||
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".
|
||||
- **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.
|
||||
- **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.
|
||||
|
||||
|
@ -17,14 +17,14 @@ To enable this sensor, add the following lines to your `configuration.yaml`:
|
||||
```yaml
|
||||
sensor:
|
||||
# Example configuration.yaml entry
|
||||
- platform: tcp
|
||||
name: Central Heating Pressure
|
||||
host: IP_ADDRESS
|
||||
port: PORT
|
||||
timeout: 5
|
||||
payload: PAYLOAD
|
||||
value_template: "{% raw %}{{ value.split(';')[0] }}{% endraw %}"
|
||||
unit: UNIT_OF_MEASUREMENT
|
||||
platform: tcp
|
||||
name: Central Heating Pressure
|
||||
host: IP_ADDRESS
|
||||
port: PORT
|
||||
timeout: 5
|
||||
payload: PAYLOAD
|
||||
value_template: "{% raw %}{{ value.split(';')[0] }}{% endraw %}"
|
||||
unit: UNIT_OF_MEASUREMENT
|
||||
```
|
||||
|
||||
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
|
||||
sensor:
|
||||
# Example configuration.yaml entry
|
||||
- platform: tcp
|
||||
name: Central Heating Pressure
|
||||
host: 10.0.0.127
|
||||
port: 8888
|
||||
timeout: 5
|
||||
payload: "r WaterPressure\n"
|
||||
value_template: "{% raw %}{{ value.split(';')[0] }}{% endraw %}"
|
||||
unit: Bar
|
||||
platform: tcp
|
||||
name: Central Heating Pressure
|
||||
host: 10.0.0.127
|
||||
port: 8888
|
||||
timeout: 5
|
||||
payload: "r WaterPressure\n"
|
||||
value_template: "{% raw %}{{ value.split(';')[0] }}{% endraw %}"
|
||||
unit: Bar
|
||||
```
|
||||
|
||||
### {% linkable_title hddtemp %}
|
||||
@ -90,12 +90,12 @@ The entry for the `configuration.yaml` file for a `hddtemp` sensor could look li
|
||||
```yaml
|
||||
sensor:
|
||||
# Example configuration.yaml entry
|
||||
- platform: tcp
|
||||
name: HDD temperature
|
||||
host: 127.0.0.1
|
||||
port: 7634
|
||||
timeout: 5
|
||||
payload: "\n"
|
||||
value_template: "{% raw %}{{ value.split('|')[3] }}{% endraw %}"
|
||||
unit: "°C"
|
||||
platform: tcp
|
||||
name: HDD temperature
|
||||
host: 127.0.0.1
|
||||
port: 7634
|
||||
timeout: 5
|
||||
payload: "\n"
|
||||
value_template: "{% raw %}{{ value.split('|')[3] }}{% endraw %}"
|
||||
unit: "°C"
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user