Alert Function Does Not Work
Closed this issue · 2 comments
Thanks again for the great work on this!
Everything works for me except for the Alert function. It fails on both my cars. I get the following error whenever I try to run the alert command.
Command Sent:
2022-10-18 20:50:07 info: Command sent {"command":"alert"}
Error from command:
2022-10-18 20:50:07 error: Command error {"command":"alert","err":{"message":"Request Failed with status 400 - Bad Request","request":{"_closed":true,"_contentLength": 74,"_defaultKeepAlive":true,"_ended":true,"_events":{},"_eventsCount":7,"_hasBody":true,"_header":"POST..........................|snip| }
I changed the following code in commands.js from:
async alert({action = [Commands.CONSTANTS.ALERT_ACTION.FLASH],
delay = 0, duration = 1, override = []}) {
return this.onstar.alert({
action,
delay,
duration,
override
});
}
To:
async alert() {
return this.onstar.alert();
}
Which triggers both the lights and the horn which uses the defaults from onstarjs.
I added the following new commands:
async alertFlash({action = [Commands.CONSTANTS.ALERT_ACTION.FLASH]}) {
return this.onstar.alert({action});
}
Which triggers the lights only.
async alertHonk({action = [Commands.CONSTANTS.ALERT_ACTION.HONK]}) {
return this.onstar.alert({action});
}
Which triggers the horn only.
Submitted PR #258 with fix.