Log temperature via REST request

Functionality and usage of the OpenNethome Server
Post Reply
Posts: 13
Joined: Mon Dec 15, 2014 8:14 pm

Log temperature via REST request

Post by tobbe » Wed Sep 12, 2018 6:24 pm


i was wondering if it would be possible to log temperatures via a REST request?
I have several wireless sensors that log to a MySQL database and would like to see those sensors in Opennethome as well.
My idea would be to run a cron script on the Opennethome server, that requests that last value from the database and then do a wget request to Opennethome, something like http://localhost:8020/rest/items/100/update/22.25 (100 = item number, 22.25 = temperature)

Or if REST is not an option, is there some other way to do this?


Site Admin
Posts: 306
Joined: Sun Nov 30, 2014 2:16 pm

Re: Log temperature via REST request

Post by stefangsbb » Mon Sep 17, 2018 6:46 pm

Hi Tobbe!

There is a HomeItem designed specifically for this case. It is called GenericThermometer http://wiki.nethome.nu/doku.php/genericthermometer. This Item is updated by sending a specific event to it and it will present the latest value sent along with some update time information.

Events can currently not be sent via the REST interface (maybe this should be added?), but you can send them via the TCPCommandPort-Item. There are examples in the GenericThermometer documentation page (link above), but basically you can send it via this kind of script:

Code: Select all

echo 'event,Temperature_Message,Address,1,Value,230' | nc -u -w 0 8005
Hope this helps!


Post Reply