mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-24 01:37:23 +00:00
Update Modbus component configuration variable (#6603)
* Update Modbus component configuration variable Update style of Modbus component (all the 4 files) documentation to follow new configuration variables description. * Update modbus.markdown * Update binary_sensor.modbus.markdown * Tweak fix * Tweak round 2 😛 * ✏️ Tweak round 3
This commit is contained in:
parent
15923434cb
commit
7b4305c7ee
@ -32,13 +32,26 @@ binary_sensor:
|
|||||||
coil: 110
|
coil: 110
|
||||||
```
|
```
|
||||||
|
|
||||||
Configuration variables:
|
{% configuration %}
|
||||||
|
coils:
|
||||||
|
description: The array contains a list of coils to read from.
|
||||||
|
required: true
|
||||||
|
type: [map, list]
|
||||||
|
keys:
|
||||||
|
name:
|
||||||
|
description: Name of the sensor.
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
slave:
|
||||||
|
description: The number of the slave (Optional for TCP and UDP Modbus).
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
coil:
|
||||||
|
description: Coil number.
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
{% endconfiguration %}
|
||||||
|
|
||||||
- **coils** array (*Required*): The array contains a list of coils to read from.
|
|
||||||
- **name** (*Required*): Name of the sensor.
|
|
||||||
- **slave** (*Required*): The number of the slave (Optional for TCP and UDP Modbus).
|
|
||||||
- **coil** (*Required*): Coil number.
|
|
||||||
|
|
||||||
It's possible to change the default 30 seconds scan interval for the sensor updates as shown in the [Platform options](/docs/configuration/platform_options/#scan-interval) documentation.
|
It's possible to change the default 30 seconds scan interval for the sensor updates as shown in the [Platform options](/docs/configuration/platform_options/#scan-interval) documentation.
|
||||||
|
|
||||||
## {% linkable_title Full example %}
|
## {% linkable_title Full example %}
|
||||||
|
@ -30,15 +30,25 @@ modbus:
|
|||||||
port: 2020
|
port: 2020
|
||||||
```
|
```
|
||||||
|
|
||||||
Configuration variables:
|
{% configuration %}
|
||||||
|
type:
|
||||||
- **type** (*Required*): Type of the connection to Modbus. Possible values are:
|
description: Type of the connection to Modbus. Possible values are `tcp` (Modbus TCP protocol according to "MODBUS Messaging Implementation Guide version 1.0b" provided by Schneider Automation.), `udp`(Modbus TCP form, but using UDP for transport. It removes the overheads required for TCP.) and `rtuovertcp` (Modbus RTU message transmitted with a TCP/IP wrapper and sent over a network instead of serial lines.).
|
||||||
- *tcp*: Modbus TCP protocol according to "MODBUS Messaging Implementation Guide version 1.0b" provided by Schneider Automation,
|
required: true
|
||||||
- *udp*: Modbus TCP form, but using UDP for transport (removes the overheads required for TCP),
|
type: string
|
||||||
- *rtuovertcp*: Modbus RTU message transmitted with a TCP/IP wrapper and sent over a network instead of serial lines.
|
host:
|
||||||
- **host** (*Required*): The IP address of your Modbus device, eg. 192.168.1.1.
|
description: The IP address of your Modbus device, e.g., 192.168.1.1.
|
||||||
- **port** (*Required*): The port for the communication.
|
required: true
|
||||||
- **timeout** (*Optional*): Timeout for slave response in seconds. (default: 3)
|
type: string
|
||||||
|
port:
|
||||||
|
description: The port for the communication.
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
timeout:
|
||||||
|
description: Timeout for slave response in seconds.
|
||||||
|
required: false
|
||||||
|
default: 3
|
||||||
|
type: integer
|
||||||
|
{% endconfiguration %}
|
||||||
|
|
||||||
For a serial connection:
|
For a serial connection:
|
||||||
|
|
||||||
@ -54,16 +64,41 @@ modbus:
|
|||||||
parity: N
|
parity: N
|
||||||
```
|
```
|
||||||
|
|
||||||
Configuration variables:
|
{% configuration %}
|
||||||
|
type:
|
||||||
- **type** (*Required*): Type of the connection to Modbus.
|
description: Type of the connection to Modbus.
|
||||||
- **method** (*Required*): Method of the connection to Modbus.
|
required: true
|
||||||
- **port** (*Required*): The port where your Modbus device is connected to your Home Assistant host.
|
type: string
|
||||||
- **baudrate** (*Required*): The speed for the serial connection.
|
method:
|
||||||
- **stopbits** (*Required*): The stopbits for the serial connection.
|
description: Method of the connection to Modbus.
|
||||||
- **bytesize** (*Required*): The bytesize for the serial connection.
|
required: true
|
||||||
- **parity** (*Required*): The parity for the serial connection.
|
type: string
|
||||||
- **timeout** (*Optional*): Timeout for slave response in seconds. (default: 3)
|
port:
|
||||||
|
description: The port where your Modbus device is connected to your Home Assistant host.
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
baudrate:
|
||||||
|
description: The speed for the serial connection.
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
stopbits:
|
||||||
|
description: The stopbits for the serial connection.
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
bytesize:
|
||||||
|
description: The bytesize for the serial connection.
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
parity:
|
||||||
|
description: The parity for the serial connection.
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
timeout:
|
||||||
|
description: Timeout for slave response in seconds.
|
||||||
|
required: false
|
||||||
|
default: 3
|
||||||
|
type: integer
|
||||||
|
{% endconfiguration %}
|
||||||
|
|
||||||
### {% linkable_title Services %}
|
### {% linkable_title Services %}
|
||||||
|
|
||||||
|
@ -45,21 +45,66 @@ sensor:
|
|||||||
precision: 2
|
precision: 2
|
||||||
```
|
```
|
||||||
|
|
||||||
Configuration variables:
|
{% configuration %}
|
||||||
|
registers:
|
||||||
- **registers** array (*Required*): The array contains a list of relevant registers to read from.
|
description: The array contains a list of relevant registers to read from.
|
||||||
- **name** (*Required*): Name of the sensor.
|
required: true
|
||||||
- **slave** (*Required*): The number of the slave (Optional for tcp and upd Modbus).
|
type: map
|
||||||
- **register** (*Required*): Register number.
|
keys:
|
||||||
- **register_type** (*Optional*): Modbus register type (holding, input), default holding.
|
name:
|
||||||
- **unit_of_measurement** (*Optional*): Unit to attach to value.
|
description: Name of the sensor.
|
||||||
- **count** (*Optional*): Number of registers to read.
|
required: true
|
||||||
- **reverse_order** (*Optional*): Reverse the order of registers when count >1, default False.
|
type: string
|
||||||
- **scale** (*Optional*): Scale factor (output = scale * value + offset), default 1.
|
slave:
|
||||||
- **offset** (*Optional*): Final offset (output = scale * value + offset), default 0.
|
description: The number of the slave (Optional for tcp and upd Modbus).
|
||||||
- **precision** (*Optional*): Number of valid decimals, default 0.
|
required: true
|
||||||
- **data_type** (*Optional*): Response representation (int, uint, float, custom). If float selected, value will be converted to IEEE 754 floating point format. Default int.
|
type: integer
|
||||||
- **structure** (*Optional*): If data_type is custom specify here a double quoted python struct format string to unpack the value. See python documentation for details. Ex: ">i".
|
register:
|
||||||
|
description: Register number.
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
register_type:
|
||||||
|
description: Modbus register type (holding, input), default holding.
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
unit_of_measurement:
|
||||||
|
description: Unit to attach to value.
|
||||||
|
required: false
|
||||||
|
type: integer
|
||||||
|
count:
|
||||||
|
description: Number of registers to read.
|
||||||
|
required: integer
|
||||||
|
type: integer
|
||||||
|
reverse_order:
|
||||||
|
description: Reverse the order of registers when count >1.
|
||||||
|
required: false
|
||||||
|
default: False
|
||||||
|
type: boolean
|
||||||
|
scale:
|
||||||
|
description: Scale factor (output = scale * value + offset).
|
||||||
|
required: false
|
||||||
|
default: 1
|
||||||
|
type: float
|
||||||
|
offset:
|
||||||
|
description: Final offset (output = scale * value + offset).
|
||||||
|
required: false
|
||||||
|
default: 0
|
||||||
|
type: float
|
||||||
|
precision:
|
||||||
|
description: Number of valid decimals.
|
||||||
|
required: false
|
||||||
|
default: 0
|
||||||
|
type: integer
|
||||||
|
data_type:
|
||||||
|
description: Response representation (int, uint, float, custom). If float selected, value will be converted to IEEE 754 floating point format.
|
||||||
|
required: false
|
||||||
|
default: int
|
||||||
|
type: string
|
||||||
|
structure:
|
||||||
|
description: "If data_type is custom specify here a double quoted python struct format string to unpack the value. See python documentation for details. Ex: >i."
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
{% endconfiguration %}
|
||||||
|
|
||||||
It's possible to change the default 30 seconds scan interval for the sensor updates as shown in the [Platform options](/docs/configuration/platform_options/#scan-interval) documentation.
|
It's possible to change the default 30 seconds scan interval for the sensor updates as shown in the [Platform options](/docs/configuration/platform_options/#scan-interval) documentation.
|
||||||
|
|
||||||
|
@ -40,20 +40,72 @@ switch:
|
|||||||
command_off: 0
|
command_off: 0
|
||||||
```
|
```
|
||||||
|
|
||||||
Configuration variables:
|
{% configuration %}
|
||||||
|
coils:
|
||||||
- **coils** (*Optional*): A list of relevant coils to read from/write to.
|
description: A list of relevant coils to read from/write to.
|
||||||
- **slave** (*Required*): The number of the slave (can be omitted for tcp and udp Modbus).
|
required: false
|
||||||
- **name** (*Required*): Name of the switch.
|
type: map
|
||||||
- **coil** (*Required*): Coil number.
|
keys:
|
||||||
- **registers** (*Optional*): A list of relevant registers to read from/write to.
|
slave:
|
||||||
- **slave** (*Required*): The number of the slave (can be omitted for tcp and udp Modbus).
|
description: The number of the slave (can be omitted for tcp and udp Modbus).
|
||||||
- **name** (*Required*): Name of the switch.
|
required: true
|
||||||
- **register** (*Required*): Register number.
|
type: integer
|
||||||
- **command_on** (*Required*): Value to write to turn on the switch.
|
name:
|
||||||
- **command_off** (*Required*): Value to write to turn off the switch.
|
description: Name of the switch.
|
||||||
- **verify_state** (*Optional*): Define if is possible to readback the status of the switch. (default: True)
|
required: true
|
||||||
- **verify_register** (*Optional*): Register to readback. (default: same as register)
|
type: string
|
||||||
- **register_type** (*Optional*): Modbus register type: holding or input. (default: holding)
|
coil:
|
||||||
- **state_on** (*Optional*): Register value when switch is on. (default: same as command_on)
|
description: Coil number.
|
||||||
- **state_off** (*Optional*): Register value when switch is off. (default: same as command_off)
|
required: true
|
||||||
|
type: integer
|
||||||
|
register:
|
||||||
|
description: A list of relevant registers to read from/write to.
|
||||||
|
required: false
|
||||||
|
type: map
|
||||||
|
keys:
|
||||||
|
slave:
|
||||||
|
description: The number of the slave (can be omitted for tcp and udp Modbus).
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
name:
|
||||||
|
description: Name of the switch.
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
register:
|
||||||
|
description: Register number.
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
command_on:
|
||||||
|
description: Value to write to turn on the switch.
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
command_off:
|
||||||
|
description: Value to write to turn off the switch.
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
verify_state:
|
||||||
|
description: Define if is possible to readback the status of the switch.
|
||||||
|
required: false
|
||||||
|
default: True
|
||||||
|
type: boolean
|
||||||
|
verify_register:
|
||||||
|
description: Register to readback.
|
||||||
|
required: false
|
||||||
|
default: same as register
|
||||||
|
type: string
|
||||||
|
register_type:
|
||||||
|
description: Modbus register types are holding or input.
|
||||||
|
required: false
|
||||||
|
default: holding
|
||||||
|
type: string
|
||||||
|
state_on:
|
||||||
|
description: Register value when switch is on.
|
||||||
|
required: false
|
||||||
|
default: same as command_on
|
||||||
|
type: integer
|
||||||
|
state_off:
|
||||||
|
description: Register value when switch is off.
|
||||||
|
required: false
|
||||||
|
default: same as command_off
|
||||||
|
type: integer
|
||||||
|
{% endconfiguration %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user