Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST notify forces "message" parameter in JSON #140472

Open
tklenke opened this issue Mar 12, 2025 · 0 comments
Open

REST notify forces "message" parameter in JSON #140472

tklenke opened this issue Mar 12, 2025 · 0 comments

Comments

@tklenke
Copy link

tklenke commented Mar 12, 2025

The problem

homeassistant/components/rest/notify.py

If you send for example:
method: POST_JSON
data_template:
messages:
-source: "home assistant"
to: "+12345678"
body: "test msg"

you will get
{"message": "", "messages": [{"source": "homeassistant", "to": "+12345678", "body": "test msg"}]}

if you add:
message_param_name: ""

you will still get:
{"": "", "messages": [{"source": "homeassistant", "to": "+12345678", "body": "test msg"}]}

suggest adding check for length of message_param_name and if it is empty skip line 152
152: data = {self._message_param_name: message}
something like this maybe:
data = {self._message_param_name: message} if hasattr(message_param_name, 'len') and len(message_param_name) > 0 else {}

or maybe
data = {self._message_param_name: message} if message_param_name != "SUPPRESS_MESSAGE" else {}
probably is better...

What version of Home Assistant Core has the issue?

core

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

REST integration

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

Anything in the logs that might be useful for us?

Additional information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant