Coder Social home page Coder Social logo

djtimca / hasatellitetracker Goto Github PK

View Code? Open in Web Editor NEW
19.0 3.0 4.0 42 KB

Using the N2YO API, this Home Assistant integration will provide visible satellite passes (general) and to add specific satellites for monitoring.

License: Apache License 2.0

Python 100.00%
home-assistant home-assistant-hacs satellite-tracker iss international-space-station starlink visible-passes satellite tracking-satellites

hasatellitetracker's Introduction

Home Assistant Custom Component Tracking Satellites

Buy me a coffee hacs_badge

Using the N2YO API, this Home Assistant integration provides visible satellite passes (general) and to add specific satellites for monitoring.

You will need to register for an API Key at https://n2yo.com/api/.

Installation

To install this integration you will need to add https://github.com/djtimca/hasatellitetracker as a custom repository in HACS.

Once installed you will be able to install the integration from the HACS integrations page.

Restart your Home Assistant to complete the installation.

Configuration

Go to Configuration -> Integrations and click the plus sign to add a Satellite Tracker integration. Search for Satellite Tracker (N2YO) and click add.

You will first need to enter your API key.

Second you will choose the type of integration you want to install:

Location

A location integration will add a single sensor which will show you the number of satellites which are currently overhead, and in the attributes will list the satellites and their current positions.

If you select this option, on the next page you will enter:

  • The name of the location you are tracking (default: the name of your Home Assistant instance)
  • The category of satellites you want to track (default: all)
  • The latitude of the location you want to track above (default: your Home Assistant latitude)
  • The longitude of the location you want to track above (default: your Home Assistant longitude)
  • The elevation of the location you want to track above (default: your Home Assistant elevation)

Satellite

A satellite integration will add 5 sensors for the next visible passes and a device tracker sensor to allow you to plot the current location of a specific satellite on your map.

If you select this option, on the next page you will enter:

  • The name of the satellite you want to track (default: International Space Station (ISS))
  • The NORAD ID (from n2yo.com) you want to track (default: 25544 for the ISS)
  • The latitude for visible pass tracking (default: Your Home Assistant latitude)
  • The longitude for visible pass tracking (default: Your Home Assistant longitude)
  • The elevation for visible pass tracking (default: Your Home Assistant elevation)

Options

One you have set up an instance of the integration you also have additional options which can be configured by clicking "Options" on the integration.

Location Integrations

  • You can set the update interval in seconds for polling.
  • You can specify the radius (degrees) for tracking satellites above (default 90).

Satellite Integrations

  • You can set the update interval in seconds for polling.
  • You can specify the minimum number of seconds you want to have for a visible pass.

Important Note

The N2YO API is rate limited to 1000 transactions per hour. Adding a large number of integrations or setting your polling / update interval too low may result in your API key from being suspended or banned.

hasatellitetracker's People

Contributors

djtimca avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hasatellitetracker's Issues

Do you want me to add GitHub actions?

If you want, I can add some advanced CI to your repo in a PR. Let me know if you want that.

  • Do you want to enable auto-formatting?
  • Do you want packaged or independent (I recommend packaged because I can send updates)?

Sensor attributes exceed 16384 bytes

Seems that the sensor size exceeds 16kB.
Is there a workaroung to avoid this warning message?

State attributes for sensor.home_overhead_satellites exceed maximum size of 16384 bytes. This can cause database performance issues; Attributes will not be stored

Log: Unexpected error fetching

Hi i have this many times in Log

This error originated from a custom integration.

Logger: custom_components.satellitetracker
Source: helpers/update_coordinator.py:315
integration: N2YO Satellite Tracker (documentation, issues)
First occurred: May 14, 2024 at 13:10:21 (59 occurrences)
Last logged: 11:44:20

Unexpected error fetching International Space Station (ISS) data
Unexpected error fetching skCUBE data
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/n2yoasync/init.py", line 82, in get_api
async with self.session.get(
File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1197, in aenter
self._resp = await self._coro
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 608, in _request
await resp.start(conn)
File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 976, in start
message, payload = await protocol.read() # type: ignore[union-attr]
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/streams.py", line 640, in read
await self._waiter
aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/config/custom_components/satellitetracker/init.py", line 252, in _async_update_data
positions_data = await self.api.get_positions(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/n2yoasync/init.py", line 155, in get_positions
response = await self.get_api(f"positions/{id}/{latitude}/{longitude}/{altitude}/{seconds}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/n2yoasync/init.py", line 88, in get_api
raise ConnectionError(error)
ConnectionError: Server disconnected

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/satellitetracker/init.py", line 275, in _async_update_data
raise PlatformNotReady from error
homeassistant.exceptions.PlatformNotReady: Server disconnected

Too many attributes

The sensor is giving me 25k sats. I have polling at 600 to not saturate the API and a 90m radius. I doubt there are that many sats above me. Am I doing something wrong because when I click on atributes it crashes HA.

Cheers

Problems calling async_forward_entry_setup

Receiving 2 seemingly related errors at startup:

2024-07-04 09:56:56.317 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'satellitetracker' calls async_forward_entry_setup for integration, satellitetracker with title: Starlink and entry_id: 7bcdce6f6d8a6f50bff8e889533410f5, which is deprecated and will stop working in Home Assistant 2025.6, await async_forward_entry_setups instead at custom_components/satellitetracker/__init__.py, line 128: hass.async_create_task(, please create a bug report at https://github.com/djtimca/hasatellitetracker/issues
2024-07-04 09:56:56.329 WARNING (MainThread) [homeassistant.helpers.frame] Detected code that calls async_forward_entry_setup for integration satellitetracker with title: Starlink and entry_id: 7bcdce6f6d8a6f50bff8e889533410f5, during setup without awaiting async_forward_entry_setup, which can cause the setup lock to be released before the setup is done. This will stop working in Home Assistant 2025.1. Please report this issue.
Stack (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module>
    sys.exit(main())
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main
    exit_code = runner.run(runtime_conf)
  File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run
    return loop.run_until_complete(setup_and_run_hass(runtime_config))
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once
    handle._run()
  File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2122, in async_forward_entry_setup
    _report_non_awaited_platform_forwards(entry, "async_forward_entry_setup")
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1175, in _report_non_awaited_platform_forwards
    report(
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 151, in report
    _LOGGER.warning(msg, stack_info=True)

IndexError: list index out of range

Hi All,

I see many errors in my log:

I use add-on 0.0.4 on HA 2020.12.2

2021-01-05 18:35:26 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 119, in _handle_refresh_interval
    await self.async_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 193, in async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 245, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state
    sstate = self.state
  File "/usr/src/homeassistant/homeassistant/components/binary_sensor/__init__.py", line 158, in state
    return STATE_ON if self.is_on else STATE_OFF
  File "/config/custom_components/satellitetracker/binary_sensor.py", line 116, in is_on
    next_pass = self.coordinator.data["visual_passes"][0]
IndexError: list index out of range

Device State Attribute

2022-01-17 18:16:43 WARNING (MainThread) [homeassistant.helpers.entity] Entity binary_sensor.international_space_station_iss_10_minute_pass_warning (<class 'custom_components.satellitetracker.binary_sensor.SatellitePassSensor'>) implements device_state_attributes. Please report it to the custom component author.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.