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

HTTP set power function failed: socket hang up #87

Open
mtabo opened this issue May 24, 2018 · 1 comment
Open

HTTP set power function failed: socket hang up #87

mtabo opened this issue May 24, 2018 · 1 comment

Comments

@mtabo
Copy link

mtabo commented May 24, 2018

I cant make work correctly yet
Initially it reads the state of the switch, but when activating it, HomeBridge gives this error:

"HTTP set power function failed: socket hang up"

And then Home App shows me a warning of no response
Does anyone have any idea what may be happening?

@SenMorgan
Copy link

When homebridge-http is sending the reqest to switch on or off something, you must not only get that reqest, but you must answer on it with 200 code. Here is the part of my code, that helped me to solve this problem:

server.on("/ON", light_on);

void light_on(){ server.send(200, "text/plain"); digitalWrite(green_led, 1); Serial.println("LED ON"); }
In the server.send(200, "text/plain"); I'm not sending nothing exept code 200.

Answering on status request:
if(digitalRead(green_led)) server.send(200, "text/plain", "1"); else server.send(200, "text/plain", "0");

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