Dashbord bug or is there an option I am missing?

I have a rule, screenshot 1, that sets two hub variables, screenshot 2, to Sunrise and Sunset times.

I then display them on a dashboard, screenshot three. Although the variables are shown in a 12 hour format on the hub variable setting page, they are displayed in a 24 hour format on the dashboard. The dashboard option is set to show in 12 hour format, as seen by the current time display. Is this a bug, is there an option I am missing, or just the way it is?

Maybe something for @gopher.ny to look at?

1 Like

Noted.

Nothing to do with the possible bug, but wondering how can I do the same but with just the time. I can only set the hub variable as date/time and I only want the time. Thanks.

Edit: Guessing I might need to create a string variable and add something to the rule to remove the date then add that string variable to the dash?

If this could be twisted into a feature request, it would be nice if these could be made available for linking to a dashboard, whether it be under the current device / variable selections, or even additional options made available in the dashboard app settings page, allowing selection of these times plus potentially other hub details.... Removing the need for users to construct variable values. The formatting of the time could be a separate configuration item or potentially draw from other settings....

1 Like

Yeah agreed. I saw this thread and thought that would be handy. With SharpTools I show the current time on my dashboard with a separate tile for day and date, another for external (measured) temperature. I just thought it would be handy to display the local sunrise and sunset times as well.

@thebearmay - is Sunrise Sunset available to be added into Hub Information Driver or does Hubitat not make it available?

1 Like

It could be added. Looks like the native format is a date data type, probably milliseconds since January 1, 1970. Easy enough to make it a different format though, what format would be most convenient? (I could also make format a selectable option.)

2 Likes

What about a format string and a couple of attributes for day, date, time, etc... ? If I can hustle my way into a request I am unlikely to use... :wink:

2 Likes

if you want to try https://raw.githubusercontent.com/thebearmay/hubitat/main/hubInfoV2_7_9.groovy
it may show up after the first poll cycle.

2 Likes

Of course it will... :wink:

Not in a place I can check that I didn't typo something so I didn't push it to the production version.

I suppose I'm just looking for a basic 24 hour clock hh:mm, so that when I pop it on a SharpTools tile I can get it to match my normal clock.

Can you clarify all the content you'd like to see in your tile at once? You might be able to use a SharpTools Super Tile to mix and match the content you're looking for.

The clock elements in the Super Tile would pickup your system locale and display it in your regional time format or you could customize it as you see fit:

For sunrise/sunset, if you already have a driver that has that information, you could pull it from there. Otherwise there are sunset/sunrise APIs and I could guide you through that if needed. :slight_smile:

1 Like

Thanks for looking at this. I've given that a try. I can see the additional time format option in the preference pane and I can select the 'sunset' and 'sunrise' attributes for use in my tile but nothing is populated. In the logs I get an error:

Line 439 in the code is:

updateAttr("sunrise", sdf.format(new Date(location.sunrise)))

Would I be right in thinking you need to wait for the events @thebearmay ?

I tried a reboot of the hub in case that pulled in the info at startup, but no joy.

I was thinking the hub events that set the sunrise and sunset times... Which may not occur during a reboot...

1 Like

Thanks @josh I missed your response.

Yeah my plan is probably to use a Super Tile rather than individual tiles. It looks as though the 'Hub Information Driver' that @thebearmay created will be able to grab the sunrise and sunset times for my location from the hub once updated. I'll then add those to a Super Tile via the 'Hub Information Driver' virtual device, selecting the Hero attribute layout and 'sunrise' / 'sunset' as the primary attribute for the device. I've used this driver to put the 'Hub Free Memory' in a SharpTools tile already.

1 Like

I'll need to wait until I get home this afternoon to see what the format is that is coming in and play with it a little. Should be a 5 minute fix once I get home though.

2 Likes

Great thanks :+1: