feat: add webhooks with basic json to send to

This commit is contained in:
Jet Pham 2025-06-04 19:25:08 -07:00
parent 18aa3dfaa8
commit 1b0284b00b
No known key found for this signature in database
7 changed files with 1432 additions and 10 deletions

View file

@ -1,14 +1,25 @@
use std::time::Duration;
use std::fmt;
use serde::{Serialize, Deserialize};
use anyhow::Result;
use rppal::gpio::{Gpio, InputPin, Level};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum CircuitEvent {
Open,
Closed,
}
impl fmt::Display for CircuitEvent {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
CircuitEvent::Open => write!(f, "open"),
CircuitEvent::Closed => write!(f, "closed"),
}
}
}
pub struct GpioMonitor {
pin: InputPin,
poll_interval: Duration,