Fix scoping
This commit is contained in:
parent
3bdc909933
commit
016bc590d1
@ -23,19 +23,18 @@ pub struct Common {
|
|||||||
pub object_id: Option<String>,
|
pub object_id: Option<String>,
|
||||||
|
|
||||||
/// Defines a [template](/docs/configuration/templating/#using-templates-with-the-mqtt-integration) to extract device's availability from the `availability_topic`. To determine the devices's availability result of this template will be compared to `payload_available` and `payload_not_available`.
|
/// Defines a [template](/docs/configuration/templating/#using-templates-with-the-mqtt-integration) to extract device's availability from the `availability_topic`. To determine the devices's availability result of this template will be compared to `payload_available` and `payload_not_available`.
|
||||||
|
|
||||||
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
|
||||||
availability_template: Option<Template>,
|
|
||||||
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
||||||
|
pub availability_template: Option<Template>,
|
||||||
|
|
||||||
/// When `availability` is configured, this controls the conditions needed to set the entity to `available`. Valid entries are `all`, `any`, and `latest`. If set to `all`, `payload_available` must be received on all configured availability topics before the entity is marked as online. If set to `any`, `payload_available` must be received on at least one configured availability topic before the entity is marked as online. If set to `latest`, the last `payload_available` or `payload_not_available` received on any configured availability topic controls the availability.
|
/// When `availability` is configured, this controls the conditions needed to set the entity to `available`. Valid entries are `all`, `any`, and `latest`. If set to `all`, `payload_available` must be received on all configured availability topics before the entity is marked as online. If set to `any`, `payload_available` must be received on at least one configured availability topic before the entity is marked as online. If set to `latest`, the last `payload_available` or `payload_not_available` received on any configured availability topic controls the availability.
|
||||||
availability_mode: Option<AvailabilityMode>,
|
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
||||||
|
pub availability_mode: Option<AvailabilityMode>,
|
||||||
|
|
||||||
/// A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with `availability_topic`.
|
/// A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with `availability_topic`.
|
||||||
availability: Availability,
|
pub availability: Option<Availability>,
|
||||||
|
|
||||||
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
||||||
device: Option<Device>,
|
pub device: Option<Device>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||||
@ -70,15 +69,15 @@ pub enum Availability {
|
|||||||
pub struct CustomAvailability {
|
pub struct CustomAvailability {
|
||||||
/// The payload that represents the available state.
|
/// The payload that represents the available state.
|
||||||
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
||||||
payload_available: Option<String>,
|
pub payload_available: Option<String>,
|
||||||
/// The payload that represents the unavailable state.
|
/// The payload that represents the unavailable state.
|
||||||
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
||||||
payload_not_available: Option<String>,
|
pub payload_not_available: Option<String>,
|
||||||
/// An MQTT topic subscribed to receive availability (online/offline) updates.
|
/// An MQTT topic subscribed to receive availability (online/offline) updates.
|
||||||
topic: String,
|
pub topic: String,
|
||||||
/// Defines a [template](/docs/configuration/templating/#using-templates-with-the-mqtt-integration) to extract device's availability from the `topic`. To determine the devices's availability result of this template will be compared to `payload_available` and `payload_not_available`.
|
/// Defines a [template](/docs/configuration/templating/#using-templates-with-the-mqtt-integration) to extract device's availability from the `topic`. To determine the devices's availability result of this template will be compared to `payload_available` and `payload_not_available`.
|
||||||
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
||||||
value_template: Option<Template>,
|
pub value_template: Option<Template>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||||
@ -88,45 +87,45 @@ pub struct CustomAvailability {
|
|||||||
pub struct Device {
|
pub struct Device {
|
||||||
/// A link to the webpage that can manage the configuration of this device. Can be either an http://, https:// or an internal homeassistant:// URL.
|
/// A link to the webpage that can manage the configuration of this device. Can be either an http://, https:// or an internal homeassistant:// URL.
|
||||||
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
||||||
configuration_url: Option<String>,
|
pub configuration_url: Option<String>,
|
||||||
|
|
||||||
/// A list of connections of the device to the outside world as a list of tuples [connection_type, connection_identifier]. For example the MAC address of a network interface: "connections": [["mac", "02:5b:26:a8:dc:12"]].
|
/// A list of connections of the device to the outside world as a list of tuples [connection_type, connection_identifier]. For example the MAC address of a network interface: "connections": [["mac", "02:5b:26:a8:dc:12"]].
|
||||||
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
||||||
connections: Option<Vec<String>>,
|
pub connections: Option<Vec<String>>,
|
||||||
|
|
||||||
/// The hardware version of the device.
|
/// The hardware version of the device.
|
||||||
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
||||||
hw_version: Option<String>,
|
pub hw_version: Option<String>,
|
||||||
|
|
||||||
/// A list of IDs that uniquely identify the device. For example a serial number.
|
/// A list of IDs that uniquely identify the device. For example a serial number.
|
||||||
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
||||||
identifiers: Option<Either<String, Vec<String>>>,
|
pub identifiers: Option<Either<String, Vec<String>>>,
|
||||||
|
|
||||||
/// The manufacturer of the device.
|
/// The manufacturer of the device.
|
||||||
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
||||||
manufacturer: Option<String>,
|
pub manufacturer: Option<String>,
|
||||||
|
|
||||||
/// The model of the device.
|
/// The model of the device.
|
||||||
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
||||||
model: Option<String>,
|
pub model: Option<String>,
|
||||||
|
|
||||||
/// The name of the device.
|
/// The name of the device.
|
||||||
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
||||||
name: Option<String>,
|
pub name: Option<String>,
|
||||||
|
|
||||||
/// The serial number of the device.
|
/// The serial number of the device.
|
||||||
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
||||||
serial_number: Option<String>,
|
pub serial_number: Option<String>,
|
||||||
|
|
||||||
/// Suggest an area if the device isn't in one yet.
|
/// Suggest an area if the device isn't in one yet.
|
||||||
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
||||||
suggested_area: Option<String>,
|
pub suggested_area: Option<String>,
|
||||||
|
|
||||||
/// The firmware version of the device.
|
/// The firmware version of the device.
|
||||||
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
||||||
sw_version: Option<String>,
|
pub sw_version: Option<String>,
|
||||||
|
|
||||||
/// Identifier of a device that routes messages between this device and Home Assistant. Examples of such devices are hubs, or parent devices of a sub-device. This is used to show device topology in Home Assistant.
|
/// Identifier of a device that routes messages between this device and Home Assistant. Examples of such devices are hubs, or parent devices of a sub-device. This is used to show device topology in Home Assistant.
|
||||||
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
|
||||||
via_device: Option<String>,
|
pub via_device: Option<String>,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user