perbrage / sectoralarm

Sector Alarm Node.js Library
MIT License
23 stars 8 forks source link

INVALID_VERSION #11

Closed jketels closed 2 years ago

jketels commented 5 years ago

I'm using the library indirectly via the frli4797/homebridge-sector plugin for homebridge and I'm getting the message Cannot create property 'lastInteractionBy' on string 'INVALID_VERSION'. I've been trying to figure out what the problem is. Looks like minasidor.sectoralarm.se is using a version number 1_1_68, but just changing the version number in the rest call (using Fiddler) doesn't help.

jketels commented 5 years ago

This call is working. I might have missed some header or something before.

Host: mypagesapi.sectoralarm.net
Connection: keep-alive
Content-Length: 36
Accept: application/json, text/plain, */*
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36
Sec-Fetch-Mode: cors
Content-Type: application/json;charset=UTF-8
Origin: https://mypagesapi.sectoralarm.net
Sec-Fetch-Site: same-origin
Referer: https://mypagesapi.sectoralarm.net/
Accept-Encoding: gzip, deflate, br
Accept-Language: sv-SE,sv;q=0.9,en-US;q=0.8,en;q=0.7
Cookie: ...

{id: "xxxx", Version: "v1_1_68"}
perbrage commented 5 years ago

Hi,

These version bumps seem quite ridiculous from sector alarms developers, especially as they are not keeping the old version alive. I am thinking if this should turn into a configuration, so users and developers can specify the version themselves. Or, if there is anyway to auto-detect this at runtime. At this rate of version changes, the library will break-apart often and it is too much of a hassle for such a small change every time, especially considering the node-red and other usages.

I will investigate this in the near future.

perbrage commented 5 years ago

Already found a way to auto-detect the version.

perbrage commented 5 years ago

If you try the latest version published a few days ago, there is now an auto-detect of the version that will be used for the remainder of the applications lifespan, or until you login again on a site object. A exception with a new error code will be thrown when this happens. Hopefully, there shouldn't need to be additional development needed when sector alarm bumps their API version without real changes to it.