pub struct Cover<'a> {
Show 42 fields pub availability: Cow<'a, [Availability<'a>]>, pub availability_mode: AvailabilityMode, pub device: Option<Device<'a>>, pub enabled_by_default: Option<bool>, pub encoding: Option<Cow<'a, str>>, pub entity_category: EntityCategory, pub icon: Option<Icon<'a>>, pub json_attributes_template: Option<Template<'a>>, pub json_attributes_topic: Option<Topic<'a>>, pub name: Option<Name<'a>>, pub object_id: Option<Cow<'a, str>>, pub qos: MqttQoS, pub unique_id: Option<UniqueId<'a>>, pub command_topic: Option<Topic<'a>>, pub device_class: DeviceClass, pub optimistic: Option<bool>, pub payload_close: Option<Payload<'a>>, pub payload_open: Option<Payload<'a>>, pub payload_stop: Option<Payload<'a>>, pub position_closed: Option<u32>, pub position_open: Option<u32>, pub position_template: Option<Template<'a>>, pub position_topic: Option<Topic<'a>>, pub retain: Option<bool>, pub set_position_template: Option<Template<'a>>, pub set_position_topic: Option<Topic<'a>>, pub state_closed: Option<Payload<'a>>, pub state_closing: Option<Payload<'a>>, pub state_open: Option<Payload<'a>>, pub state_opening: Option<Payload<'a>>, pub state_stopped: Option<Payload<'a>>, pub state_topic: Option<Topic<'a>>, pub tilt_closed_value: Option<u32>, pub tilt_command_template: Option<Template<'a>>, pub tilt_command_topic: Option<Topic<'a>>, pub tilt_max: Option<u32>, pub tilt_min: Option<u32>, pub tilt_opened_value: Option<u32>, pub tile_optimistic: Option<bool>, pub tilt_status_template: Option<Template<'a>>, pub tilt_status_topic: Option<Topic<'a>>, pub value_template: Option<Template<'a>>,
}
Expand description

The mqtt cover platform allows you to control an MQTT cover (such as blinds, a roller shutter or a garage door).

See: https://www.home-assistant.io/integrations/cover.mqtt/

Fields§

§availability: Cow<'a, [Availability<'a>]>

A list of MQTT topics subscribed to receive availability (online/offline) updates.

§availability_mode: AvailabilityMode

When availability is configured, this controls the conditions needed to set the entity to available.

§device: Option<Device<'a>>

Information about the device this entity is a part of to tie it into the device registry. Only works through MQTT discovery and when unique_id is set. At least one of identifiers or connections must be present to identify the device.

§enabled_by_default: Option<bool>

Flag which defines if the entity should be enabled when first added. Defaults to true.

§encoding: Option<Cow<'a, str>>

The encoding of the payloads received and published messages. Set to “” to disable decoding of incoming payload. Defaults to "utf-8".

§entity_category: EntityCategory

The category of the entity.

§icon: Option<Icon<'a>>

Icon for the entity.

§json_attributes_template: Option<Template<'a>>

Defines a template to extract the JSON dictionary from messages received on the json_attributes_topic.

§json_attributes_topic: Option<Topic<'a>>

The MQTT topic subscribed to receive a JSON dictionary payload and then set as entity attributes.

Implies force_update of the current state when a message is received on this topic.

§name: Option<Name<'a>>

The name of the MQTT entity.

§object_id: Option<Cow<'a, str>>

Used instead of name for automatic generation of entity_id.

§qos: MqttQoS

The maximum QoS level of the state topic.

§unique_id: Option<UniqueId<'a>>

An ID that uniquely identifies this entity. If two entities have the same unique ID, Home Assistant will raise an exception.

§command_topic: Option<Topic<'a>>

The MQTT topic to publish commands to control the cover.

§device_class: DeviceClass

Sets the class of the device, changing the device state and icon that is displayed on the frontend.

§optimistic: Option<bool>

Flag that defines if the cover works in optimistic mode. Defaults to false if a state_topic or position_topic is defined, else true.

§payload_close: Option<Payload<'a>>

The command payload that closes the cover. Defaults to "CLOSE".

§payload_open: Option<Payload<'a>>

The command payload that opens the cover. Defaults to "OPEN".

§payload_stop: Option<Payload<'a>>

The command payload that stops the cover. Defaults to "STOP".

§position_closed: Option<u32>

Number which represents closed position. Defaults to 0.

§position_open: Option<u32>

Number which represents open position. Defaults to 100.

§position_template: Option<Template<'a>>

Defines a template that can be used to extract the payload for the position_topic topic. Within the template the following variables are available:

  • entity_id
  • position_open
  • position_closed
  • tilt_min
  • tilt_max

The entity_id can be used to reference the entity’s attributes with the help of the states template function.

§position_topic: Option<Topic<'a>>

The MQTT topic subscribed to receive cover position messages.

§retain: Option<bool>

Defines if published messages should have the retain flag set. Defaults to false.

§set_position_template: Option<Template<'a>>

Defines a template to define the position to be sent to the set_position_topic topic. Incoming position value is available for use in the template {{ position }}. Within the template the following variables are available:

  • entity_id
  • position in percent
  • position_open
  • position_closed
  • tilt_min
  • tilt_max

The entity_id can be used to reference the entity’s attributes with the help of the states template function.

§set_position_topic: Option<Topic<'a>>

The MQTT topic to publish position commands to. You need to set position_topic as well if you want to use position topic. Use template if position topic wants different values than within range position_closed - position_open. If template is not defined and position_closed != 100 and position_open != 0 then proper position value is calculated from percentage position.

§state_closed: Option<Payload<'a>>

The payload that represents the closed state. Defaults to "closed".

§state_closing: Option<Payload<'a>>

The payload that represents the closing state. Defaults to "closing".

§state_open: Option<Payload<'a>>

The payload that represents the open state. Defaults to "open".

§state_opening: Option<Payload<'a>>

The payload that represents the opening state. Defaults to "opening".

§state_stopped: Option<Payload<'a>>

The payload that represents the stopped state (for covers that do not report open/closed state). Defaults to "stopped".

§state_topic: Option<Topic<'a>>

The MQTT topic subscribed to receive cover state messages. State topic can only read (open, opening, closed, closing or stopped) state.

§tilt_closed_value: Option<u32>

The value that will be sent on a close_cover_tilt command. Defaults to 0.

§tilt_command_template: Option<Template<'a>>

Defines a template that can be used to extract the payload for the tilt_command_topic topic. Within the template the following variables are available:

  • entity_id
  • tilt_position in percent
  • position_open
  • position_closed
  • tilt_min
  • tilt_max

The entity_id can be used to reference the entity’s attributes with the help of the states template function.

§tilt_command_topic: Option<Topic<'a>>

The MQTT topic to publish commands to control the cover tilt.

§tilt_max: Option<u32>

The maximum tilt value. Defaults to 100.

§tilt_min: Option<u32>

The minimum tilt value. Defaults to 0.

§tilt_opened_value: Option<u32>

The value that will be sent on an open_cover_tilt command. Defaults to 100.

§tile_optimistic: Option<bool>

Flag that determines if tilt works in optimistic mode. Defaults to true if tilt_status_topic is not defined, else false.

§tilt_status_template: Option<Template<'a>>

Defines a template that can be used to extract the payload for the tilt_status_topic topic. Within the template the following variables are available:

  • entity_id
  • position_open
  • position_closed
  • tilt_min
  • tilt_max

The entity_id can be used to reference the entity’s attributes with the help of the states template function.

§tilt_status_topic: Option<Topic<'a>>

The MQTT topic subscribed to receive tilt status update values.

§value_template: Option<Template<'a>>

Defines a template that can be used to extract the payload for the state_topic topic.

Implementations§

A list of MQTT topics subscribed to receive availability (online/offline) updates.

When availability is configured, this controls the conditions needed to set the entity to available.

Information about the device this entity is a part of to tie it into the device registry. Only works through MQTT discovery and when unique_id is set. At least one of identifiers or connections must be present to identify the device.

Information about the device this entity is a part of to tie it into the device registry. Only works through MQTT discovery and when unique_id is set. At least one of identifiers or connections must be present to identify the device.

Flag which defines if the entity should be enabled when first added. Defaults to true.

Flag which defines if the entity should be enabled when first added. Defaults to true.

The encoding of the payloads received and published messages. Set to “” to disable decoding of incoming payload. Defaults to "utf-8".

The encoding of the payloads received and published messages. Set to “” to disable decoding of incoming payload. Defaults to "utf-8".

The category of the entity.

Icon for the entity.

Icon for the entity.

Defines a template to extract the JSON dictionary from messages received on the json_attributes_topic.

Defines a template to extract the JSON dictionary from messages received on the json_attributes_topic.

The MQTT topic subscribed to receive a JSON dictionary payload and then set as entity attributes.

Implies force_update of the current state when a message is received on this topic.

The MQTT topic subscribed to receive a JSON dictionary payload and then set as entity attributes.

Implies force_update of the current state when a message is received on this topic.

The name of the MQTT entity.

The name of the MQTT entity.

Used instead of name for automatic generation of entity_id.

Used instead of name for automatic generation of entity_id.

The maximum QoS level of the state topic.

An ID that uniquely identifies this entity. If two entities have the same unique ID, Home Assistant will raise an exception.

An ID that uniquely identifies this entity. If two entities have the same unique ID, Home Assistant will raise an exception.

The MQTT topic to publish commands to control the cover.

The MQTT topic to publish commands to control the cover.

Sets the class of the device, changing the device state and icon that is displayed on the frontend.

Flag that defines if the cover works in optimistic mode. Defaults to false if a state_topic or position_topic is defined, else true.

Flag that defines if the cover works in optimistic mode. Defaults to false if a state_topic or position_topic is defined, else true.

The command payload that closes the cover. Defaults to "CLOSE".

The command payload that closes the cover. Defaults to "CLOSE".

The command payload that opens the cover. Defaults to "OPEN".

The command payload that opens the cover. Defaults to "OPEN".

The command payload that stops the cover. Defaults to "STOP".

The command payload that stops the cover. Defaults to "STOP".

Number which represents closed position. Defaults to 0.

Number which represents closed position. Defaults to 0.

Number which represents open position. Defaults to 100.

Number which represents open position. Defaults to 100.

Defines a template that can be used to extract the payload for the position_topic topic. Within the template the following variables are available:

  • entity_id
  • position_open
  • position_closed
  • tilt_min
  • tilt_max

The entity_id can be used to reference the entity’s attributes with the help of the states template function.

Defines a template that can be used to extract the payload for the position_topic topic. Within the template the following variables are available:

  • entity_id
  • position_open
  • position_closed
  • tilt_min
  • tilt_max

The entity_id can be used to reference the entity’s attributes with the help of the states template function.

The MQTT topic subscribed to receive cover position messages.

The MQTT topic subscribed to receive cover position messages.

Defines if published messages should have the retain flag set. Defaults to false.

Defines if published messages should have the retain flag set. Defaults to false.

Defines a template to define the position to be sent to the set_position_topic topic. Incoming position value is available for use in the template {{ position }}. Within the template the following variables are available:

  • entity_id
  • position in percent
  • position_open
  • position_closed
  • tilt_min
  • tilt_max

The entity_id can be used to reference the entity’s attributes with the help of the states template function.

Defines a template to define the position to be sent to the set_position_topic topic. Incoming position value is available for use in the template {{ position }}. Within the template the following variables are available:

  • entity_id
  • position in percent
  • position_open
  • position_closed
  • tilt_min
  • tilt_max

The entity_id can be used to reference the entity’s attributes with the help of the states template function.

The MQTT topic to publish position commands to. You need to set position_topic as well if you want to use position topic. Use template if position topic wants different values than within range position_closed - position_open. If template is not defined and position_closed != 100 and position_open != 0 then proper position value is calculated from percentage position.

The MQTT topic to publish position commands to. You need to set position_topic as well if you want to use position topic. Use template if position topic wants different values than within range position_closed - position_open. If template is not defined and position_closed != 100 and position_open != 0 then proper position value is calculated from percentage position.

The payload that represents the closed state. Defaults to "closed".

The payload that represents the closed state. Defaults to "closed".

The payload that represents the closing state. Defaults to "closing".

The payload that represents the closing state. Defaults to "closing".

The payload that represents the open state. Defaults to "open".

The payload that represents the open state. Defaults to "open".

The payload that represents the opening state. Defaults to "opening".

The payload that represents the opening state. Defaults to "opening".

The payload that represents the stopped state (for covers that do not report open/closed state). Defaults to "stopped".

The payload that represents the stopped state (for covers that do not report open/closed state). Defaults to "stopped".

The MQTT topic subscribed to receive cover state messages. State topic can only read (open, opening, closed, closing or stopped) state.

The MQTT topic subscribed to receive cover state messages. State topic can only read (open, opening, closed, closing or stopped) state.

The value that will be sent on a close_cover_tilt command. Defaults to 0.

The value that will be sent on a close_cover_tilt command. Defaults to 0.

Defines a template that can be used to extract the payload for the tilt_command_topic topic. Within the template the following variables are available:

  • entity_id
  • tilt_position in percent
  • position_open
  • position_closed
  • tilt_min
  • tilt_max

The entity_id can be used to reference the entity’s attributes with the help of the states template function.

Defines a template that can be used to extract the payload for the tilt_command_topic topic. Within the template the following variables are available:

  • entity_id
  • tilt_position in percent
  • position_open
  • position_closed
  • tilt_min
  • tilt_max

The entity_id can be used to reference the entity’s attributes with the help of the states template function.

The MQTT topic to publish commands to control the cover tilt.

The MQTT topic to publish commands to control the cover tilt.

The maximum tilt value. Defaults to 100.

The maximum tilt value. Defaults to 100.

The minimum tilt value. Defaults to 0.

The minimum tilt value. Defaults to 0.

The value that will be sent on an open_cover_tilt command. Defaults to 100.

The value that will be sent on an open_cover_tilt command. Defaults to 100.

Flag that determines if tilt works in optimistic mode. Defaults to true if tilt_status_topic is not defined, else false.

Flag that determines if tilt works in optimistic mode. Defaults to true if tilt_status_topic is not defined, else false.

Defines a template that can be used to extract the payload for the tilt_status_topic topic. Within the template the following variables are available:

  • entity_id
  • position_open
  • position_closed
  • tilt_min
  • tilt_max

The entity_id can be used to reference the entity’s attributes with the help of the states template function.

Defines a template that can be used to extract the payload for the tilt_status_topic topic. Within the template the following variables are available:

  • entity_id
  • position_open
  • position_closed
  • tilt_min
  • tilt_max

The entity_id can be used to reference the entity’s attributes with the help of the states template function.

The MQTT topic subscribed to receive tilt status update values.

The MQTT topic subscribed to receive tilt status update values.

Defines a template that can be used to extract the payload for the state_topic topic.

Defines a template that can be used to extract the payload for the state_topic topic.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Serialize this value into the given Serde serializer. Read more
Invalidity objectives
Perform the validation Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Convert self into output value and validate the output Read more
Check if this instance is valid, discarding all further information why if not. Read more
Set the foreground color generically Read more
Set the background color generically. Read more
Change the foreground color to black
Change the background color to black
Change the foreground color to red
Change the background color to red
Change the foreground color to green
Change the background color to green
Change the foreground color to yellow
Change the background color to yellow
Change the foreground color to blue
Change the background color to blue
Change the foreground color to magenta
Change the background color to magenta
Change the foreground color to purple
Change the background color to purple
Change the foreground color to cyan
Change the background color to cyan
Change the foreground color to white
Change the background color to white
Change the foreground color to the terminal default
Change the background color to the terminal default
Change the foreground color to bright black
Change the background color to bright black
Change the foreground color to bright red
Change the background color to bright red
Change the foreground color to bright green
Change the background color to bright green
Change the foreground color to bright yellow
Change the background color to bright yellow
Change the foreground color to bright blue
Change the background color to bright blue
Change the foreground color to bright magenta
Change the background color to bright magenta
Change the foreground color to bright purple
Change the background color to bright purple
Change the foreground color to bright cyan
Change the background color to bright cyan
Change the foreground color to bright white
Change the background color to bright white
Make the text bold
Make the text dim
Make the text italicized
Make the text italicized
Make the text blink
Make the text blink (but fast!)
Swap the foreground and background colors
Hide the text
Cross out the text
Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
Set the foreground color to a specific RGB value.
Set the background color to a specific RGB value.
Sets the foreground color to an RGB value.
Sets the background color to an RGB value.
Apply a runtime-determined style
Apply a given transformation function to all formatters if the given stream supports at least basic ANSI colors, allowing you to conditionally apply given styles/colors. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Convert input value into Self and validate self Read more