mirror of
https://github.com/thejeffreystone/home-assistant-configuration.git
synced 2025-08-20 12:46:45 +00:00
v4
This commit is contained in:
89
packages/space.yaml
Normal file
89
packages/space.yaml
Normal file
@@ -0,0 +1,89 @@
|
||||
###############################################################################
|
||||
# @author : Jeffrey Stone
|
||||
# @date : 02/19/2019
|
||||
# @package : Space
|
||||
# @description : Tracking space. Inspiration and code taking from https://github.com/CCOSTAN/Home-AssistantConfig#logo
|
||||
# @original : https://github.com/CCOSTAN/Home-AssistantConfig/blob/master/config/packages/space.yaml
|
||||
###############################################################################
|
||||
|
||||
homeassistant:
|
||||
customize:
|
||||
binary_sensor.iss:
|
||||
icon: mdi:satellite-variant
|
||||
friendly_name: ISS Visibility
|
||||
|
||||
hidden: False
|
||||
homebridge_hidden: true
|
||||
sensor.launch_window:
|
||||
hidden: False
|
||||
icon: mdi:rocket
|
||||
friendly_name: Rocket Launch Window
|
||||
|
||||
binary_sensor:
|
||||
- platform: iss
|
||||
show_on_map: true
|
||||
|
||||
sensor:
|
||||
- platform: moon
|
||||
- platform: launch_library
|
||||
|
||||
- platform: rest
|
||||
scan_interval: 1800
|
||||
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:
|
||||
|
||||
- id: iss_tweet
|
||||
alias: 'ISS Tweet'
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- binary_sensor.iss
|
||||
to: 'on'
|
||||
from: 'off'
|
||||
action:
|
||||
- service: script.twitter_notify
|
||||
data_template:
|
||||
message: >-
|
||||
{{ [
|
||||
"The #ISS is passing over. Wave.",
|
||||
"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",
|
||||
"The #ISS just flew by and there are {{states.binary_sensor.iss.attributes.number_of_people_in_space}} people in"
|
||||
] | random + " #Space #theycanseeourhouse"}}
|
||||
|
||||
- id: full_moon_tweet
|
||||
alias: 'Full Moon -Tweet'
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: sensor.moon
|
||||
to: 'Full Moon'
|
||||
action:
|
||||
- delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
|
||||
- service: script.twitter_notify
|
||||
data_template:
|
||||
message: >-
|
||||
{{ [
|
||||
"There is a Full Moon out tonight, and this time it's the actual moon and not the neighbor.",
|
||||
"Hey look kids, There's the full moon.",
|
||||
"The moon is huge! And full."
|
||||
] | random + "#Space #fullmoon"}}
|
Reference in New Issue
Block a user