What can be done with date/time tiles?

Hey all --

For the date and time tile in the red box below, what can I do with it? Can I somehow set it to be something like:

Tuesday, November 24, 2020
9:49 PM

Unfortunately I don't think you can do much in the way of formatting with the standard tile. I ended up writing a small driver to store the date and time in the format of your choosing.

If you need a hand setting it up just let me know

2 Likes

Awesome, I'll check it out and see what I can get it to do! I'll reach out here if I need any assistance.

1 Like

I added the driver and created a virtual device using that driver. Now when I add it to my dashboard, I choose that device, but what template do I select for it? Is there anything else that I've missed?

I think it would be the attribute template from memory

Yes - Attribute template and formattedDate or formattedTime attributes from the drop-down that is displayed

Attribute was it. Thanks. Got it displaying and a rule set to update it. But it's just the default format of 11/20/2020 10:39:10 PM. When I open the device and look at the settings to change the format and then save it, nothing happens. Since it is auto refreshing every 10 seconds, for the time, is there anything else I need to do to refresh when I change the format?

Hmmm, let me take a look, I wouldn't have thought so. Have you tried refreshing the device page in your browser?

Glad to hear you got it working btw....

Yeah, thanks for this. Seems to work but just need to change the format now. For example as I was just messing around to change things, I set it to this but can't get anything to change on the dashboard.

Screen Shot 2020-11-24 at 10.45.44 PM

I think I got it. I had to set the Attribute to FormattedDate. I see there is now FormattedDate and FormattedTime, but not both at the same time?

How do you mean "not at the same time"? You are right that you only select one attribute when configuring a tile in a dashboard, is that where you are talking about?

I added a third preference for a combined date and time together. The date prints on the first line, and the time on the second line. Here is how it comes out in a single tile. If you or anyone would like the updated code, I can post it. In fact, I'll probably just post it in this thread so it doesn't get lost.

2 Likes

Here is the updated code:

/**
 *  Date / Time Display
 *
 *  Copyright 2019 Simon Burke
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *
 *  Change History:
 *
 *    Date        Who            What
 *    ----        ---            ----
 *    2020-04-18  Simon Burke    Original Creation
 *.   2020-11-24  Jaime Pirnie   Added third parameter for combined date and time in single Attribute
 * 
 */

metadata {
	definition (name: "Date / Time Display", namespace: "simnet", author: "Simon Burke") {
        capability "Refresh"
        attribute "formattedDate", "string"
        attribute "formattedTime", "string"
        attribute "formattedDateTime", "string"
	}

	preferences {
		input(name: "dateFormat", type: "string", title:"Date Format", description: "Enter the date format to apply for display purposes", defaultValue: "EEEE d MMMM, yyyy", required: true, displayDuringSetup: true)
		input(name: "timeFormat", type: "string", title:"Time Format", description: "Enter the time format to apply for display purposes", defaultValue: "HH:mm", required: false, displayDuringSetup: true)
        input(name: "dateTimeFormat", type: "string", title:"DateTime Format", description: "Enter the date and time format to apply for display purposes", defaultValue: "EEEE, MMMM d, yyyy'<br />'hh:mm a", required: false, displayDuringSetup: true)
    }
}

def refresh() {
    runCmd()   
}

def runCmd() {
    
    //EEEE d MMMM, yyyy
    //HH:mm
    //EEEE, MMMM d, yyyy'<br />'hh:mm a
    sendEvent(name: "formattedDate", value : new Date().format("${dateFormat}"));
    sendEvent(name: "formattedTime", value : new Date().format("${timeFormat}"));
    sendEvent(name: "formattedDateTime", value : new Date().format("${dateTimeFormat}"));
}
1 Like

Putting it on three lines. I'll see how this suits me over the next days/weeks and see if it sticks.

1 Like

Nice work. I'll add a post in my original thread with a link to this thread to people can find it as well.

You may also be interested to look up the Tile Master app which you can use the show details from a number of devices or attributes as part of the same tile. Opens up a whole world of opportunities beyond just the date/time formatting.

1 Like

Awesome.. I was using ActionTiles with SmartThings before Sunday. This dashboard stuff is not as advanced and easy as ActionTiles but I love that it is all local. I'm not well versed in CSS so getting it to this point has taken quite a few hours. The one thing that I want to do is change some of the icons but they don't have icons that I want built in. Not sure how to get the ones I want and change those.

I installed an app called Tile Master 2 but I don't think it's the one you're talking about. Can you point me to the one you're referring to?

1 Like

Well you've got a long and interesting road ahead :slight_smile: I'll find a couple of links for you shortly.

If you want to have ultimate control of how your dashboards look, this will help with possibilities in the CSS space, amongst other posts around the Community.

Something that can really jump-start your dashboard experience is Smartly. It's had an "interesting" recent history, mostly with those involved in it's development. I don't personally know all the details, just wanted to mention it in case you make any mention of it elsewhere and get an odd response. Don't let that stop you diving in and taking a look.

No, that's the one, Tile Master 2. It takes a little bit to get used to and setup. There are a couple of options in that space, including SuperTile by cobra, but I find Tile Master 2 the most versatile. I'll find some examples of what I have done to give you an idea, though my UI skills are not the best.

1 Like

Yeah I got stuck at the first screen and didn't really know what to do with the first setup screen. Any pointers there would be appreciated.

Bryan is pretty good with documentation, so aside from suggesting you use package manager to handle installs of apps / drivers like this, check out Bryan's GitHub repository and the documentation on this app. I guess I've been using it for a while, so have the edge. The general idea is the tile is broken up into a grid of rows and cells on those rows, at a basic level you can report the attribute values of different devices along with fixed text either side, plus you can add what are essentially buttons to control devices, but I'd suggest starting small (output of attributes only), reading the doco and then moving on to any device control you may want.

In terms of icons, I'll come to that in a minute....

Tile Master does allow for setting up icons within the app, but you may want to play around with setting up some basic tiles first just to get familiar with it before moving onto icons, e.g. displaying the status (attributes) of two or three different devices in a room. Though you've probably done that by the time I've written this post...

I expect getting familiar with setting up device control in Tile Master 2 using Maker API is probably a good thing to do as well before moving on to icons, depending on what you want to achieve.

If you want to set icons up you need to click on the Tile Master 2 heading in the Apps page:

In there you can choose to setup icons. The basic idea is you can provide URLs to icons / images on the web, use bitly to cut down the size of these URLs (there is a limit to the text in the html produced by Tile Master 2 of 1024 characters, including formatting tags), or you could host the images locally, either on a server on your LAN or even on your HE hub by uploading them using the File Manager under the Settings page in your HE hub. I'll need to find an example of one if you decide to host on your HE hub, unless you find it yourself.

I played with icons a little bit with Tile Master 2 to setup a tile I could use to change channel via my Harmony hub, but it's been a while.... :slight_smile: And I haven't finished it the way I want...

Welcome to just one rabbit hole you will find here Alice-stah :yum:

Hah wow.. ok, I’ll play around with Tile Master 2 in the morning. I think when I loaded it up the first time I didn’t know what to put into any of the fields. I’ll try again and look for some docs on it. Thanks again for everything! I’ll be hanging around this board for a while.. lol - many rabbit holes to explore for sure.

1 Like

Download the Hubitat app