feat: Added low battery notification and made mqtt message parsing more robust

Resolves: #1
This commit is contained in:
2025-09-02 01:04:26 +02:00
parent 1b8566e593
commit 8109dcf2f5
5 changed files with 129 additions and 59 deletions

View File

@@ -68,13 +68,8 @@ pub enum RemoteAction {
// Message used to report the action performed by a remote
#[derive(Debug, Deserialize)]
pub struct RemoteMessage {
action: RemoteAction,
}
impl RemoteMessage {
pub fn action(&self) -> RemoteAction {
self.action
}
pub action: Option<RemoteAction>,
pub battery: Option<f32>,
}
impl TryFrom<Publish> for RemoteMessage {
@@ -144,13 +139,8 @@ impl TryFrom<Publish> for BrightnessMessage {
// Message to report the state of a contact sensor
#[derive(Debug, Deserialize)]
pub struct ContactMessage {
contact: bool,
}
impl ContactMessage {
pub fn is_closed(&self) -> bool {
self.contact
}
pub contact: Option<bool>,
pub battery: Option<f32>,
}
impl TryFrom<Publish> for ContactMessage {