Skip to content

Commit

Permalink
fix: Fix invalid event type being sent
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerSelwyn committed Jan 21, 2025
1 parent d87e8c6 commit 4b21a8b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions custom_components/mqtt_discoverystream_alt/classes/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ def build_config(self, config, entity_info: EntityInfo):
async def async_publish_state(self, new_state, mybase):
"""Publish the state for a text."""

payload = {ATTR_EVENT_TYPE: new_state.attributes[ATTR_EVENT_TYPE]}
await self._async_mqtt_publish(ATTR_STATE, payload, mybase, encoded=True)
if (
new_state.attributes[ATTR_EVENT_TYPE]
in new_state.attributes[ATTR_EVENT_TYPES]
):
payload = {ATTR_EVENT_TYPE: new_state.attributes[ATTR_EVENT_TYPE]}
await self._async_mqtt_publish(ATTR_STATE, payload, mybase, encoded=True)

await super().async_publish_state(new_state, mybase)

0 comments on commit 4b21a8b

Please sign in to comment.