2018-01-02 00:00:45 +00:00
|
|
|
#-------------------------------------------
|
|
|
|
# Space Related Packages
|
|
|
|
# @CCOSTAN
|
|
|
|
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
|
|
|
|
#-------------------------------------------
|
|
|
|
#------ISS----------------------------------
|
|
|
|
#-------------------------------------------
|
|
|
|
binary_sensor:
|
|
|
|
- platform: iss
|
2018-12-05 19:38:00 +00:00
|
|
|
show_on_map: true
|
2018-01-02 00:00:45 +00:00
|
|
|
#-------------------------------------------
|
|
|
|
|
|
|
|
sensor:
|
2018-12-05 19:38:00 +00:00
|
|
|
- platform: launch_library
|
|
|
|
|
2018-01-06 18:38:58 +00:00
|
|
|
- platform: moon
|
|
|
|
|
2018-01-02 00:00:45 +00:00
|
|
|
- platform: rest
|
2018-12-05 19:36:54 +00:00
|
|
|
scan_interval: 1800
|
2018-01-02 00:00:45 +00:00
|
|
|
resource: https://launchlibrary.net/1.2.2/launch/next/10
|
|
|
|
# resource: https://raw.githubusercontent.com/cribbstechnologies/ha_config/master/www/test_launch.json
|
|
|
|
name: launch window
|
|
|
|
# if the current timestamp is in the launch window
|
|
|
|
# this sensor will return the UTC timestamp of the launch
|
|
|
|
value_template: >-
|
|
|
|
{%- for launch in value_json.launches %}
|
|
|
|
{% if launch.location.id == 16 or launch.location.id == 17 %}
|
|
|
|
{% if strptime(launch.isostart, '%Y%m%dT%H%M%SZ').strftime('%Y-%m-%d') == now().strftime('%Y-%m-%d') %}
|
|
|
|
{% set utc_offset_string = now().strftime('%z') %}
|
|
|
|
{% set utc_offset_direction = utc_offset_string[:1] %}
|
|
|
|
{% set utc_offset_hours = now().strftime('%z')[-4:] %}
|
|
|
|
{% set utc_offset_seconds = (utc_offset_hours| int /100) * 60 * 60 %}
|
|
|
|
{% if utc_offset_direction == '-' %}
|
|
|
|
{{ launch.wsstamp - utc_offset_seconds}}
|
|
|
|
{% else %}
|
|
|
|
{{ launch.wsstamp + utc_offset_seconds}}
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
automation:
|
|
|
|
- alias: Launch Window Approaching
|
|
|
|
trigger:
|
|
|
|
- platform: state
|
|
|
|
entity_id: sensor.launch_window
|
|
|
|
condition:
|
2020-05-27 22:41:01 +00:00
|
|
|
- condition: template
|
|
|
|
value_template: "{{states('sensor.launch_window') != 'unknown'}}"
|
2018-01-02 00:00:45 +00:00
|
|
|
|
|
|
|
action:
|
2018-12-05 19:36:54 +00:00
|
|
|
- wait_template: >-
|
2020-05-27 22:41:01 +00:00
|
|
|
{{((as_timestamp(now()) - states('sensor.launch_window') | float) | abs < 601)}}
|
2018-01-02 00:00:45 +00:00
|
|
|
- service: script.notify_engine
|
|
|
|
data_template:
|
2018-12-05 19:36:54 +00:00
|
|
|
value1: 'Go Outside! There is a Rocket Launch very soon!'
|
2020-06-07 20:23:56 +00:00
|
|
|
apns_id: 'information'
|
2018-01-02 00:00:45 +00:00
|
|
|
|
|
|
|
- service: script.tweet_engine
|
|
|
|
data_template:
|
|
|
|
tweet: 'There is a Rocket launch happening right now! I can see it if I look closely. @BrianCribbs #SpaceX #Space'
|
|
|
|
|
|
|
|
# This automation was also moved to a macro in the speech_engine.
|
|
|
|
# It's a random fact now.
|
|
|
|
|
|
|
|
- alias: 'ISS is above Me -Tweet'
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
- platform: state
|
|
|
|
entity_id:
|
|
|
|
- binary_sensor.iss
|
|
|
|
to: 'on'
|
|
|
|
from: 'off'
|
|
|
|
|
|
|
|
action:
|
2018-03-17 16:47:27 +00:00
|
|
|
- service: script.tweet_engine_image
|
2018-01-02 00:00:45 +00:00
|
|
|
data_template:
|
2018-03-17 16:47:27 +00:00
|
|
|
tweet: >-
|
2018-01-02 00:00:45 +00:00
|
|
|
{{ [
|
|
|
|
"The ISS is above me right now!",
|
|
|
|
"The International Space Station flys by once a day & that time is NOW! (For me)",
|
2018-01-06 04:07:40 +00:00
|
|
|
"I can look up RIGHT NOW and see the International Space Station.",
|
2018-02-11 15:40:13 +00:00
|
|
|
"The #ISS just flew by and there is 1 Starman driving a #Tesla and {{states.binary_sensor.iss.attributes.number_of_people_in_space}} people in",
|
2018-01-07 15:35:32 +00:00
|
|
|
"The #ISS just flew by and there are {{states.binary_sensor.iss.attributes.number_of_people_in_space}} people in",
|
2018-01-02 00:00:45 +00:00
|
|
|
"The International Space Station Rocks! And it's above me RIGHT NOW!"
|
|
|
|
] | random + " #Space"}}
|
2018-03-17 16:47:27 +00:00
|
|
|
image: >-
|
|
|
|
{{ [
|
|
|
|
"/config/www/custom_ui/floorplan/images/branding/space.png",
|
|
|
|
"/config/www/custom_ui/floorplan/images/branding/space2.png",
|
|
|
|
"/config/www/custom_ui/floorplan/images/branding/starman.png"
|
|
|
|
] | random }}
|
2018-12-05 19:36:54 +00:00
|
|
|
|
2018-01-02 00:00:45 +00:00
|
|
|
- alias: 'Full Moon -Tweet'
|
|
|
|
trigger:
|
|
|
|
- platform: state
|
|
|
|
entity_id: sensor.moon
|
|
|
|
to: 'Full Moon'
|
|
|
|
action:
|
2018-06-14 19:33:39 +00:00
|
|
|
- delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
|
2018-03-17 16:47:27 +00:00
|
|
|
- service: script.tweet_engine_image
|
2018-01-02 00:00:45 +00:00
|
|
|
data_template:
|
2018-03-17 16:47:27 +00:00
|
|
|
tweet: >-
|
2018-01-02 00:00:45 +00:00
|
|
|
{{ [
|
|
|
|
"There is a Full Moon out tonight!",
|
|
|
|
"Wish my solar panels picked up Moon rays. Full Moon out tonight.",
|
2019-11-24 17:14:12 +00:00
|
|
|
"The moon is huge! And full. ",
|
2018-01-02 00:00:45 +00:00
|
|
|
"Turn down the lights, there is a Full Moon out tonight.",
|
2019-11-24 17:14:12 +00:00
|
|
|
"If you want to see the full moon, tonight is the night.",
|
2019-11-24 17:16:24 +00:00
|
|
|
"Get out your telescopes, it will be a Full Moon out tonight!",
|
2019-11-24 17:14:12 +00:00
|
|
|
"Not a half moon, Not a quarter moon. There is a FULL moon out tonight."
|
2018-01-02 00:00:45 +00:00
|
|
|
] | random + "#Space"}}
|
2018-03-17 16:47:27 +00:00
|
|
|
image: >-
|
|
|
|
{{ [
|
|
|
|
"/config/www/custom_ui/floorplan/images/branding/moon.png",
|
|
|
|
"/config/www/custom_ui/floorplan/images/branding/moon2.png",
|
|
|
|
"/config/www/custom_ui/floorplan/images/branding/moon3.png",
|
|
|
|
"/config/www/custom_ui/floorplan/images/branding/starman.png"
|
|
|
|
] | random }}
|