Charger does not get turned off when leaving the house
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
07563a6d30
commit
1a9d12b1f3
|
@ -116,7 +116,7 @@ pub struct MqttDeviceConfig {
|
|||
pub topic: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
#[derive(Debug, Clone, Deserialize, PartialEq, Eq)]
|
||||
pub enum OutletType {
|
||||
Outlet,
|
||||
Kettle,
|
||||
|
|
|
@ -112,8 +112,9 @@ impl OnMqtt for IkeaOutlet {
|
|||
#[async_trait]
|
||||
impl OnPresence for IkeaOutlet {
|
||||
async fn on_presence(&mut self, presence: bool) {
|
||||
// Turn off the outlet when we leave the house
|
||||
if !presence {
|
||||
// Turn off the outlet when we leave the house (Not if it is a battery charger)
|
||||
debug!(id = self.identifier, "{:?}", self.outlet_type);
|
||||
if !presence && self.outlet_type != OutletType::Charger {
|
||||
debug!(id = self.identifier, "Turning device off");
|
||||
self.set_on(false).ok();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user