From ff3fc65eef8629e220640d00b8702f5ff6c6935e Mon Sep 17 00:00:00 2001 From: Gilles Soulier Date: Tue, 30 Dec 2025 08:22:05 +0100 Subject: [PATCH] Remove 'type' field from discovery payload per HA spec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The type field is not required in the discovery payload JSON. The entity type is determined by the discovery topic itself: - homeassistant/sensor/.../config indicates a sensor - homeassistant/switch/.../config indicates a switch This aligns with the official Home Assistant MQTT discovery documentation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- pilot-v2/src/ha/mod.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pilot-v2/src/ha/mod.rs b/pilot-v2/src/ha/mod.rs index 90164d9..ba31abb 100644 --- a/pilot-v2/src/ha/mod.rs +++ b/pilot-v2/src/ha/mod.rs @@ -19,8 +19,6 @@ struct DeviceInfo { #[derive(Serialize)] struct EntityConfig<'a> { name: &'a str, - #[serde(rename = "type")] - entity_type: &'a str, unique_id: String, state_topic: String, availability_topic: String, @@ -69,7 +67,6 @@ pub async fn publish_all(client: &AsyncClient, cfg: &Config) -> Result<()> { let entity_name = format!("{}_{}", key, cfg.device.name); let entity = EntityConfig { name: &entity_name, - entity_type: "sensor", unique_id: format!("{}_{}", cfg.device.name, key), state_topic: format!("{}/{}", base, key), availability_topic: format!("{}/{}/available", base, key), @@ -98,7 +95,6 @@ pub async fn publish_all(client: &AsyncClient, cfg: &Config) -> Result<()> { let entity_name = format!("{}_{}", key, cfg.device.name); let entity = EntityConfig { name: &entity_name, - entity_type: "switch", unique_id: format!("{}_{}", cfg.device.name, key), state_topic: format!("{}/{}/state", base, key), availability_topic: format!("{}/{}/available", base, key),