First, let me say thank you so much for putting this api and accompanying ansible collection together - this is exactly what I was looking for to manage my Uptime Kuma monitors!
The specific issue I am having is that adding a notification to existing monitors wasn't working. Specifically, I was getting this error when running the edit_monitor() function.
After digging through api.py and a little debugging, I am pretty sure that the issue is that there is some important code included in _build_monitor_data() that doesn't get called when edit_monitor() is called. For my specific issue, I think this code block is the critical piece. As this looks to be responsible for converting the list/array of integer notification ids to the dictionary of {id: True} that the Uptime Kuma socket API is looking for.
def _build_monitor_data(
...
):
...
dict_notification_ids = {}
if notificationIDList:
for notification_id in notificationIDList:
dict_notification_ids[notification_id] = True
notificationIDList = dict_notification_ids
...
However, I am not sure if there might be other code in this section that would be important for other monitor attributes that might be edited via edit_monitor() and is currently being missed when that function is called?
For completeness, I'll just document that currently edit_monitor() simply passes its args to data.update(), without running the args through the code above to translate the format, which I believe is the root cause of my issue.
Using the raw api library, I am able to work around this by calling edit_monitor() using notificationIDList={1: True} instead of notificationIDList=[1], but I don't think that is the intent, is it? This work around doesn't seem to work in ansible since notificationIDList is looking for a list, not a dict. Please let me know if I am just missing something here.
Thanks again for putting these packages together, they are really going to help me out.
First, let me say thank you so much for putting this api and accompanying ansible collection together - this is exactly what I was looking for to manage my Uptime Kuma monitors!
The specific issue I am having is that adding a notification to existing monitors wasn't working. Specifically, I was getting this error when running the
edit_monitor()
function.After digging through api.py and a little debugging, I am pretty sure that the issue is that there is some important code included in
_build_monitor_data()
that doesn't get called whenedit_monitor()
is called. For my specific issue, I think this code block is the critical piece. As this looks to be responsible for converting the list/array of integer notification ids to the dictionary of {id: True} that the Uptime Kuma socket API is looking for.However, I am not sure if there might be other code in this section that would be important for other monitor attributes that might be edited via
edit_monitor()
and is currently being missed when that function is called?For completeness, I'll just document that currently
edit_monitor()
simply passes its args todata.update()
, without running the args through the code above to translate the format, which I believe is the root cause of my issue.Using the raw api library, I am able to work around this by calling
edit_monitor()
usingnotificationIDList={1: True}
instead ofnotificationIDList=[1]
, but I don't think that is the intent, is it? This work around doesn't seem to work in ansible sincenotificationIDList
is looking for a list, not a dict. Please let me know if I am just missing something here.Thanks again for putting these packages together, they are really going to help me out.