This page last changed on Apr 09, 2015 by rich.sperrin.

I found a way of adding data and time to your openremote interface using jsontest.com - might come in useful.

jsontest.com offers a number of endpoints that return json data - i was particularly interested in date & time.

Its easy to do:-

1. create a HTTP command; Name:GetTime, Protocol:HTTP, URL:http://time.jsontest.com, Method:HTTP, Interval:1s, Expression:$.time
2. create a sensor; Name:GetTime Sensor, Command:GetTime, Type:custom
3. add a label and set the Sensor to GetTime Sensor.

As you can imagine the date is very similar - just use a less frequent interval - I settled for 1m so it flips over reasonably close to midnight.

Heres a pic of finished front screen complete with date and time:-

Yea you spotted it, timezone and date format - fortunately timezone is GMT lucky for me in UK - date format is a little ropey though! - perhaps someone can recommend a more suitable source. I was wondering how I would go about doing this with my raspberry pi2 server.

Theres another feature on jsontest called echo. By constructing the URL and sending to jsontest you can achieve this:-

URL: http://echo.jsontest.com/time/21:21/date/08-04-2015
RESULT:
{
"time": "21:21",
"date": "08-04-2015"
}

Again could be useful but if its constructing the values in the first place why not use those instead of pinging it around the net.


What is wrong with OpenRemote's built-in Date/time function?

Posted by pz1 at Apr 09, 2015 08:26

Glad you bought that up

This is where I first looked but as far as I can tell it doesnt do time - only date and isDay and sunset etc.

Hopefully I missed something? I tried time format IE hh:mm but its not documented and didnt want to know.

cheers

Posted by rich.sperrin at Apr 09, 2015 18:01

You can select (format) with:

dd.MM.yyyy HH:mm:ss

Just use the elements you need. There is a reference to formats in the HowTo

Posted by pz1 at Apr 09, 2015 18:14

That seems to working - I would guess the refresh interval is not configurable? I ask because I included seconds in the format but doesnt change. Seconds are not essential though!

Is there a format for British Summer Time?

Posted by rich.sperrin at Apr 10, 2015 18:11

IIRC some "devices" are update every 500 ms. Not sure if that applies to this protocol.

Is there a format for British Summer Time

That should be determined by the time zone setting in the command I assume.

Posted by pz1 at Apr 10, 2015 18:26

Thats what I figured as well - tried GMT & BST in Timezone - still an hour slow. I'll keep digging.

Posted by rich.sperrin at Apr 10, 2015 18:33

Is the "locale" in your controller computer properly set?

Posted by pz1 at Apr 10, 2015 18:58

Thats the badger!

A quick sudo cp /usr/share/zoneinfo/Europe/London /etc/localtime did the trick (on raspberry pi)

Sorted

Thanks

Posted by rich.sperrin at Apr 10, 2015 19:06

Not so fast!!

Raspberry Pi is reporting correct time for BST and has been rebooted.

Sensor is still displaying hour slow. Tried Timezone Europe/London & GMT & BST

Bizarre!

Posted by rich.sperrin at Apr 10, 2015 19:39

Okay - using sudo dpkg\-reconfigure tzdata on RPi2 tells me I have:-
Local Time : Sun Apr 12 15:20:48 BST 2015
Universal Time : Sun Apr 12 14:20:48 UTC 2015

Unfortunately the OR2 Java command is returning UTC

I've tried adjusting the timezone to Europe/London & BST (& UTC) but it wont budge.

And thats after restarting OR2 each time on the tablet.

GOT THERE!

Restarted the RPi2 after using the command above.

(I left the timezone blank in the end)

Posted by rich.sperrin at Apr 12, 2015 15:30

Hi Rich i have a question for you, about a different topic (sorry for hijack you post)

in you design you have a tune in button. I have tune in working with vlc but in fact is a mess.

Can you let me know haw you make it work for you.

Thanks in advance.

Posted by edito at Oct 11, 2015 23:59

Hi

I have removed the Tune-In radio button but was using it with the built-in HTML that my network Philips speakers serve.

The built in media software is called Philips Airplay+ and has a Tune-In radio section.

I wrote quite a long piece on sending HTML commands on another OR2 page - here is the link:-

http://www.openremote.org/display/forums/Commands+for+Philips+AW9000+Wifi+speakers

Sorry - but suspect this doesnt help you very much.

What may help is Firefox's Web Console - this exposes HTML commands. Maybe you could use this with the OR2 web browser control? I have to admit I didnt have much luck with sending HTML URL commands to the OR2 browser control though :-/

[Edit]

Just had a quick look at Tune-In radio - as an example you can send the URL http://tunein.com/radio/Sam-FM-Bristol-1065-s80728/ - this will tune the target device to a station. The command can be sent to the device using the HTML function in the OR2 command option.

regards

Posted by rich.sperrin at Oct 13, 2015 19:39
Document generated by Confluence on Jun 05, 2016 09:33