Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PulseLight #142

Closed
coxfrederic opened this issue Feb 2, 2019 · 2 comments
Closed

PulseLight #142

coxfrederic opened this issue Feb 2, 2019 · 2 comments

Comments

@coxfrederic
Copy link

coxfrederic commented Feb 2, 2019

Hi,

Please see #141 where I attempted (first attempt at this) to create a custom add-in which sends the same pulse value to KNX. I use it for a wire connected to my remote control which sends a 433Mhz code to my kitchen hood. I know it's a bit of a hack but the only thing that works.

I got it to work now via my PulseLight.js addin in the way that it is a light in Homekit that shows on/off correctly based on Homekit memory (since I can not read the actual status from the hood). When I switch the light the hood light is switched also so that is working as expected.

One issue I'm having now is when I include the light in the automation. When at 23:59 I like to turn the light OFF, the issue is that if the light is already OFF then the pulse seems to be send either way, turning the light back on again. Homekit (or homebridge?) does not seem to ignore the fact that the light is already out.

How can I cover this in the PulseLight.js ? I tried adjusting to:

onHKValueChange(field, oldValue, newValue) {
		log('INFO: onHKValueChange(' + field + ", "+ oldValue + ", "+ newValue + ")");
		if(field === "On" && oldValue !== newValue){
			this.myAPI.knxWrite(field, 1);
		}
	} // onHKValueChange

But that does not seem to work. I only want the automation to switch the light if the status is different than the current status. Because both the on and off signal off the light trigger the pulse to KNX effectively switching the hood light on and off.

Any help or pointers would be greatly appreciated!

@coxfrederic
Copy link
Author

I managed to find a way to get this working, see 19b3739

Don't know if this is "the way to go" but it works for me. Now when the scenario plays to set the light to the same state it is already in, no pulse will be sent so all works as expected.

@snowdd1
Copy link
Owner

snowdd1 commented Feb 11, 2019

You need to set some ( ) around the boolean operators. Like in ((a === b) && ( c !== d)) otherwise strange precedence happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants