Discord embeds in notification causing errors

I have been using Discord as notification platform for some time now.
Messages all similarly formatted:


Recently, I noticed that i don’t get messages anymore.
Checking logs I found below error:

Logger: homeassistant.core
Source: components/discord/notify.py:70
First occurred: 3:55:14 PM (1 occurrences)
Last logged: 3:55:14 PM

Error executing service: <ServiceCall notify.discord (c:706c4a0fbcad6156d529c24754db2b2b): message=Template(""), data=embed=title=Window Open, description=Bedroom Window 1 still open, url=https://www.home-assistant.io, color=199363, author=name=Home Assistant, url=https://www.home-assistant.io, icon_url=https://www.home-assistant.io/images/favicon-192x192-full.png, footer=text=payload &" | Window & Door Alerts", thumbnail=url=https://www.home-assistant.io/images/favicon-192x192-full.png, fields=[{'name': 'Sensor: Open/Close', 'value': 'Open', 'inline': True}, {'name': 'Light Intensity', 'value': '$entities("sensor.lightlevel_7").state', 'inline': True}], target=['812330990734934038']>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 1654, in catch_exceptions
    await coro_or_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1673, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/components/notify/legacy.py", line 222, in _async_notify_message_service
    await self.async_send_message(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/discord/notify.py", line 70, in async_send_message
    embed = nextcord.Embed(**embedding)
TypeError: __init__() got an unexpected keyword argument 'author'

It seems that the message format i used is no longer handled the same way.
These are Discord embeds. The guide to them is still showing the same configuration.

Simpler messages get sent, so it is not total notification failure, it’s the message format.

Did I miss some change in message formatting?
Is it a bug I should report at github?

Oh, message format I use:

{  "message":"",
           "title":"Window Open",
           "description":"Bedroom Window 2 still open",
               "name":"Home Assistant",
           "footer":{"text":payload &" | Window & Door Alerts"},
                   "name":"Sensor: Open/Close",
                   "name":"Light Intensity",
                   "value": $entities("sensor.lightlevel_7").state,

Any help is appreciated.

Cheers, Peter

1 Like

Same issue here. I just started to use discord for notifications, and got the same errors.

The only things that work right now are title, description and url.

Seems that discord component was replaced Replace discord.py with nextcord by frenck · Pull Request #66540 · home-assistant/core · GitHub - however I can’t figure out in what way this changes the message format.

This is what happens when someone upgrades a major version without testing. That PR should never have been approved

Well, it’s working again.
So, thanks for fixing it.

1 Like