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

Error setting targetHeatingCoolingState: socket hang up #16

Closed
Kompass02 opened this issue Mar 5, 2021 · 1 comment
Closed

Error setting targetHeatingCoolingState: socket hang up #16

Kompass02 opened this issue Mar 5, 2021 · 1 comment

Comments

@Kompass02
Copy link

Kompass02 commented Mar 5, 2021

Hi, I'm getting this error in the homebridge log file:

Error setting targetHeatingCoolingState: socket hang up

But my ESP8266 successfully sets the HeatingCoolingState.

Here is my current ESP8266 request handler:

server.on("/targetHeatingCoolingState", handle_targetHeatingCoolingState);

void handle_targetHeatingCoolingState () {
  String value = server.arg("value");
  tarState = value.toInt();

  Serial.print("\n tarState: ");
  Serial.println(tarState);
}

Thanks in advance!

@phenotypic
Copy link
Owner

phenotypic commented Mar 7, 2021

Hi there, I believe you are having this issue because you are not returning an HTTP 200 OK status response back after receiving a request .

See line 157 of this script to see how to properly handle requests.

You might want to change your code to something like this:

server.on("/targetHeatingCoolingState", handle_targetHeatingCoolingState);

void handle_targetHeatingCoolingState () {
  tarState = server.arg("value").toInt();
  server.send(200);
  Serial.print("\n tarState: " + String(tarState));
}

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