Turn on light using JS web and API

Hi there, having difficulty turning on the farmbot lightstrip using the JavaScript API. The light is on pin number 7.

currently im using the following but it dosent work

function toggleLight() {
  var farmbot123 = new fbjs.Farmbot({ token: TOKEN });

  farmbot123
  .connect()
  .then(function () {
    return farmbot123.togglePin({7});
  });
}

I can take photos and move the farmbot, so my connection and API are fine

1 Like

Fix:

return farmbot123.togglePin({ pin_number: 7 });

Thanks to @RickCarlino

3 Likes