harocketlaunchlive icon indicating copy to clipboard operation
harocketlaunchlive copied to clipboard

More of a question than an issue - can one filter

Open IanAdd opened this issue 4 years ago • 3 comments

You provide the next five launches.

Is this a limitation of the data made available or your prudent choice of a limit.

I would like it if I could filter to get SpaceX launches most of the time.

Ian

IanAdd avatar Sep 27 '21 05:09 IanAdd

I don't have a filter, but you could also install the SpaceX integration which gives you only next and latest SpaceX launches with significantly more detail.

djtimca avatar Jan 18 '22 15:01 djtimca

This would be a really nice addition to an already awesome integration. I already have the SpaceX one, but it's obviously only for SpaceX. For example, I could care less about the other countries unless it's a much anticipated launch, especially since streams for those are hit or miss. I'd love to be able to filter to just see US ones, such as ULA, Blue Origin, Rocket Lab, etc. Right now I have a very sketchy workaround using Node Red to filter the Provider attribute.

tango2590 avatar May 29 '22 21:05 tango2590

Reopened as enhancement suggestion for next time I can get around to it.

djtimca avatar May 31 '22 13:05 djtimca

Would be awesome, if it could be done, due the SpaceX integration is not existing anymore. For me a Starship only vairant would be nice. So histroy beeing made dont get missed.

Sycend avatar Sep 10 '24 13:09 Sycend

I've done another review on this and you can use the attributes already to filter alerts and for conditional cards to show / alert just the ones you are most interested in. I'm not likely to come back to add any filtering logic at the integration level.

djtimca avatar Sep 10 '24 13:09 djtimca

Just did the yaml for it, if someone can do it in a better way i am here to learn :)

 - platform: template
    sensors:
      next_starship_launch:
        friendly_name: "Next Starship Launch"
        value_template: >
          {% for i in range(1, 6) %}
            {% set entity = states["sensor.rocket_launch_" ~ i] %}
            {% if entity and entity.attributes.vehicle == "Starship Prototype" %}
              {{ entity.attributes.name }}
              {% break %}
            {% endif %}
          {% endfor %}
        attribute_templates:
          launch_time: >
            {% for i in range(1, 6) %}
              {% set entity = states["sensor.rocket_launch_" ~ i] %}
              {% if entity and entity.attributes.vehicle == "Starship Prototype" %}
                {{entity.attributes.launch_target}}
                {% break %}
              {% endif %}
            {% endfor %}

          countdown: >
            {% for i in range(1, 6) %}
              {% set entity = states["sensor.rocket_launch_" ~ i] %}
              {% if entity and entity.attributes.vehicle == "Starship Prototype" %}
                {% set launch_date_str = entity.attributes.launch_target %}
                {% set launch_date = as_timestamp(strptime(launch_date_str, '%d-%b-%y %I:%M %p')) %}
                {% set current_date = as_timestamp(now()) %}
                {% set difference = (launch_date - current_date) / 86400 %}
                {% set days_left = difference | round(0) %}
                {% set launch_time = strptime(launch_date_str, '%d-%b-%y %I:%M %p').strftime('%H:%M') %}
                {{ days_left }}
                {% if days_left == 0 %}
                  heute ({{ launch_time }})
                {% elif days_left == 1 %}
                  morgen ({{ launch_time }})
                {% else %}
                  in {{ days_left }} Tagen
                {% endif %}
                {% break %}
              {% endif %}
            {% endfor %}

Sycend avatar Sep 10 '24 15:09 Sycend