How to get temperature from thermometer to web page?

Functionality and usage of the OpenNethome Server
Post Reply
Don MC
Posts: 31
Joined: Mon Nov 16, 2015 7:40 am

How to get temperature from thermometer to web page?

Post by Don MC »

I'm trying to make my set-top box display temperature on the TV screen. It's just a matter of telling the box to get a value from NetHome and then displaying it. But I don't know how to get it from NetHome. I can type this into my web browser:
http://rasp.berry.ip.address:8020/rest/items/64
and get all sorts of info from that particular thermometer. But I only need the temperature value ("21.5" or whatever it is at the moment).

What do I need to type to get that?
stefangsbb
Site Admin
Posts: 313
Joined: Sun Nov 30, 2014 2:16 pm

Re: How to get temperature from thermometer to web page?

Post by stefangsbb »

If you create a "TCPCommandPort" with for example port 8007, then you can connect with TCP to that port and send the command:

Code: Select all

get,64,Temperature
then you will get the reply like:

Code: Select all

ok,Temperature,-18%2C0
You will have to parse out the temperature and replace %2C with , but it may still be simpler to do that than to parse the json. I am guessing that the client asking for the value uses some kind of programming language where you can do some processing of the value?
Don MC
Posts: 31
Joined: Mon Nov 16, 2015 7:40 am

Re: How to get temperature from thermometer to web page?

Post by Don MC »

Thanks.
I'm not sure quite yet how the client works. It's all greek to me. It's an Enigma2 box, with Python on top of a Linux core. The GUI is configured by XML files. An example for displaying the time on the info bar would be:

Code: Select all

<widget source="global.CurrentTime" render="Label" position="825,52" zPosition="1" size="59,20" font="Regular;21" foregroundColor="infobar-frgrnd" backgroundColor="infobar-bkgrnd" transparent="1" noWrap="1" halign="right" valign="top">
<convert type="ClockToText">Format:%H:%M</convert>
</widget>
Maybe that's a bad example. I suppose it can be made to display any text from any source and not necessarily "global.CurrentTime".
I already have NetHome send a message to the box when my sauna is ready (goes above 80°C). This is done by a http request to the box's web interface. It's a built-in feature of Enigma2. The message pops up on the TV screen and disappears after a pre-set timeout, or by clicking OK on the remote.
It would be nice to have the current temperature show on the infobar as well.
lassiko
Posts: 25
Joined: Tue Dec 30, 2014 11:57 am

Re: How to get temperature from thermometer to web page?

Post by lassiko »

Don MC wrote: It would be nice to have the current temperature show on the infobar as well.
Did you get this working. I am also using enigma2 box and will get a temperature info from sauna but would be nice to see it all the time in infobar.

Thanks
Don MC
Posts: 31
Joined: Mon Nov 16, 2015 7:40 am

Re: How to get temperature from thermometer to web page?

Post by Don MC »

Sadly not yet. I've been busy lately and learning how to do this doesn't fit my schedule.
Seems though that the infobar skin doesn't directly support fetching any kind of text from another source. If there would be some kind of weather plugin that sits on the infobar and that we could modify to fetch temperarure data from NH.
Post Reply