SpaceX Next Launch / Starman Integration

Actually, I think I’ve got it sorted. Firstly the timezone was not set correctly in my configuration.yaml - that got me to UTC time. Then I created a template and display that instead.

  - platform: template
    sensors:
        next_launch_time_local:
            friendly_name: 'Launch Time'
            icon_template: 'mdi:clock'
            value_template: "{{ state_attr('sensor.next_launch_day', 'launch_date_utc')|as_timestamp|timestamp_custom('%H:%M') }}"

Glad you got it sorted!

Hello
Again, great work. Loving this integration. Pushing launch data to my phone so I have no excuse to miss launches now!

I’ve just updated the integration and now all of my data is blank. Looking into the entities, everything is now doubled. Was there a reason for this or is it a case of switching over all the entities?

You’ll have to update your entities. One of the previous version updates cleaned up the way that it assigned unique ids in Home Assistant which created the duplication/renaming. Sorry for that!

That’s fine, no worries.

I’m fairly new to HA and code etc, so thought I’d double check before I made things go bang haha.

Thanks

Hello
Not sure if my HA is doing something odd but I’m having some strange issues.

I’ve upgraded the entities which gave me duplicates. I then updated the dashboard accordingly and deleted the entities which were no longer in use.

Now, I’d set up alerts for the next launch confirmation, 24hr countdown and 20 minutes. Those were pushed to my phone via Telegram. Prior, it was working fine. For the past few days, the confirmation and 24hrs have triggered several times. Whilst the 20 minutes today was not triggered. Not sure if this could be due to the api or my HA is playing tricks on me.

Anybody else noticed such behaviour?

I periodically get multiple alerts about confirmed launches etc, usually happens when the SpaceX API is down for longer than a couple cycles of updates (which unfortunately is more frequent than I would like). I am going to keep trying to solve for that, but so far haven’t found a way around it.

Not sure why you wouldn’t have got the 20 min launch warning - I got mine today.

1 Like

Updated to version 019 which adds a new next_launch_countdown sensor which gives you days/hours/minutes/seconds until launch and an attribute t0_countdown which will return a text version of that (including the next mission) if you want to use it for Google Broadcasts or alerts from a script. :slight_smile:

1 Like

Hello, Yes the 20 minute thing was my typo. I thought it may be the API but just never had it before so thought it was odd.

I’ve just done the latest update (from 17 to 19?) and all of my entities have gone now, they just show as unavailable. Tried a few things, reinstall and restart etc but still the same. Any ideas?

Also, do you have one of those, buy me a coffee buttons? You clearly put a lot of work into this, which goes above my head. Just be nice to give a little token of appreciation.

Just updated to version 020 which fixes the issue that cropped up over the weekend. Appears SpaceX removed the last updated date from their data so I have removed that from the integration. Should be working again with this update.

2 Likes

It certainly did work and everything is back to how it was. Thank you so much.

Because of the alerts, I’ve been able to watch a few launches now and with my 4 year old.

1 Like

Works perfectly for me! Thank you @djtimca!

Hi All,

is there a way to change the scan interval? I want to change it to every 3 or 6 hours.

Not at the current time. I could add an option in a future version though.

2 Likes

Thanks, love the integration. Do you have a latest updated set of lovelace card? Or anyone have good backgrounds/animated ones they want to share?

This is what I’m currently using:

(but I’d love to see other creative applications too!)

cards:
  - content: >-
      <table ><tr><td> <a href="{{
      states.sensor.next_launch_mission.attributes.video_link }}">{% if
      states.sensor.next_launch_mission.attributes.mission_patch != "" %}
        <img src="{{states.sensor.next_launch_mission.attributes.mission_patch}}" width=250 title="Watch Launch">
      {% endif %}</a></td> <td>{{
      states.sensor.next_launch_mission.attributes.details }} </tr></table>
    title: Next Launch
    type: markdown
  - entities:
      - entity: sensor.next_launch_rocket
        name: Rocket
      - entity: sensor.next_launch_mission
        name: Mission
      - entity: sensor.next_launch_countdown
        name: Countdown
      - entity: sensor.next_confirmed_launch_day
        name: Day
      - entity: sensor.next_confirmed_launch_time
        name: Time
      - entity: sensor.next_launch_site
        name: Site
    type: entities
  - entities:
      - entity: sensor.latest_launch_rocket
        name: Rocket
      - entity: sensor.latest_launch_mission
        name: Mission
      - entity: sensor.latest_launch_day
        name: Day
      - entity: sensor.latest_launch_time
        name: Time
      - entity: sensor.latest_launch_site
        name: Site
    show_header_toggle: false
    title: Latest Launch
    type: entities
  - content: >-
      <center><a href="{{
      states.sensor.latest_launch_mission.attributes.video_link }}">Watch Latest
      Launch</a></center>
    type: markdown
  - entities:
      - entity: sensor.starman_speed
      - entity: sensor.starman_distance
    show_header_toggle: false
    title: Starman Tesla Roadster
    type: entities
title: SpaceX
type: vertical-stack
3 Likes

your code has some errors for me…

The watch video link image is broken.

And i do not have a sensor called latest_launch_rocket

Issue with sensor.latest_launch_rocket is fixed in the latest release (025).

Found the issue with my mission patch - the following will now get rid of the image issue:

cards:
  - content: >-
      <table ><tr><td> <a href="{{
      states.sensor.next_launch_mission.attributes.video_link }}">{% if
      states.sensor.next_launch_mission.attributes.mission_patch != none %}
        <img src="{{states.sensor.next_launch_mission.attributes.mission_patch}}" width=250 title="Watch Launch">{% else %}Watch Launch
      {% endif %}</a></td> <td>{{
      states.sensor.next_launch_mission.attributes.details }} </tr></table>
    title: Next Launch
    type: markdown
  - entities:
      - entity: sensor.next_launch_rocket
        name: Rocket
      - entity: sensor.next_launch_mission
        name: Mission
      - entity: sensor.next_launch_countdown
        name: Countdown
      - entity: sensor.next_confirmed_launch_day
        name: Day
      - entity: sensor.next_confirmed_launch_time
        name: Time
      - entity: sensor.next_launch_site
        name: Site
    type: entities
  - entities:
      - entity: sensor.latest_launch_rocket
        name: Rocket
      - entity: sensor.latest_launch_mission
        name: Mission
      - entity: sensor.latest_launch_day
        name: Day
      - entity: sensor.latest_launch_time
        name: Time
      - entity: sensor.latest_launch_site
        name: Site
    show_header_toggle: false
    title: Latest Launch
    type: entities
  - content: >-
      <center><a href="{{
      states.sensor.latest_launch_mission.attributes.video_link }}">Watch Latest
      Launch</a></center>
    type: markdown
  - entities:
      - entity: sensor.starman_speed
      - entity: sensor.starman_distance
    show_header_toggle: false
    title: Starman Tesla Roadster
    type: entities
title: SpaceX
type: vertical-stack
3 Likes

great plugin! thanks for that code fix too.

just noticed something odd
currently the plugin with the card config, shows next launch in 3 days.
If i click on that entity, on the “3 days, 11:22:44”, home assistant pops up with the entity info, and CHUGGS HARD, has trouble loading the state history, finally does, 1 entry per second… OOF!
click the x to make the popup go away… it will… eventually…

image

and 2nd… according to this youtube stream there is a launch tomorrow… but its sub orbital

As early as Tuesday, December 8, the SpaceX team will make the first attempt of a high-altitude suborbital flight test of Starship serial number 8 (SN8) from our site in Cameron County, Texas. The schedule is dynamic and likely to change, as is the case with all development testing.