Please read the posts in the Announcements section about the current status of Cumulus development now that I have retired

Please read this post before posting

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See this post for download

Displaying Timestamp in realtime.txt, and centering the digital displays

Discussion of Mark Crossley's HTML5/Javascript gauges

Moderator: mcrossley

DJHarris
Posts: 6
Joined: Sat Jun 27, 2015 1:46 pm
Weather Station: WS3083
Operating System: Windows 8.1
Location: Exeter

Displaying Timestamp in realtime.txt, and centering the digital displays

Postby DJHarris » Tue Nov 28, 2017 1:55 pm

Hello -

I had a look on this forum but couldn't find the answer to my questions easily, if Ive missed them please point me to the previous answers!

I've been making my own custom page with the SteelSeries gauges (which are excellent) - my questions are as described in the title:

1) How can I display the timestamp in realtimegauges.txt on my page? Currently I do not ask Cumulus to process gauges-ssT.htm (because I have no more lines left in the Files section!), and suspect that I could do it in there? But ideally, I'd like to take the timestamp (which is shown in the pop-up when you hover over the LED) and write it to the page when the gauges refresh (every 60 seconds).

2) Is there a way to configure the digital displays to write the digits to the centre of their windows? I had a good look through the gauges.js file but could not see this option easily available.

Many thanks in advance,
Dan :)

water01
Posts: 1444
Joined: Sat Aug 13, 2011 9:33 am
Weather Station: WH1081
Operating System: Windows 7 64bit HP SP1
Location: Somewhere in the USA
Contact:

Re: Displaying Timestamp in realtime.txt, and centering the digital displays

Postby water01 » Tue Nov 28, 2017 2:31 pm

The files section can handle 100 files so I doubt you have reached the limit, just the limit of the display. To add more, edit cumulus.ini (Cumulus must be closed) and scroll down to Files. Copy the last group (it will have 09 in the names) paste it underneath 09 and alter all the lines to 10 and set the appropriate setting (1 on 0 off etc.). You can keep doing this up to 99 :D .

DJHarris
Posts: 6
Joined: Sat Jun 27, 2015 1:46 pm
Weather Station: WS3083
Operating System: Windows 8.1
Location: Exeter

Re: Displaying Timestamp in realtime.txt, and centering the digital displays

Postby DJHarris » Tue Nov 28, 2017 2:58 pm

water01 wrote:The files section can handle 100 files so I doubt you have reached the limit, just the limit of the display. To add more, edit cumulus.ini (Cumulus must be closed) and scroll down to Files. Copy the last group (it will have 09 in the names) paste it underneath 09 and alter all the lines to 10 and set the appropriate setting (1 on 0 off etc.). You can keep doing this up to 99 :D .


Ah superb thanks David!

User avatar
mcrossley
Posts: 5147
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Displaying Timestamp in realtime.txt, and centering the digital displays

Postby mcrossley » Tue Nov 28, 2017 3:00 pm

DJHarris wrote:1) How can I display the timestamp in realtimegauges.txt on my page? Currently I do not ask Cumulus to process gauges-ssT.htm (because I have no more lines left in the Files section!), and suspect that I could do it in there? But ideally, I'd like to take the timestamp (which is shown in the pop-up when you hover over the LED) and write it to the page when the gauges refresh (every 60 seconds).

As David said, you can add extra files to Cumulus, but the smarter way of doing it would be to update a field on your page from the javascript every time it fetches a new version of realtimeGauges.txt.

Alternatively you could add it to the 'forecast' scroller text as I have done on my page. You just need to edit the realtimeGaugesT.txt file and put whatever tags you want in the 'forecast' field. eg

Code: Select all

"forecast":"<#date format=HH:mm> <#forecastenc>",


DJHarris wrote:2) Is there a way to configure the digital displays to write the digits to the centre of their windows? I had a good look through the gauges.js file but could not see this option easily available.

No easy way, you would have to alter the underlying SteelSeries library - it is hard coded to right justify.

DJHarris
Posts: 6
Joined: Sat Jun 27, 2015 1:46 pm
Weather Station: WS3083
Operating System: Windows 8.1
Location: Exeter

Re: Displaying Timestamp in realtime.txt, and centering the digital displays

Postby DJHarris » Tue Nov 28, 2017 9:02 pm

Hi Mark,

Thanks for your reply. I'll have a dig around in the js files and see what I can find... I've managed to move the numbers around but it's doesn't seem to be as easy as just setting it to "centred", the js calculates the distance from the right hand edge of the lcd display and thus to centre it will depend on how long the numbers are!

Anyway,, with regards to the timestamp, I'd like to take a field from the script and post it to the html page, as far as I can make out in the gauges.js file the time is stored in a data.date variable? But I don't really know how to write that to the screen. The way the code writes the gauges and the data to the screen seems a little bit magical to me. I tried a document.write type thing but no success. Are you able to point me in the right direction?

Thanks a lot for your help,
Dan

User avatar
mcrossley
Posts: 5147
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Displaying Timestamp in realtime.txt, and centering the digital displays

Postby mcrossley » Tue Nov 28, 2017 9:14 pm

The key word is AJAX - using script to update page elements.

As you have JQuery loaded already it is dead easy. Define and element on your page that you want to update - say a DIV - and give it a unique id...

Code: Select all

<div id="myTime"></div>

Then in the script change the contents of your element after the data object has been updated...

Code: Select all

// time is held in data.date
$('#myTime').html(data.date);

DJHarris
Posts: 6
Joined: Sat Jun 27, 2015 1:46 pm
Weather Station: WS3083
Operating System: Windows 8.1
Location: Exeter

Re: Displaying Timestamp in realtime.txt, and centering the digital displays

Postby DJHarris » Tue Nov 28, 2017 9:33 pm

Cool that actually worked, thanks Mark! Never used AJAX before in my life, I feel like I'm out of my depth here...

With regards to the centering, it wasn't too hard to do in the end, there are 3 or 4 textAlign="right" statements in the file steelseries_tween.min.js which have to be changed to textAlign="center", then you have to change ff+tr-tr*.05 to ff+tr-tr*.5 and lf+ur-ur*.05 to lf+ur-ur*.5 .

Although I just noticed that it's messed up the positioning of the forecast text - back to the drawing board! Very low priority stuff anyhow.

Thanks so much for your help Mark, PS I love your weather page. I was just trying to make a little display page with the gauges that could stand-alone and serve as an "always on" type display on an old tablet or something - you can see it here http://doubledeckerbus.asuscomm.com/Cum ... ges-ss.htm

Dan

User avatar
mcrossley
Posts: 5147
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Displaying Timestamp in realtime.txt, and centering the digital displays

Postby mcrossley » Tue Nov 28, 2017 10:14 pm

Yep, a simple gauges page would be one good choice for a single page display.

Don't edit the steelseries_tween.min.js file, edit the uncompressed source files in the 'src' folder - it's much easier to see which lines you need to change. Then either recompress and combine the source files again, or change your page to load the two source files directly, if it is to be a 'static' display the page load time doesn't really matter.


Return to “SteelSeries Gauges”

Who is online

Users browsing this forum: No registered users and 3 guests