Govee instance events
Server/client Ready
govee.on("ready", (device) => {
console.log("Server and client are ready to go!");
});
New device found
Parameter | Type | Description |
---|---|---|
device | Govee.Device | The device that had it's state changed |
- Javascript
- Typescript
govee.on("deviceAdded", (device) => {
console.log("New Device!", device.model);
});
// Extra imports are needed
import Govee, { Device } from "govee-lan-control";
govee.on("deviceAdded", (device: Device) => {
console.log("New Device!", device.model);
});
Device removed
Parameter | Type | Description |
---|---|---|
device | Govee.Device | The device that had it's state changed |
- Javascript
- Typescript
govee.on("deviceRemoved", (device) => {
console.log("Device removed", device.model);
});
// Extra imports are needed
import Govee, { Device } from "govee-lan-control";
govee.on("deviceRemoved", (device: Device) => {
console.log("Device removed", device.model);
});
Device state updated
Parameter | Type | Description |
---|---|---|
device | Govee.Device | The device that had it's state changed |
data | Record<string, any> | Raw JSON data retrieved from the device |
stateChanged | Govee.stateChangedOptions | Array with the things that changed, can include "onOff", "brightness" and "color" |
- Javascript
- Typescript
govee.on("updatedStatus", (device, data, stateChanged) => {
console.log(device.model + " state updated.", stateChanged + " got changed");
});
// Extra imports are needed
import Govee, { Device, DataResponseSatus, stateChangedOptions } from "govee-lan-control";
govee.on("updatedStatus", (device: Device, data: DataResponseStatus, stateChanged: stateChangedOptions) => {
console.log(device.model + " got updated.", stateChanged + " got changed");
}
);