diff --git a/home-assistant/src/notify/service/mobile_app/mod.rs b/home-assistant/src/notify/service/mobile_app/mod.rs index ff442af..d5da68d 100644 --- a/home-assistant/src/notify/service/mobile_app/mod.rs +++ b/home-assistant/src/notify/service/mobile_app/mod.rs @@ -70,6 +70,19 @@ impl FromStr for NonSpecialMessage { } } +impl TryFrom for NonSpecialMessage { + type Error = WasSpecialMessage; + + fn try_from(s: String) -> Result { + match SpecialMessage::from_str(&s) { + Ok(special_message) => Err(WasSpecialMessage { + got: special_message, + }), + Err(_e) => Ok(NonSpecialMessage(s)), + } + } +} + /// How much of a notification is visible on the lock screen #[derive(Debug, Clone, Default, EnumString, strum::Display)] #[strum(serialize_all = "snake_case")]