node-hue-api
node-hue-api copied to clipboard
ApiError: Problems resolving hue bridges, HTTP error status: 429
When I use the example code shown in the documentations I get this error message:
ApiError: Problems resolving hue bridges, HTTP error status: 429
This is the example code:
const v3 = require('node-hue-api').v3;
const LightState = v3.lightStates.LightState;
const USERNAME = User
// The name of the light we wish to retrieve by name
, LIGHT_ID = 2
;
v3.discovery.nupnpSearch()
.then(searchResults => {
const host = searchResults[0].ipaddress;
return v3.api.createLocal(host).connect(USERNAME);
})
.then(api => {
// Using a LightState object to build the desired state
const state = new LightState()
.on()
.ct(200)
.brightness(100)
;
return api.lights.setLightState(LIGHT_ID, state);
})
.then(result => {
console.log(`Light state change was successful? ${result}`);
})
;
This code worked fine for 5 minutes and then it just stopped working...
It is on Hue, they restrict the number of calls coming from an IP address to the cloud endpoint and expect you to cache the results, or use local mDNS discovery.