mirror of
https://codeberg.org/icewind/taspromto.git
synced 2026-06-03 08:34:21 +02:00
set tasmota_id for mitemp data
This commit is contained in:
parent
cc82cc88c7
commit
5077717dcc
1 changed files with 8 additions and 7 deletions
|
|
@ -160,7 +160,7 @@ pub fn format_device_state<W: Write>(
|
||||||
}
|
}
|
||||||
|
|
||||||
for (addr, state) in state.mi_temp_devices.iter() {
|
for (addr, state) in state.mi_temp_devices.iter() {
|
||||||
format_mi_temp_state(&mut writer, *addr, mi_temp_names, state)?;
|
format_mi_temp_state(&mut writer, device, *addr, mi_temp_names, state)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -168,6 +168,7 @@ pub fn format_device_state<W: Write>(
|
||||||
|
|
||||||
pub fn format_mi_temp_state<W: Write>(
|
pub fn format_mi_temp_state<W: Write>(
|
||||||
mut writer: W,
|
mut writer: W,
|
||||||
|
device: &Device,
|
||||||
addr: BDAddr,
|
addr: BDAddr,
|
||||||
names: &BTreeMap<BDAddr, String>,
|
names: &BTreeMap<BDAddr, String>,
|
||||||
state: &MiTempState,
|
state: &MiTempState,
|
||||||
|
|
@ -185,24 +186,24 @@ pub fn format_mi_temp_state<W: Write>(
|
||||||
if state.battery > 0 {
|
if state.battery > 0 {
|
||||||
writeln!(
|
writeln!(
|
||||||
writer,
|
writer,
|
||||||
"sensor_battery{{mac=\"{}\", name=\"{}\"}} {}",
|
"sensor_battery{{tasmota_id=\"{}\", mac=\"{}\", name=\"{}\"}} {}",
|
||||||
addr, name, state.battery
|
device.hostname, addr, name, state.battery
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if state.temperature > 0.0 {
|
if state.temperature > 0.0 {
|
||||||
writeln!(
|
writeln!(
|
||||||
writer,
|
writer,
|
||||||
"sensor_temperature{{mac=\"{}\", name=\"{}\"}} {}",
|
"sensor_temperature{{tasmota_id=\"{}\", mac=\"{}\", name=\"{}\"}} {}",
|
||||||
addr, name, state.temperature
|
device.hostname, addr, name, state.temperature
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if state.humidity > 0.0 {
|
if state.humidity > 0.0 {
|
||||||
writeln!(
|
writeln!(
|
||||||
writer,
|
writer,
|
||||||
"sensor_humidity{{mac=\"{}\", name=\"{}\"}} {}",
|
"sensor_humidity{{tasmota_id=\"{}\", mac=\"{}\", name=\"{}\"}} {}",
|
||||||
addr, name, state.humidity
|
device.hostname, addr, name, state.humidity
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue