rainepretorius / olarm-ha-integration

Integration for Olarm devices created by a BSC(Computer Science and Mathematics) student.
https://raine.pretoriusse.net
BSD 2-Clause "Simplified" License
30 stars 13 forks source link

NotFound http error when calling Olarm API device /actions endpoint #7

Closed jonathankretzmer closed 1 year ago

jonathankretzmer commented 1 year ago

Hi there,

I had a few issues installing this custom HA HACS plugin, it seemed to be crashing.

I narrowed it down to the Olarm API when it called /actions for the device. When emulating the API call in Postman, with the API key as the bearer auth header, it was coming back with an HTTP 404 error, "Not found". So this is obviously what was causing the errors.

When I commented out the calls to api.get_changed_by_json() then I managed to get it all working.

I'm not up to speed on whether there are possibly multiple different versions of the Olarm devices and/or APIs available?

rainepretorius commented 1 year ago

Hi Jonathan,

Please note that this error has been generated by Olarm and means that your device could not be found. Please ensure that your deviceid is correct.

jonathankretzmer commented 1 year ago

This API call works: https://apiv4.olarm.co/api/v4/devices/8edcd590-a19b-42d3-b6b3-SNIPPED?accessToken=SNIPPED

This API call fails with 404 NotFound: https://apiv4.olarm.co/api/v4/devices/8edcd590-a19b-42d3-b6b3-SNIPPED/actions?accessToken=SNIPPED

I received the device_id by following the steps in the README, using the call: https://apiv4.olarm.co/api/v4/devices?accessToken=SNIPPED

rainepretorius commented 1 year ago

The device Id is in an invalid format. It should end with a number. That is not the full device id.Kind Regards,Raine Pretorius -------- Original message --------From: Jon @.> Date: 2023/03/22 15:35 (GMT+02:00) To: rainepretorius/olarm-ha-integration @.> Cc: Raine Pretorius @.>, State change @.> Subject: Re: [rainepretorius/olarm-ha-integration] NotFound http error when calling Olarm API device /actions endpoint (Issue #7) This API call works: https://apiv4.olarm.co/api/v4/devices/8edcd590-a19b-42d3-b6b3-?accessToken= This API call fails with 404 NotFound: https://apiv4.olarm.co/api/v4/devices/8edcd590-a19b-42d3-b6b3-/actions?accessToken= I received the device_id by following the steps in the README, using the call: https://apiv4.olarm.co/api/v4/devices?accessToken=

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you modified the open/close state.Message ID: @.***>

rainepretorius commented 1 year ago

I will also have a chat with them this week to see if it is maybe a unsupported feature for your device. Can you please let me know what Model of Olarm you are using and your alarm system Manufacturer.

NeilDuToit92 commented 1 year ago

It seems like the API only returns actions that happened in the last few days. So if you didn't arm or disarm the alarm in a few days, the endpoint returns a 404.