feat: add webhooks with basic json to send to
This commit is contained in:
parent
18aa3dfaa8
commit
1b0284b00b
7 changed files with 1432 additions and 10 deletions
13
src/gpio.rs
13
src/gpio.rs
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue