From 76b75b0cfb53ae8331d8dd5468bca8330d77f8a5 Mon Sep 17 00:00:00 2001 From: Dreaded_X Date: Sun, 13 Aug 2023 23:20:07 +0200 Subject: [PATCH] The light in the bathroom will now turn off automatically after 45 min --- config/config.toml | 8 ++++++++ config/zeus.dev.toml | 20 ++++++++++++++------ google-home/src/types.rs | 4 ++-- src/devices/ikea_outlet.rs | 2 ++ 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/config/config.toml b/config/config.toml index cca6bad..ca138c0 100644 --- a/config/config.toml +++ b/config/config.toml @@ -35,6 +35,14 @@ room = "Kitchen" topic = "zigbee2mqtt/kitchen/kettle" timeout = 300 +[devices.bathroom_light] +type = "IkeaOutlet" +outlet_type = "Light" +name = "Light" +room = "Bathroom" +topic = "zigbee2mqtt/bathroom/light" +timeout = 2700 + [devices.workbench_charger] type = "IkeaOutlet" outlet_type = "Charger" diff --git a/config/zeus.dev.toml b/config/zeus.dev.toml index 636b7b5..792a285 100644 --- a/config/zeus.dev.toml +++ b/config/zeus.dev.toml @@ -2,12 +2,12 @@ base_url = "https://login.huizinga.dev/api/oidc" [mqtt] -host="olympus.lan.huizinga.dev" -port=8883 -client_name="automation-zeus" -username="mqtt" -password="${MQTT_PASSWORD}" -tls=true +host = "olympus.lan.huizinga.dev" +port = 8883 +client_name = "automation-zeus" +username = "mqtt" +password = "${MQTT_PASSWORD}" +tls = true [ntfy] topic = "${NTFY_TOPIC}" @@ -36,6 +36,14 @@ room = "Kitchen" topic = "zigbee2mqtt/kitchen/kettle" timeout = 5 +[devices.bathroom_light] +type = "IkeaOutlet" +outlet_type = "Light" +name = "Bathroom light" +room = "Bathroom" +topic = "zigbee2mqtt/bathroom/light" +timeout = 5 + [devices.workbench_charger] type = "IkeaOutlet" outlet_type = "Charger" diff --git a/google-home/src/types.rs b/google-home/src/types.rs index dd8fc4e..a430e44 100644 --- a/google-home/src/types.rs +++ b/google-home/src/types.rs @@ -6,8 +6,8 @@ pub enum Type { Kettle, #[serde(rename = "action.devices.types.OUTLET")] Outlet, - #[serde(rename = "action.devices.types.GRILL")] - Grill, + #[serde(rename = "action.devices.types.LIGHT")] + Light, #[serde(rename = "action.devices.types.SCENE")] Scene, } diff --git a/src/devices/ikea_outlet.rs b/src/devices/ikea_outlet.rs index 7e89648..cd94f6d 100644 --- a/src/devices/ikea_outlet.rs +++ b/src/devices/ikea_outlet.rs @@ -25,6 +25,7 @@ pub enum OutletType { Outlet, Kettle, Charger, + Light, } #[derive(Debug, Clone, Deserialize)] @@ -179,6 +180,7 @@ impl GoogleHomeDevice for IkeaOutlet { match self.outlet_type { OutletType::Outlet => Type::Outlet, OutletType::Kettle => Type::Kettle, + OutletType::Light => Type::Light, // Find a better device type for this, ideally would like to use charger, but that needs more work OutletType::Charger => Type::Outlet, // Find a better device type for this, ideally would like to use charger, but that needs more work } }