Closed moeff closed 2 years ago
Correct, the implementation is only a simple switch. It is only possible to turn on (full light) or off the light.
I still plan to extend this implementation to allow color selection as well. I haven't gotten around to it yet though, as this is a more complex implementation and also the Homekit options for devices are limited (https://stefans-itblog.de/liste-aller-homekit-characteristics/). Probably it will come down to that it then work like the Hue lights.
Thanks for answering, i "only" need data values for manual mode and the colors from the helialux in iobroker datapoints.
Someone does already build a python libary for controling the helialux:
https://github.com/moretea/pyHelialux
and i also want to create a iobroker adapter on my own:
https://forum.iobroker.net/topic/44322/adapteranfrage-helialux-smart-control
thanks.
For query the current light status, there are two possibilities:
lang=0;lamp='4Ch';profNum=4;profile='Dunkler';tsimtime=817;tsimact=0;csimact=1;brightness=[100,100,100,100];times=[0,900,930,1275,1290,1320,1439];CH1=[0,0,100,100,30,0,0];CH2=[0,0,90,90,15,0,0];CH3=[0,0,100,100,15,0,0];CH4=[0,0,100,100,40,0,0];
. The variable brightness=[100,100,100,100]
tells the current light colors in White, Red, Yellow and Blue.action=10
then an JSON object return. The array ch
also represents the colors in White, Red, Yellow and Blue. As an example:
{
"A":{
"action":"10"
},
"C":{
"no":4,
"ch":[
0,
0,
0,
0
]
}
}
For changing the colors in my plugin I use this code (turn light on - all colors / white to 100%):
private readonly turnLightOnChannels = '&ch1=100&ch2=100&ch3=100&ch4=100';
private turnOnLight(callback: CharacteristicSetCallback): void {
const url = 'http://' + this.host + ':' + this.port + '/color';
const requestData = 'action=1' + this.turnLightOnChannels;
this.logRequest('turnOnLight', requestData, url);
axios.default.post(url, requestData, {
timeout: this.timeout,
headers: HLSmartControlSwitch.getRequestHeaders(),
})
.then((response) => {
// handle success
const responseData = response.data;
const responseStatus = response.status;
this.logResponse('turnOnLight', responseData, responseStatus);
// Update state and inform Homebridge
this.switchOn = true;
this.log.info('Switch light state was set to: ' + (this.switchOn ? 'ON' : 'OFF'));
callback();
})
.catch((error) => {
// handle error
this.log.error('Error during turn on lights: ' + error);
});
}
The ch1-4 is White, Red, Yellow to Blue with brightness levels from 0 (off) to 100 (full).
Here also two examples for building a Homebridge plug for color lights
For query the current light status, there are two possibilities:
- Option 1: Get http://hlsmartcontrol/statusvars.js returns a string with the current status, as an example:
lang=0;lamp='4Ch';profNum=4;profile='Dunkler';tsimtime=817;tsimact=0;csimact=1;brightness=[100,100,100,100];times=[0,900,930,1275,1290,1320,1439];CH1=[0,0,100,100,30,0,0];CH2=[0,0,90,90,15,0,0];CH3=[0,0,100,100,15,0,0];CH4=[0,0,100,100,40,0,0];
. The variablebrightness=[100,100,100,100]
tells the current light colors in White, Red, Yellow and Blue.- Option 2: Make a post to http://hlsmartcontrol/color with
action=10
then an JSON object return. The arraych
also represents the colors in White, Red, Yellow and Blue. As an example:{ "A":{ "action":"10" }, "C":{ "no":4, "ch":[ 0, 0, 0, 0 ] } }
For changing the colors in my plugin I use this code (turn light on - all colors / white to 100%):
private readonly turnLightOnChannels = '&ch1=100&ch2=100&ch3=100&ch4=100'; private turnOnLight(callback: CharacteristicSetCallback): void { const url = 'http://' + this.host + ':' + this.port + '/color'; const requestData = 'action=1' + this.turnLightOnChannels; this.logRequest('turnOnLight', requestData, url); axios.default.post(url, requestData, { timeout: this.timeout, headers: HLSmartControlSwitch.getRequestHeaders(), }) .then((response) => { // handle success const responseData = response.data; const responseStatus = response.status; this.logResponse('turnOnLight', responseData, responseStatus); // Update state and inform Homebridge this.switchOn = true; this.log.info('Switch light state was set to: ' + (this.switchOn ? 'ON' : 'OFF')); callback(); }) .catch((error) => { // handle error this.log.error('Error during turn on lights: ' + error); }); }
The ch1-4 is White, Red, Yellow to Blue with brightness levels from 0 (off) to 100 (full).
Here also two examples for building a Homebridge plug for color lights
Great work, thanks for the plugin! Look forward to receiving my SmartControl, and it would be nice to add support for colour change in HomeKit 👍
Any update on the support for colour/brightness change? Thanks in advance!
Sorry, currently no update for the color changing - my first try with a color picker in HomeKit failed. When things settle down again in my professional projects, I'll make the next attempt.
Sorry, currently no update for the color changing - my first try with a color picker in HomeKit failed. When things settle down again in my professional projects, I'll make the next attempt.
Hi sure thanks a lot for the great work! I also would like to report a bug that affect automations: when the automation sets the light on/off, it will always perform the action depending on the state of the light. For example if the automation turn on the light when the light is already on, it will turn off the light. It would perhaps be better that: 1) when setting on, if the light is already on set the brightness to 100% instead of turning off 2) when setting off, if the light is already off, do nothing
In release 1.2.0 this feature is implemented. The color can be changed via the Home app. In this setting the white LEDs are not used. Could possibly still contain minor bugs, since the change of color is asynchronous and therefore overlaps can happen.
The idea for the implementation comes from https://github.com/QuickSander/homebridge-http-rgb-push
Thanks a lot! Just did some quick test so far it works smoothly, thanks for the great effort. Would it be possible to add a switch to turn all lights (include white) on? It's just for quick water change maintenance nice to have all lights on.
It should work if you add the plugin twice. Once with color=true and once with color=false. In the (Apple) UI you can not add this.
Actually, when you click on the lamp (without color settings), the old behavior should run (everything at 100% or everything at 0%). But that depends a bit on whether Homekit still sends the color change or not. (This could still be such minor bug).
thx for the update, will test this next week
It should work if you add the plugin twice. Once with color=true and once with color=false. In the (Apple) UI you can not add this.
It sort of works, but the state of the two accessories are not in sync which is probably to be expected.
Actually, when you click on the lamp (without color settings), the old behavior should run (everything at 100% or everything at 0%). But that depends a bit on whether Homekit still sends the color change or not. (This could still be such minor bug).
That's good to know. Would be very much like if you set brightness to 100% then it uses white to get 100%. Or maybe >80% then start to engage white. The RGB is beautiful however for water change it's a bit too dark :-)
Would like to report one small issue: when I turn on the light from homekit, and then go to Jewel's webpage, it resets colour to 0,0,0 (basically turn off the lights).
Would like to report one small issue: when I turn on the light from homekit, and then go to Jewel's webpage, it resets colour to 0,0,0 (basically turn off the lights).
I have noticed the behavior as well. Even if you have the web page of the SmartControl open, then change something via HomeKit, the rules go to 0 at the click of the page.
I had already asked Juwel here for a proper interface description, unfortunately they have not yet reported back.
The setting of the colors / values I had derived from the request of the web page. I have here however rather the assumption, that the web page makes still here something special in the JavaScript, which I do not have in my service call yet in it.
Hi,
did i something wrogn. I only can turn the lights on / off . Its not possible to adjust single colors, active profiles etc?
greetings