Enable MQTT force update
This commit is contained in:
parent
926b15949d
commit
e7e958c757
2 changed files with 7 additions and 0 deletions
|
@ -92,6 +92,7 @@ pub async fn post_config(
|
|||
MqttDeviceDiscoveryComponent {
|
||||
platform: "sensor",
|
||||
device_class: "battery",
|
||||
force_update: true,
|
||||
unit_of_measurement: Some("%"),
|
||||
value_template: "{{ value_json.battery_level }}",
|
||||
unique_id: &unique_id_battery_level,
|
||||
|
@ -102,6 +103,7 @@ pub async fn post_config(
|
|||
MqttDeviceDiscoveryComponent {
|
||||
platform: "sensor",
|
||||
device_class: "current",
|
||||
force_update: true,
|
||||
unit_of_measurement: Some("mA"),
|
||||
value_template: "{{ value_json.battery_current }}",
|
||||
unique_id: &unique_id_battery_current,
|
||||
|
@ -112,6 +114,7 @@ pub async fn post_config(
|
|||
MqttDeviceDiscoveryComponent {
|
||||
platform: "sensor",
|
||||
device_class: "voltage",
|
||||
force_update: true,
|
||||
unit_of_measurement: Some("mV"),
|
||||
value_template: "{{ value_json.battery_voltage }}",
|
||||
unique_id: &unique_id_battery_voltage,
|
||||
|
|
|
@ -210,12 +210,16 @@ pub struct MqttDeviceDiscoveryOrigin<'a> {
|
|||
pub struct MqttDeviceDiscoveryComponent<'a> {
|
||||
#[serde(rename = "p")]
|
||||
pub platform: &'a str,
|
||||
|
||||
pub device_class: &'a str,
|
||||
|
||||
pub force_update: bool,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[serde(default)]
|
||||
pub unit_of_measurement: Option<&'a str>,
|
||||
|
||||
pub value_template: &'a str,
|
||||
|
||||
pub unique_id: &'a str,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue