mirror of
https://codeberg.org/icewind/taspromto.git
synced 2026-06-03 16:44:11 +02:00
support rtl433 temp sensors
This commit is contained in:
parent
217298c1c7
commit
347cfe2054
6 changed files with 137 additions and 24 deletions
|
|
@ -78,7 +78,7 @@ async fn serve(device_states: Arc<Mutex<DeviceStates>>, config: Config) {
|
|||
format_mi_temp_state(&mut response, *addr, &mi_temp_names, state).unwrap()
|
||||
}
|
||||
for (channel, state) in state.rf_temp() {
|
||||
format_rf_temp_state(&mut response, channel, &rf_temp_names, state).unwrap()
|
||||
format_rf_temp_state(&mut response, &channel, &rf_temp_names, state).unwrap()
|
||||
}
|
||||
response
|
||||
});
|
||||
|
|
@ -141,6 +141,11 @@ async fn mqtt_client<S: Stream<Item = Result<Publish>>>(
|
|||
let mut device_states = device_states.lock().unwrap();
|
||||
device_states.update_rf(payload);
|
||||
}
|
||||
Topic::Rtl(device, field) => {
|
||||
let payload = std::str::from_utf8(message.payload.as_ref()).unwrap_or_default();
|
||||
let mut device_states = device_states.lock().unwrap();
|
||||
device_states.update_rtl(&device.hostname, &field, payload);
|
||||
}
|
||||
topic @ (Topic::Water(_)
|
||||
| Topic::Gas(_)
|
||||
| Topic::Energy1(_)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue