Add custom parameters to Home Assistant notification
MiguelAngelLV opened this issue · 4 comments
Hi!
I am trying use home assistant notification with a Telegram services (yes, I know I can use telegram directly without HA, but with HA service I can configure all from HA without touch anything in Epic Games Free).
The problem is the notification generate invalid markdown code, so, telegram service fail.
The simple solution is add parameters to service and I could add mode=html and all would work fine.
{
"type": "homeassistant",
"instance": "https://homeassistant.example.com",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
"notifyservice": "mobile_app_smartphone_name",
"notifydata": {
"mode": "html"
}
}
After looking at the Home Assistant docs, I don't quite understand your request. The HTML option isn't an HTML flag in the API; it seems to just be that the API accepts HTML.
Are you requesting that the notification message is formatted as HTML when with "mode": "html"
? In that case, wouldn't that still be invalid Markdown for your Telegram service?
My request is pass "any param" to service so it allow use with any Home Assistant notifier, not only mobile notifier.
For example, for Telegram Notifier (https://www.home-assistant.io/integrations/telegram/#extra-data-attributes-support) there are parse_mode and the default value is markdown, but the text sended by epicgames-freegames is not a valid markdown, but, adding parse_mode: "html" the message it will work fine.
This too allow use another's notifiers as discords (https://www.home-assistant.io/integrations/discord/) for example with it own params.
Added the customData option to the Home Assistant config. It takes an object, so you can set
"customData": {
"parse_mode": "html"
}
in the home assistant notifier config in your config.json. Let me know if that works for you.
I tested and it does not work :(
I think that HA remove custom parameters.
I will send you a PR for "universal" webhook notifier and it should be compatible with HA.
Thanks ;)