sectoralarm icon indicating copy to clipboard operation
sectoralarm copied to clipboard

Invalid code

Open burner- opened this issue 4 years ago • 4 comments

I try arm and disarm commands for .fi api. But I got always invalid code error with following callstack. SectorAlarmError: Invalid code, could not act upon alarm of the site at /root/.node-red/node_modules/sectoralarm/lib/parser.js:196:28 at tryCallTwo (/root/.node-red/node_modules/promise/lib/core.js:45:5) at doResolve (/root/.node-red/node_modules/promise/lib/core.js:200:13) at new Promise (/root/.node-red/node_modules/promise/lib/core.js:66:3) at Parser.transformActionToOutput (/root/.node-red/node_modules/sectoralarm/lib/parser.js:174:16) at /root/.node-red/node_modules/sectoralarm/lib/site.js:130:36 at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:93:5)

Code is filled (4num pin). I also clear and re set it to be sure that there is no white characters in it. I double check that same pin will work with mobile app with same user. And api user work fine because I can request armed state. Odd thing is also that I enable quick arm from app and even then I get invalid code error when I try arm alarm. Also that error comes quite fast so most probably it come from local parser, not from super slow sector alarm api.

burner- avatar Dec 17 '21 13:12 burner-

Hi. I know there has been some changes regarding this. I will have a look at it soon.

perbrage avatar Jan 24 '22 10:01 perbrage

I have verified that the arming and disarming works as is should. The error you are experiencing is nothing I have been able to reproduce. However, there has of late been problems with communicating with Sector Alarm, hence all operations now have a retry built in if Sector Alarm in error sends an 401 Unauthorised response.

Please try the latest package 2.1.2 and see if your problem is still there.

perbrage avatar Feb 11 '22 09:02 perbrage

ok now I managed to update that version to git version. Looks that npm repository distribute ancient version by default. Anyway I got same error

object code: "ERR_INVALID_CODE" message: "Invalid code, could not act upon alarm of the site" stack: string SectorAlarmError: Invalid code, could not act upon alarm of the site at /data/node_modules/sectoralarm/lib/parser.js:196:28 at tryCallTwo (/data/node_modules/promise/lib/core.js:45:5) at doResolve (/data/node_modules/promise/lib/core.js:200:13) at new Promise (/data/node_modules/promise/lib/core.js:66:3) at Parser.transformActionToOutput (/data/node_modules/sectoralarm/lib/parser.js:174:16) at /data/node_modules/sectoralarm/lib/site.js:148:42 at processTicksAndRejections (internal/process/task_queues.js:95:5)

I look from chrome: https://mypagesapi.sectoralarm.net/api/Panel/Disarm post: {PanelCode: "XXXX", PanelId: "XXXXXXX"}

And then I use httplogger at node-red

host: "mypagesapi.sectoralarm.net" body: "{"ArmCmd":"DisarmAnnex","PanelCode":"xxxxx","HasLocks":false,"id":"xxxxxx"}"

So looks that it calls that api quite different way than official webUI.

burner- avatar Feb 14 '22 20:02 burner-

Ok I finally resolve this. So 2 problems. a) npm repository have ancient version. b) There is arm and annexArm. I used wrong arm. Anyway I strongly recommend to update those packets.

burner- avatar Feb 14 '22 21:02 burner-