Send SensorValues over Network to OpenHAB Server

Hi,

maybe it is a silly question, but i couldnt find anything for it. Is it possible to submit sensor values from a network device to the openhab2 server?

I have an Arduino with ESP8266 here and want to send some temperature values to the openHAB-Server.

My best idea was to create a webinterface, where i submit my data and get them via exec-binding. Is there a better or easier way to get the temperature value to openHAB?

Alternatives: MQTT and/or HTTP

Edit: some examples:

Reset ESP8266 via http (ESPEasy firmware):

Switch RebootESP8266_3 "Reboot" { http=">[ON:POST:http://192.168.X.XXX/?cmd=reboot]" }

Read temperature via MQTT:

Number Temperature "Temperatur [%.1f °C]" { mqtt="<[mosquitto:/esp8266four/temperature/shadow:state:default]" }

1 Like

Check out mysensors.org as well

1 Like

If you search the forums for ESP8266 you’ll find a number of people who have worked through the situation in a few different ways.

The joy of OH is it’s ability to work well with many different methods. Find one you like and run with it!

1 Like

Thanks for all the Replys. I think i am going to write my own little PHP-Script, because i have a Web-Server with mySQL running and send my Sensor-Values to the PHP-Script.

OpenHAB just needs to pick the values then from the Server via Exec-Binding or HTTP-Binding.

I would second MQTT and ESPEasy. Made to do exactly what you want to do. No need to reinvent the wheel.

MySensors is also a good option for battery powered sensors.

1 Like

Thats my Solution i made today so far:

Not perfect but simple.

Submit SensorData:
index.php?controller=submit&sid=abc&var=123 //Submit SensorValue 123 under the SensorID abc

Get SensorData:
index.php?controller=get&sid=abc //Get Sensor Values from SensorID abc

Example Output:

<sid>ds118</sid> <var>22.33</var> <updated>1488312335</updated>

This can be filtered with regex to get the right value.

The table gets created automatically on the mySQL server if it not exist. Sensor-Values will be added or updated if the sid already exists.