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

Add custom parameters to Home Assistant notification #375

Closed
MiguelAngelLV opened this issue Jan 26, 2024 · 4 comments · Fixed by #380
Closed

Add custom parameters to Home Assistant notification #375

MiguelAngelLV opened this issue Jan 26, 2024 · 4 comments · Fixed by #380
Labels
enhancement New feature or request

Comments

@MiguelAngelLV
Copy link
Contributor

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"
        }
}
@claabs claabs added the enhancement New feature or request label Feb 15, 2024
@claabs
Copy link
Owner

claabs commented Feb 17, 2024

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?

@MiguelAngelLV
Copy link
Contributor Author

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.

@claabs claabs closed this as completed in 2734e6b Feb 17, 2024
@claabs
Copy link
Owner

claabs commented Feb 17, 2024

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.

@MiguelAngelLV
Copy link
Contributor Author

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 ;)

@claabs claabs reopened this Feb 23, 2024
@claabs claabs linked a pull request Feb 23, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants