Open lezruk opened 8 months ago
Hey 👋🏻
Looking at home assistant docs they provide a link to -> https://jinja.palletsprojects.com/en/latest/templates/#jinja-filters.int
I dont know what the template look like but I guess you should be able to type conversion?
All these filters are fine, but problem is that POST_JSON result is ALWAYS sent in quotes, which is interpreted as string. Thus gotify rejects it.
You can set the priority like this in home assistent (also included markdown support):
notify:
- name: gotify_high
platform: rest
resource: https://gotify.example.org/message
method: POST_JSON
headers:
X-Gotify-Key: AsQHYA96LH90.RT
message_param_name: message
title_param_name: title
data:
priority: 10
extras:
client::display:
contentType: "text/markdown"
Appreciate your answer, hardcoding value in data.extras works. Idea though is to avoid hardcoding and send priority as a value for individual message call within same service. Therefore I opened this request for evaluation.
How do I manually trigger an alert with priority in home assistant? developer-tools/service doesn't have a priority.
How do I manually trigger an alert with priority in home assistant? developer-tools/service doesn't have a priority.
There is target parameter for notification service, that you can map to priority for gotify call. But again internally that is sent in JSON in quotes and doesn't work. Other option would be sending payload as fields in POST call, yet in this case markdown is lost as gotify doesn't support extras parameters without json. I saw somewhere here request to implement extras fields params i gotify but that was not done
Same here, I also tried to pass priority as string and didn't work. Corollary problem is the click url needs to be null in json to be ignored by the android client, the empty string should be treated like null.
Is your feature request related to a problem? Please describe. Home-Assistant notify service with POST_JSON type always sends priority as sting in resulting JSON due to templating engine (similar how ansible jinja templating works), that is not accepted by gotify server with 400 bad requests, as it accepts strict integer value for priority only
Describe the solution you'd like gotify server to accept priority as string, and throw an error only if string value is not castable to integer
Describe alternatives you've considered No real alernativies found so far, only hardcoding particular value/default priority which doesn't serve the purpose of prioirty differentiation within single app messages
Additional context N/A