domoticz / domoticz-android

Domoticz Client Application for Android Devices
104 stars 69 forks source link

Update domoticz API calls #693

Closed kiddigital closed 8 months ago

kiddigital commented 1 year ago

Small (untested) PR that updates the API calls for domoticz to replace the deprecated RType calls (type=)

@galadril , I am not able to actually test these changes (unable to build this project) so please verify them.

Most changed call will still be supported in the next stable, but will generate a 'deprecated' status message.

(Only 'events' causes a problem as it uses the param parameter which had to change to evparam as 'param' is used by 'type=command')

waltervl commented 1 year ago

The problem is this will only work on a Domoticz beta environment. So then an App for Beta and an App for Stable should be introduced. Or a version check in the app so the App can use the old API for current stable 2023.1 and the modified API for beta 2023.1. It seems that only the events are not backwards compatible. Is there something to do for a fallback?

galadril commented 1 year ago

Thanks for the PR, ill take a look!

galadril commented 12 months ago

I started to try this against the latest beta of domoticz, but i still see lots of failures and 401 calls So it looks like the current authorization implementatie is not working on the beta as well anymore??

EDIT: i think i found out why, as /logincheck is not working anymore on the latest beta.

kiddigital commented 12 months ago

The '/logincheck'page is replaced by a proper API command. Use '/json.htm?type=command&param=logincheck'

galadril commented 12 months ago

ok and that one is not backwards compatible right? so thats quite breaking for the app. i was wondering why i get all those 1-star ratings about app not working lately

kiddigital commented 12 months ago

Always 'annoying' if people use a certain version of a tool connecting to some beta version of something else and expect things to always work...

Maybe add a warning to users if connecting to a version higher than a certain supported/tested version? At least users are aware that issues can occur.

Btw.. maybe a good idea to switch from 'logincheck' to using the OAuth service? At minimum the 'password' grant (which does not have a refresh token) but better would be the 'authorization_code' grant and leverage the refresh_token.

galadril commented 8 months ago

i've copied your class in a v2 namespace on the beta-dev branch. thanks it should now detect in the upcoming android beta if it should get the new api urls or the old.