###################################################################### # @CCOSTAN - Follow Me on X # For more info visit https://www.vcloudinfo.com/click-here # Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig # ------------------------------------------------------------------- # Space - ISS and launch-related telemetry # Tracks SpaceX timing and announces an upcoming launch window. # ------------------------------------------------------------------- # Notes: Guard template triggers against unavailable startup sensor state. ###################################################################### sensor: - platform: rest scan_interval: 1800 name: SpaceX Starman json_attributes: - earth_distance_mi value_template: '{{ value_json["speed_mph"] }}' unit_of_measurement: "mph" resource: 'https://api.spacexdata.com/v2/info/roadster' - platform: rest scan_interval: 1800 name: SpaceX json_attributes: - mission_name - launch_site - rocket value_template: '{{ value_json["launch_date_unix"] }}' resource: 'https://api.spacexdata.com/v2/launches/next' automation: - alias: Launch Window Approaching id: 1d42fc4f-a37d-4283-b64b-09242a145598 trigger: - platform: template value_template: >- {% set launch_ts = states('sensor.spacex') | int(0) %} {% set seconds_until = launch_ts - (now().timestamp() | int) %} {{ launch_ts > 0 and seconds_until > 0 and seconds_until <= 600 }} action: - service: script.notify_engine data: value1: >- {% set mission = state_attr('sensor.spacex', 'mission_name') | default('A SpaceX launch', true) %} Go outside. {{ mission }} is scheduled to launch in about 10 minutes. group: 'information'