I'm very new to developing and have been working with javascript for 2 weeks now as my first programming language, so I appreciate all help and would ask that any advice given is taking into consideration that I'm an idiot and it will likely need to be explained to be like I'm five. Most of what I've got right now is taken from the tutorial examples for smart home skills or with a lot of googling but I'm afraid my task is over my head. I'm trying to create a lamp in my office that reacts to my Zoom presence status (sending the webhook from zoom is the easy part and the part i'll do next. Right now for my current task I manually set a package.json in the format of a Zoom status webhook event and change the status to test the different scenarios. I have what I likely believe is a pretty ugly lambda function here that will eventually use the colorcontroller to change the color but for my first stage, I'm trying to say if the status returns as available then turn the light on (baby steps).
Here is my github for review:
My first question here is how do I set a global variable for my meeting light so I can say if status = available then find the device on the account named "Meeting Light" then send the power on directive.
the discovery response reads like this:
var payload = {
"endpoints":
[
{
"endpointID": "string",
"manufacturerName": "string",
"friendlyName": "MeetingLight",
}
}
so i tried to say
var meetinglight = (payload.endpoints.friendlyName)
but that didn't seem to work because the endpoint is an array and then there is a code block within the array. If i was just ending on endpoints then it would work, at least the aws code editor seemed to pick it up. If anyone knows what i'm doing wrong or sees one of my likely numerous blatant errors i would be greatly appreciative.