Comments (7)
I have also been running into this issue. My code is as follows:
var hue = require('node-hue-api'),
HueApi = hue.HueApi,
lightState = hue.lightState,
elasticsearch = require('elasticsearch'),
client = new elasticsearch.Client({ host: '[host here]' }),
hostname = '[ip address here]',
username = 'zenahirsch',
api = new HueApi(hostname, username),
state = lightState.create();
var displayResult = function(result) {
console.log(JSON.stringify(result, null, 2));
};
api.setLightState(1, state.off(), function(err, lights) {
if (err) {
console.log(err);
}
displayResult(lights);
});
I get the following result:
{ [Api Error: body contains invalid json]
message: 'body contains invalid json',
type: 2,
address: '/lights/1/state' }
from node-hue-api.
Can you check the version of request that is inside the request-util dependency of the hue-api?
I released an updated version of this support library to support the upcoming version 1.0.0 of the hue-api, and may have broken this. The new version of request changed the way the json property is interpreted and I suspect this may be your issue.
If confirmed, I can fix that quickly with a new patch release.
from node-hue-api.
package.json within request shows "version": "2.51.0"
from node-hue-api.
Ok, I should be able to fix that quickly...
from node-hue-api.
I have just released version 0.0.3 of request-util that should resolve this issue.
Run npm update
on your project and it should pull this new version down which corrects the JSON issues.
Let me know if it works, and I can close out this issue.
from node-hue-api.
Yes, it worked! Thank you so much!
from node-hue-api.
I am very sorry for that, I should have properly followed my semver version numbers and incremented it as a patch...
from node-hue-api.
Related Issues (20)
- Error: Problems resolving hue bridges, unable to get local issuer certificate HOT 8
- How turn multiple lights on/of simultaneously? HOT 2
- Request: Honor "timeout" in initial connect() request (and API calls in general?) HOT 4
- Entertainment classes change HOT 1
- getUser and getUserByName do not seem to work at all HOT 1
- Error when using Webpack / Electron HOT 1
- Example typo
- Touchlink activation HOT 1
- Cant get this to work with React.JS HOT 2
- Export as esm module HOT 20
- mDNS Discovery HOT 4
- ApiError: Problems resolving hue bridges, HTTP error status: 429 HOT 15
- Cannot import createLocal using TypeScript HOT 3
- Example doesn't work HOT 2
- api.sensors.updateSensorConfig not working due to un-settable params included in request HOT 3
- Failed to create sensor from bridge model: Error: Unknown type 'zllrelativerotary' to create Bridge Model Object HOT 3
- MDNS Discovery not working (Empty Array) HOT 12
- Implement RGB support for groups HOT 1
- Hue API V2
- ApiError: Problems resolving hue bridges, HTTP error status: 429 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-hue-api.