Creating custom node using nodejs repo (Govee)

Hi,

Been playing with Node-Red for a couple of months, working great so far.

I would like to use [node-govee-led - npm (npmjs.com)]

node-govee-led - npm in Node-Red, not sure How to do this any advice.

Try to manually install, but nothing is visible in Node-RED.

thanks

As it is not a node-red node (just an NPM package) you wont see anything in node-red pallete.

If you are using node-red V2+ you can add it as an import on a function node...

then use the code as described in the readme.

image

Thanks for the info, I have implemented all the steps, as described, so far, it is returning a payload of Object Promise, led is not turning on or off. Not sure how to debug. Will do some more testing.

It wasnt clear from the readme that getState returned a promise.

Instead try...

var Client = new Govee({
	apiKey: "<govee api key>",
	mac: "<MAC address>",
	model: "<device model>"
});


Client.getState()
  .then(state => {
    msg.payload = state;
    node.send(msg);
  })
  .catch(err => node.error(err, msg));

Ok, a bit better, getting

function : (error)
"Error: Request failed with status code 400"

400 Bad Request

The HyperText Transfer Protocol (HTTP) 400 Bad Request response status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error (for example, malformed request syntax, invalid request message framing, or deceptive request routing).

Are your details correct?

My guess is you have something wrong.

what does this return...?

const Client = new Govee({
	apiKey: "<govee api key>",
	mac: "",
	model: ""
})


Client.getDevices()
  .then(data => {
    msg.payload = data;
    node.send(msg);
  })
  .catch(err => node.error(err, msg))

WOW, it is working, the mac address was wrong, I guess there is more than one mac address, in the app it is not showing up the same one. with your command getdevices, I was able to validate the mac.

thanks a lot.

Mario

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.