Closed bwired-nl closed 8 years ago
@NovaGL any advice hear?
You need to give us more information like make and model. Currently brightness is only a number not a percentage as far as I know. Is it a GET or a POST for brightness. I think homebridge Yamaha converts theirs into percentage.
the device is a chromoflex ledstrip controller it is working :-), at least how to receive it this is in the json: "brightness_url": "http://10.0.0.47:3031/ledbright?tagid=%b",
and this I use in my nodejs (express) webserver at 10.0.0.47 this:
app.get('/ledbright', function(req, res) {
console.log("tagId is set to " + req.param('tagid'));
tools.mqttClient.publish('command/cflex', '{"address":"1B", "command": ' + req.param('tagid') + '}');
res.send(req.param('tagid'));
});
i can tell Siri now to set the Leds at 60% I need to check the status still, also want the current setting (percentage) of the ledstrip send need to figure this out, any tips?
Thanks
Can you node express output a value using a GET command or a POST command? And what value does it output.
not sure what you mean :-) i can send a value back to the homebridhe with res.send, see the above example.
what i want to have now is a status, so the first time i open the device (for example in insteon+) I want the status of the ledstrip see the above which is "status_url": "http://10.0.0.47:3031/ledsstatus", i can check the status in my webserver progje and send the status back with res.send but it does not seem to react, need to do something in the index server with the status_url Hope you understand me many thanks!
What does the URL return in a browser? Is it json? Xml? Or just a simple value between 0 and 100?
a simple value, for example 78
status_url is only for on or off or 0 or 1.
You have the use "brightnesslvl_url" if you want a value such as 78 to work.
Otherwise check your homebridge logs and look for the words "Led verlichting"
OK clear but how is this fired from for example the insteon+ app if i use brightness_url in the config.json I see a bar being created in the insteon+ app where i can set the brighness from 0 to 100. this brightness value i can send to my webserver. But how do i send the brightnesslvl_url to my webserver and make the Bar in Insteon shift to that value. So insteon needs to pick up the initial value.
The plugin polls the address of "brightnesslvl_url" and if the body value changes, it changes the value on the slider.
"brightness_body" is only needed if "http_brightness_method" is set to POST
I had a slightly different index.js , updated and working perfectly now also with the slider :-) even if the device is controlled by other program, this is updated. again great plugin!
So you've got it to work with the standard plugin or have you had to modify it to get it to work?
No modifications, working perfect, just a matter of the putting everything right in the config.json. i was able the have the nodejs webserver send the right values back so you can close this.....
Awesome - thanks for letting us know you got it to work okay. Thanks @NovaGL for your help too! Happy new year!
Glad you got it working, maybe you had the version before my enhancements.
Hi great plugin!!
Question, i try to control my leds, on and off is working but im not sure how to get the value on my http server
i use node express to get the url, But how to i get the percentage of the brightness? hope you can give a hint? also how to shoot back the current value
app.get('/ledbright', function (req, res) { console.log('leds led-brstat') console.log('inspect : ' + util.inspect(res)); //res.send('0'); });
this is the json "accessory" : "Http", "name" : "Led verlichting", "switchHandling": "yes", "http_method": "GET", "on_url" : "http://10.0.0.47:3031/ledsaan", "off_url" : "http://10.0.0.47:3031/ledsuit", "status_url": "http://10.0.0.47:3031/ledsstatus", "brightness_url": "http://10.0.0.47:3031/ledbright/%b", "brightness_body": "{\"state\":\"%b\"}", "brightnessHandling": "yes", "brightnesslvl_url": "http://10.0.0.47:3031/led-brstat", "sendimmediately": "", "username" : "", "password" : "",
"service": "Light"