universal_notifier icon indicating copy to clipboard operation
universal_notifier copied to clipboard

notify.send_message fails with 'extra keys not allowed @ data[target]'

Open Rabosa616 opened this issue 3 months ago • 1 comments

What version of Universal Notifier are you using? Latest (v0.8.0)

What version of Home Assistant are you using? 2026.8


The problem

When configuring a channel with notify.send_message and a target notify entity (Home Assistant Companion App mobile device), calling universal_notifier.send raises two errors in sequence:

Error 1:

extra keys not allowed @ data['target']

Error 2 (after fixing error 1):

extra keys not allowed @ data['data']

Additionally, even when the call succeeds, iOS devices receive messages with raw HTML tags (<b>, etc.) and the HA prefix [Home Assistant - 18:10:00] Bon dia. — iOS notifications do not render HTML.


Root cause (3 issues)

Issue 1 — target in service_data

Section H puts target: ["notify.xxx"] inside service_payload. notify.send_message does not accept target in service_data — it must be passed as the separate target= kwarg of hass.services.async_call.

Issue 2 — data in service_data

Section I adds data: {parse_mode: "html"} to service_payload for all notify channels. notify.send_message does not accept a data key in service_data.

Issue 3 — HTML formatting and HA prefix on iOS

Section D builds the message with HTML formatting and the [HA - time] greeting. prefix for all non-voice channels. iOS companion app does not render HTML — it displays raw tags literally. Android does render HTML, so formatting should be preserved for Android devices.


What is your channels configuration for Universal Notifier?

Alias:   mobil_test
Service: notify.send_message
Target:  notify.test_mobil
Is Voice: no

What actions did you take in the developer tools?

service: universal_notifier.send
data:
  message: "Test notification"
  targets:
    - mobil_test

Anything in the logs?

Error executing script. Invalid data for call_service at pos 1: extra keys not allowed @ data['target']
extra keys not allowed @ data['target']. Got None (invalid_format)

Error executing script. Invalid data for call_service at pos 1: extra keys not allowed @ data['data']
extra keys not allowed @ data['data']. Got None (invalid_format)

Fix (PR #38)

Section D — iOS vs Android detection

Use device_registry to check the manufacturer of the target notify entity. If Apple → plain text, no HTML, no HA prefix/greeting. Otherwise (Android) → standard HTML formatting.

Section J — target and data extraction

For notify.send_message, extract target from service_payload and pass it as target={"entity_id": [...]} to async_call. Also strip the data key which notify.send_message does not accept.

A fix covering all three issues is available in PR #38.

Rabosa616 avatar Sep 04 '26 15:09 Rabosa616

Solved in v0.9.0

jumping2000 avatar Sep 06 '26 16:09 jumping2000