diff --git a/alexBot/cogs/smartHome.py b/alexBot/cogs/smartHome.py index 6230f63..1eb84e5 100644 --- a/alexBot/cogs/smartHome.py +++ b/alexBot/cogs/smartHome.py @@ -271,8 +271,9 @@ async def on_presence_update(self, before: discord.Member, after: discord.Member if before.status != after.status: mqtt: HomeAssistantIntigreation = self.bot.get_cog("HomeAssistantIntigreation") # type: ignore blob = {"status": after.status.value, "mobile": after.is_on_mobile()} - self.status_cache[after.id] = blob - if self.status_cache[before.id] != blob: + + if self.status_cache.get(after.id) != blob: + self.status_cache[after.id] = blob await mqtt.mqttPublish(f"discord/{after.id}/status", json.dumps(blob))