Stardate entity

Hello Star Trek fans! I have created an entity that displays the current Stardate, and I thought I would share it.

The math for this was sourced from TrekGuide.com =/\= Calculating Stardates and Calendar Dates, and displays the Stardate of the current TNG Star Trek episode or movie to represent today’s Stardate (i.e. the Stardate of this week’s episode if The Next Generation and its spinoffs were still in production). There are other Stardate systems described there, but this is the one I chose.

This calculation depends on the ‘date_time_iso’ sensor. If you have not already added it to your configuration.yaml (like say, when you installed the LCARS theme), you will need to add it as below. I only use the ‘date_time_iso’ display option, but it wont hurt to add the rest.

sensor:
  - platform: time_date
    display_options:
      - 'time'
      - 'date'
      - 'date_time'
      - 'date_time_utc'
      - 'date_time_iso'
      - 'time_date'
      - 'time_utc'

Once that is added, we need to create a Template Helper that will do the math:
Settings → Devices & Services → Helpers → Create Helper → Template → Template a Sensor → State Template:

{{ (((as_timestamp(states('sensor.date_time_iso')) - (as_timestamp("1987-07-15 00:00:00"))) // 3155.76 ) + 410000 ) / 10 }}

Name this “Stardate”, and you are done! The Stardate can be easily added to an Entity card, or wherever else you like.

If you have improvements, or want to do the math for other Stardate calculations, please share them! Thanks :slight_smile:

EDIT: Removed deprecated ‘beat’ from display options

26 Likes

Thank you for the calculation. While I understand it is based on the Stardate it would be today if TNG were still filming, I think a better and more realistic correlation to our date today would be to express it as a negative number, either as -12345.6 or perhaps 12345.6 BT (BT=‘Before Trek’, similar to how we use BC and AD).
Since Stardate 00000.0 is accepted as Friday, July 5, 2318 around noon (Starfleet Command time which is USA CDT) and using 34,367.0564 seconds per 1.0 Stardate, today would be -270463.0 or 270463.0 BT.

{{ ((as_timestamp(states('sensor.date_time_iso')) - as_timestamp("2318-07-15 00:12:00.0-05:00")) / 34367.0564 ) | round(1,'floor') | string }} BT

Just my .02¢.

image

sensor:
  - platform: worldclock
    name: Starfleet Command
    time_zone: Etc/GMT+5

2023-12-27 16:22:25 PST:
image