Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid code #28

Open
burner- opened this issue Dec 17, 2021 · 4 comments
Open

Invalid code #28

burner- opened this issue Dec 17, 2021 · 4 comments

Comments

@burner-
Copy link

burner- commented Dec 17, 2021

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.

@perbrage
Copy link
Owner

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

@perbrage
Copy link
Owner

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.

@burner-
Copy link
Author

burner- commented Feb 14, 2022

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-
Copy link
Author

burner- commented Feb 14, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants