Change parameters for Modbus cover (#17995)

This commit is contained in:
jan iversen 2021-06-07 18:57:05 +02:00 committed by GitHub
parent ae9093f8a4
commit d4681aba6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -378,9 +378,9 @@ The `modbus` cover platform allows you to control covers (such as blinds, a roll
At the moment, platform cover support the opening and closing of a cover. You can control your covers either using coils or holding registers. At the moment, platform cover support the opening and closing of a cover. You can control your covers either using coils or holding registers.
Cover that uses the `coil` attribute is not able to determine intermediary states such as opening and closing. Coil stores only two states — "0" means cover closed, and "1" implies cover open. To allow detecting intermediary states, there is an optional `status_register` attribute. It will enable you to write your command (e.g., to open a cover) into a coil, and read current cover status back through the register. Additionally, you can specify values for `state_open`, `state_opening`, `state_closed`, and `state_closing` attributes. These will be matched with the value read from the `status_register`. Cover that uses `input_type: coil` is not able to determine intermediary states such as opening and closing. Coil stores only two states — "0" means cover closed, and "1" implies cover open. To allow detecting intermediary states, there is an optional `status_register` attribute. It will enable you to write your command (e.g., to open a cover) into a coil, and read current cover status back through the register. Additionally, you can specify values for `state_open`, `state_opening`, `state_closed`, and `state_closing` attributes. These will be matched with the value read from the `status_register`.
If your cover uses holding register to send commands (defined by the `register` attribute), it can also read the intermediary states. To adjust which value represents what state, you can fine-tune the optional state attributes, like `state_open`. These optional state values are also used for specifying values written into the register. If you specify an optional status_register attribute, cover states will be read from status_register instead of the register used for sending commands. If your cover uses ìnput_type: holding` (default) to send commands, it can also read the intermediary states. To adjust which value represents what state, you can fine-tune the optional state attributes, like `state_open`. These optional state values are also used for specifying values written into the register. If you specify an optional status_register attribute, cover states will be read from status_register instead of the register used for sending commands.
To use Modbus covers in your installation, add the following to your `configuration.yaml` file, in addition to the [common parameters](#configuring- platform-common-parameters): To use Modbus covers in your installation, add the following to your `configuration.yaml` file, in addition to the [common parameters](#configuring- platform-common-parameters):
@ -394,7 +394,8 @@ modbus:
covers: covers:
- name: Door1 - name: Door1
device_class: door device_class: door
coil: 117 input_type: coil
address: 117
device_class: door device_class: door
state_open: 1 state_open: 1
state_opening: 2 state_opening: 2
@ -403,7 +404,7 @@ modbus:
status_register: 119 status_register: 119
status_register_type: holding status_register_type: holding
- name: "Door2" - name: "Door2"
register: 117 address: 117
``` ```
{% configuration %} {% configuration %}
@ -412,19 +413,20 @@ covers:
required: true required: true
type: map type: map
keys: keys:
coil: address:
description: Coil address; `coil` and `register` attributes are mutually exclusive and you need to add one of them. description: Address of `coil` / `register`.
required: false required: true
type: integer type: integer
device_class: device_class:
description: The [type/class](/integrations/cover/#device-class) of the cover to set the icon in the frontend. description: The [type/class](/integrations/cover/#device-class) of the cover to set the icon in the frontend.
required: false required: false
type: device_class type: device_class
default: None default: None
register: input_type:
description: Holding register address; `coil` and `register` attributes are mutually exclusive, and you need to add one of them. description: Modbus register type (holding, input), default holding.
required: true default: holding
type: integer required: false
type: string
state_open: state_open:
description: A value in `status_register` or `register` representing an open cover. If your configuration uses the `register` attribute, this value will be written into the holding register to open the cover. description: A value in `status_register` or `register` representing an open cover. If your configuration uses the `register` attribute, this value will be written into the holding register to open the cover.
required: false required: false