Lovelace rocket view using template-entity-row and ha rocket launch live

Just thought I would share my rocket view using https://github.com/djtimca/harocketlaunchlive and the custom lovelace https://github.com/thomasloven/lovelace-template-entity-row

image

This streamline the info into a simple view.

Come-on, it is for rocket launches…where is the countdown timer??

Seriously, this is nice.
Does the ‘month-year’ indicate that the launch date has not been set and only a launch window is available?

Correct . It also use the flags within HA Rocket launch live to state if the lauch is now ( within the hour) or Today

state: >
{% if states.sensor.rocket_launch_1.attributes.launch_20m_warning == ‘true’ %}
Now
{% elif states.sensor.rocket_launch_1.attributes.launch_24h_warning == ‘true’ %}
Today
{% else %}
{{states.sensor.rocket_launch_1.attributes.launch_date_target}}
{% endif %}

Great! Thanks for your time. Works like a charm!

1 Like

Updated to give a count down thanks @GlennHA

image

That does look nice.
Does the countdown start at 24 hrs?

Obviously my comment about the timer was not challenging enough. Now for a challenge, change the icon to the respective live camera feed upon start of countdown timer. Unfortunately I have no idea where you can get this data from one place.

It would be nice if this was in HACS so the updates (for the card and integration) were polled automagically.

1 Like

Thanks for your comments.

None of this is my work. Im just manipulating the data from rocket live launch that is in HACS . There are a couple attributes

sensor.rocket_launch_1.attributes.launch_24h_warning this give the 24 hour warning. I test for this and then use the sensor.rocket_launch_1.attributes.launch_target_timestamp this is the lauch time and date, I just subtract this from the current time.

I then use another HACS addon to display it nicely.

There is a attribute Launch media link which could do what you want, but it does not apper to be populated, Install the rocket live addon and have a play :slight_smile:

Made a minor update to highlight next launch

image

  title: Rocket 
  path: rocket
  icon: 'mdi:rocket-launch'
  badges: []
  cards:
  - type: grid
    title: Rockets
    columns: 1
    square: false
    cards:
      - type: entities
        entities:
        - type: custom:template-entity-row
          entity: sensor.rocket_launch_1
          icon: mdi:rocket-launch
          name: "{{states.sensor.rocket_launch_1.attributes.name}}"
          state: >
            {% if states.sensor.rocket_launch_1.attributes.launch_24h_warning == 'true' or
                  states.sensor.rocket_launch_1.attributes.launch_20m_warning == 'true' %}
               {% set time = states.sensor.rocket_launch_1.attributes.launch_target_timestamp|float - as_timestamp(utcnow()) %}
               {% set hours = ((time % 86400) // 3600) %}
               {% set minutes = ((time % 3600) // 60) %}
               {% if states.sensor.rocket_launch_1.attributes.launch_24h_warning == 'true' %}
                 {{hours|int}} hrs {{minutes|int}} mins
               {% endif %}
               {% if states.sensor.rocket_launch_1.attributes.launch_20m_warning == 'true' %}
                  {{minutes|int}} mins
               {% endif %}
            {% else %}
               {{states.sensor.rocket_launch_1.attributes.launch_date_target}}
             {% endif %} 
          secondary: >
            {{states.sensor.rocket_launch_1.attributes.provider}} 
            {{states.sensor.rocket_launch_1.attributes.vehicle}}
        - type: custom:template-entity-row
          entity: sensor.rocket_launch_2
          name: "{{states.sensor.rocket_launch_2.attributes.name}}"
          state: >
            {% if states.sensor.rocket_launch_2.attributes.launch_24h_warning == 'true' or
                  states.sensor.rocket_launch_2.attributes.launch_20m_warning == 'true' %}
               {% set time = states.sensor.rocket_launch_2.attributes.launch_target_timestamp|float - as_timestamp(utcnow()) %}
               {% set hours = ((time % 86400) // 3600) %}
               {% set minutes = ((time % 3600) // 60) %}
               {% if states.sensor.rocket_launch_2.attributes.launch_24h_warning == 'true' %}
                 {{hours|int}} hrs {{minutes|int}} mins
               {% endif %}
               {% if states.sensor.rocket_launch_2.attributes.launch_20m_warning == 'true' %}
                  {{minutes|int}} mins
               {% endif %}
            {% else %}
               {{states.sensor.rocket_launch_2.attributes.launch_date_target}}
             {% endif %} 
          secondary: >
            {{states.sensor.rocket_launch_2.attributes.provider}} 
            {{states.sensor.rocket_launch_2.attributes.vehicle}}
        - type: custom:template-entity-row
          entity: sensor.rocket_launch_3
          name: "{{states.sensor.rocket_launch_3.attributes.name}}"
          state: >
            {% if states.sensor.rocket_launch_3.attributes.launch_24h_warning == 'true' or
                  states.sensor.rocket_launch_3.attributes.launch_20m_warning == 'true' %}
               {% set time = states.sensor.rocket_launch_3.attributes.launch_target_timestamp|float - as_timestamp(utcnow()) %}
               {% set hours = ((time % 86400) // 3600) %}
               {% set minutes = ((time % 3600) // 60) %}
               {% if states.sensor.rocket_launch_3.attributes.launch_24h_warning == 'true' %}
                 {{hours|int}} hrs {{minutes|int}} mins
               {% endif %}
               {% if states.sensor.rocket_launch_3.attributes.launch_20m_warning == 'true' %}
                  {{minutes|int}} mins
               {% endif %}
            {% else %}
               {{states.sensor.rocket_launch_3.attributes.launch_date_target}}
             {% endif %} 
          secondary: >
            {{states.sensor.rocket_launch_3.attributes.provider}} 
            {{states.sensor.rocket_launch_3.attributes.vehicle}}
        - type: custom:template-entity-row
          entity: sensor.rocket_launch_4
          name: "{{states.sensor.rocket_launch_4.attributes.name}}"
          state: >
            {% if states.sensor.rocket_launch_4.attributes.launch_24h_warning == 'true' or
                  states.sensor.rocket_launch_4.attributes.launch_20m_warning == 'true' %}
               {% set time = states.sensor.rocket_launch_4.attributes.launch_target_timestamp|float - as_timestamp(utcnow()) %}
               {% set hours = ((time % 86400) // 3600) %}
               {% set minutes = ((time % 3600) // 60) %}
               {% if states.sensor.rocket_launch_4.attributes.launch_24h_warning == 'true' %}
                 {{hours|int}} hrs {{minutes|int}} mins
               {% endif %}
               {% if states.sensor.rocket_launch_4.attributes.launch_20m_warning == 'true' %}
                  {{minutes|int}} mins
               {% endif %}
            {% else %}
               {{states.sensor.rocket_launch_4.attributes.launch_date_target}}
             {% endif %} 
          secondary: >
            {{states.sensor.rocket_launch_4.attributes.provider}} 
            {{states.sensor.rocket_launch_4.attributes.vehicle}}
        - type: custom:template-entity-row
          entity: sensor.rocket_launch_5
          name: "{{states.sensor.rocket_launch_5.attributes.name}}"
          state: >
            {% if states.sensor.rocket_launch_5.attributes.launch_24h_warning == 'true' or
                  states.sensor.rocket_launch_5.attributes.launch_20m_warning == 'true' %}
               {% set time = states.sensor.rocket_launch_5.attributes.launch_target_timestamp|float - as_timestamp(utcnow()) %}
               {% set hours = ((time % 86400) // 3600) %}
               {% set minutes = ((time % 3600) // 60) %}
               {% if states.sensor.rocket_launch_5.attributes.launch_24h_warning == 'true' %}
                 {{hours|int}} hrs {{minutes|int}} mins
               {% endif %}
               {% if states.sensor.rocket_launch_5.attributes.launch_20m_warning == 'true' %}
                  {{minutes|int}} mins
               {% endif %}
            {% else %}
               {{states.sensor.rocket_launch_5.attributes.launch_date_target}}
             {% endif %} 
          secondary: >
            {{states.sensor.rocket_launch_5.attributes.provider}} 
            {{states.sensor.rocket_launch_5.attributes.vehicle}}
1 Like

@lonebaggie great solution, thanks a lot! Is it normal that I get on every HA start the following error:

2022-08-10 07:44:45.037 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'None' has no attribute 'attributes' when rendering '{% if states.sensor.rocket_launch_1.attributes.launch_24h_warning == 'true' or
      states.sensor.rocket_launch_1.attributes.launch_20m_warning == 'true' %}
   {% set time = states.sensor.rocket_launch_1.attributes.launch_target_timestamp|float - as_timestamp(utcnow()) %}
   {% set hours = ((time % 86400) // 3600) %}
   {% set minutes = ((time % 3600) // 60) %}
   {% if states.sensor.rocket_launch_1.attributes.launch_24h_warning == 'true' %}
     {{hours|int}} hrs {{minutes|int}} mins
   {% endif %}
   {% if states.sensor.rocket_launch_1.attributes.launch_20m_warning == 'true' %}
      {{minutes|int}} mins
   {% endif %}
{% else %}
   {{states.sensor.rocket_launch_1.attributes.launch_date_target}}
 {% endif %}'

anything I could do not to get this errors for each rocket sensor?

I suspect this is due to the time it takes to load the rocket launch live .

Check how long it takes rocket launch live to load ( info now buried in the repairs screen on the latest’s ver)

Unfortunately I no longer use this screen . I have standardised on a Custom button cards for my frontend. I modified the following from https://github.com/djtimca/harocketlaunchlive