From 51f1f4bafe82de7323bf0eb4affc517fe1381992 Mon Sep 17 00:00:00 2001 From: Vladimir Zahradnik Date: Wed, 31 Mar 2021 11:12:47 +0200 Subject: [PATCH 1/2] Add documentation for Modbus fan --- source/_integrations/modbus.markdown | 107 +++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/source/_integrations/modbus.markdown b/source/_integrations/modbus.markdown index 5d9e7f06b9e2..db760532f160 100644 --- a/source/_integrations/modbus.markdown +++ b/source/_integrations/modbus.markdown @@ -16,6 +16,7 @@ ha_platforms: - cover - sensor - switch + - fan --- [Modbus](http://www.modbus.org/) is a serial communication protocol to control PLCs (Programmable Logic Controller). @@ -31,6 +32,7 @@ Platforms: - cover - sensor - switch + - fan are all defined as part of the modbus configuration. The old configuration style, (having each outside the modbus configuration is still supported, but will cause a warning, and will be removed in a later release). @@ -738,6 +740,111 @@ modbus: address: 14 ``` +### Configuring platform fan + +The `modbus` fan platform allows you to control [Modbus](http://www.modbus.org/)-enabled fans. We support two types of Modbus fans — coil-based and register-based. + +To use your Modbus fans in your installation, add the following to your `configuration.yaml` file: + +```yaml +# Example configuration.yaml entry +modbus: + - name: hub1 + type: tcp + host: IP_ADDRESS + port: 502 + fans: + - name: Fan1 + address: 13 + input_type: coil + - name: Fan2 + slave: 2 + address: 14 + input_type: coil + - name: Register1 + address: 11 + command_on: 1 + command_off: 0 +``` + +{% configuration %} +fans: + description: The array contains a list of all your Modbus fans. + required: true + type: map + keys: + address: + description: Coil number or register + 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 + input_type: + description: type of adddress (holding/discrete/coil) + required: false + default: holding + type: integer + name: + description: Name of the switch. + required: true + type: string + scan_interval: + description: Defines the update interval of the sensor in seconds. + required: false + type: integer + default: 15 + slave: + description: The number of the slave (can be omitted for tcp and udp Modbus). + required: true + type: integer + 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 + verify_register: + description: Register to readback. + required: false + default: same as register + type: string + verify_state: + description: Define if is possible to readback the status of the switch. + required: false + default: true + type: boolean +{% endconfiguration %} + +#### Full example + +Example fans, for which the state is polled from Modbus every 15 seconds. + +```yaml +modbus: + - name: hub1 + type: tcp + host: IP_ADDRESS + port: 502 + fans: + - name: Fan1 + slave: 1 + address: 13 + input_type: coil + - name: Fan2 + slave: 2 + address: 14 +``` + #### Multiple connections Multiple connections are possible, add something like the following to your `configuration.yaml` file: From ead2ea84f09f16ec8d106ccff4ab1250c5c8aeb8 Mon Sep 17 00:00:00 2001 From: Vladimir Zahradnik Date: Mon, 3 May 2021 11:07:52 +0200 Subject: [PATCH 2/2] Update Modbus fan docs --- source/_integrations/modbus.markdown | 79 ++++++++++++++++------------ 1 file changed, 46 insertions(+), 33 deletions(-) diff --git a/source/_integrations/modbus.markdown b/source/_integrations/modbus.markdown index db760532f160..731afc5bc01b 100644 --- a/source/_integrations/modbus.markdown +++ b/source/_integrations/modbus.markdown @@ -749,22 +749,27 @@ To use your Modbus fans in your installation, add the following to your `configu ```yaml # Example configuration.yaml entry modbus: - - name: hub1 - type: tcp + - type: tcp host: IP_ADDRESS port: 502 fans: - name: Fan1 address: 13 - input_type: coil + write_type: coil - name: Fan2 slave: 2 address: 14 - input_type: coil + write_type: coil + verify: - name: Register1 address: 11 command_on: 1 command_off: 0 + verify: + input_type: holding + address: 127 + state_on: 25 + state_off: 1 ``` {% configuration %} @@ -778,20 +783,22 @@ fans: required: true type: integer command_on: - description: Value to write to turn on the switch. - required: true + description: Value to write to turn on the fan. + required: false + default: 0x01 type: integer command_off: - description: Value to write to turn off the switch. - required: true + description: Value to write to turn off the fan. + required: false + default: 0x00 type: integer - input_type: - description: type of adddress (holding/discrete/coil) + write_type: + description: type of adddress (holding/coil) required: false default: holding type: integer name: - description: Name of the switch. + description: Name of the fan. required: true type: string scan_interval: @@ -801,33 +808,39 @@ fans: default: 15 slave: description: The number of the slave (can be omitted for tcp and udp Modbus). - required: true - type: integer - 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 - verify_register: - description: Register to readback. - required: false - default: same as register - type: string - verify_state: - description: Define if is possible to readback the status of the switch. - required: false - default: true - type: boolean + default: 0 + verify: + description: read from modbus device to verify fan. + required: false + type: map + keys: + address: + description: address to read from. + required: false + default: write address + type: integer + input_type: + description: type of adddress (holding/coil/discrete/input) + required: false + default: write_type + type: integer + state_on: + description: value when fan is on. + required: false + default: same as command_on + type: integer + state_off: + description: value when fan is off. + required: false + default: same as command_off + type: integer {% endconfiguration %} #### Full example -Example fans, for which the state is polled from Modbus every 15 seconds. +Example fans, for which the state is not polled. ```yaml modbus: @@ -835,7 +848,7 @@ modbus: type: tcp host: IP_ADDRESS port: 502 - fans: + switches: - name: Fan1 slave: 1 address: 13