HTTP HTML Plain Text Responce for Temp or Door Open/Closed

I have several Arduinos scattered around my apartment to do various things. They each have a webserver where I can navigate to “” to turn on my lights or “” to turn off my lights. That’s easy to make work with openHAB.

I also have some status webpages which are plain text, no HTML headers, 1.1 200 OK, nothing. If I navigate to “” then I see the temperature from my DHT22 in plaintext. If I navigate to “” I see “open” or “closed” in plaintext. If I navigate to “” I can see if my light is on or off.

The problem comes with getting that info into openHAB. The HTTP Binding always returns “error invalid response received” when I try and get data from those URLs. I can even see my data in the log if I configure the Arduino a certain way. It will say something like “72.30 is not a valid HTTP identifier”. Of course not, that is my temperature.

Can I bypass all that HTTP header and response crap and just receive the strings in to openHAB? My web browser can do it.

I could implement MQTT, but that means redoing my Arduinos, several of which are low on memory and I have to use HTTP for my amazon echo’s bridge to work. Adding a whole another library, bad news.

The HTTP binding is capable but it isn’t a web browser. It pretty much only supports straight and standard HTTP which has a well defined format that requires all that HTTP header and response “crap”. So short of adding in MQTT or some other alternative protocol approach, you might check to see how curl handles it and if it can pull down the value switch to the Exec binding with calls to curl.

Sweet. Thank you.

I played around with it this afternoon and got it to work. For those with similar issues you can send just the the 200 OK repsonce and a blank line then whatever you want to send.

Like this on the Arduino.
client.println(HTTP/1.1 200 OK);
client.println(WATEVER VARIABLE)

Does anyone know how I might send HTTP info from the Arduino to openHab? It would be far better to have the Arduino send “open” or “closed” to openHab rather than polling the Arduino from openHAB every second.

You csn use the REST Api