Conversation
HA 2024+ notify entities (mobile companion app) require target to be passed as a separate async_call parameter, not inside service_data. Passing target in service_data raises: extra keys not allowed @ data['target'] For notify.send_message calls, extract the target entities from the payload and pass them via the target= kwarg of async_call instead.
notify.send_message does not accept 'data' in service_data either, causing 'extra keys not allowed @ data[data]'.
companion app renders plain text only; no prefix [HA - time] or greeting needed for mobile push notifications.
iOS (Apple manufacturer): plain text, no HTML, no HA prefix/greeting. Android: standard HTML formatting with prefix and greeting.
- strip_html(): strips HTML tags returning plain text - is_apple_device(): checks device registry for Apple manufacturer __init__.py now uses these helpers instead of inline logic.
Add apply_apple_notify_text_formatting, apply_android_notify_text_formatting and apply_mobile_notify_text_formatting to utils.py. Simplify __init__.py Section D: replace duplicated iOS/Android logic with a single call to apply_mobile_notify_text_formatting.
Owner
|
hello, I need to understand your PR about iOS app, you can already decide if you want markdoen or html or plain text in your notifications. |
Contributor
Author
|
Hello @jumping2000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problema
notify.send_message(HA 2023.8+) no funciona correctament amb universal_notifier per tres raons:targetdinsservice_data:notify.send_messagerequereixtargetcom a kwarg separat aasync_call, no dinsservice_data.datadinsservice_payload: universal_notifier afegeixdata: {parse_mode: html}aservice_payload, perònotify.send_messageno accepta la claudata.[Home Assistant - hora] Salutació.i les etiquetes HTML es mostren com a text pla.Solució
__init__.py— Secció J (dispatch)Per a
notify.send_message, extreutargetdeservice_payloadi passa'l com atarget={"entity_id": [...]}aasync_call. Elimina també la claudataque no accepta aquest servei.utils.py— Tres noves funcionsapply_apple_notify_text_formatting: elimina HTML, no afegeix prefix ni salutació (iOS mostra text pla).apply_android_notify_text_formatting: format HTML estàndard amb prefix[nom - hora]i salutació.apply_mobile_notify_text_formatting: dispatcher — detecta tipus de dispositiu i crida la funció corresponent.La detecció iOS/Android usa
device_registryientity_registry(funcióis_apple_deviceen utils.py): si el fabricant del dispositiu és"apple"→ iOS, sinó → Android.__init__.py— Secció D (format missatge)Substitueix el bloc duplicat iOS/Android per una crida neta:
Context
Testejat amb HA 2026.8 (WSL2). Canals configurats:
mobil_oscar→notify.goldeneggsxv,mobil_ipad→notify.vaoss_ipad. Ambdós dispositius target són Apple (iOS). Telegram i Voice PE (tts.speak) funcionen correctament.