Skip to content

Add eveonline integration#166674

Open
ronaldvdmeer wants to merge 48 commits intohome-assistant:devfrom
ronaldvdmeer:add-eveonline-integration
Open

Add eveonline integration#166674
ronaldvdmeer wants to merge 48 commits intohome-assistant:devfrom
ronaldvdmeer:add-eveonline-integration

Conversation

@ronaldvdmeer
Copy link
Copy Markdown
Contributor

@ronaldvdmeer ronaldvdmeer commented Mar 27, 2026

Proposed change

Add a new integration for Eve Online, a massively multiplayer online game by CCP Games. This integration connects to the Eve Swagger Interface (ESI) API via OAuth2 (Eve SSO) to provide character data as sensors in Home Assistant.

The code has been written with the platinum quality scale in mind (including strict typing, exception translations, icon translations, entity categories, and full test coverage), but the quality scale is set to bronze as required for new integrations.

Entities

Character sensors (14):

  • Location, Ship, Wallet balance, Total SP, Unallocated SP
  • Skill queue count, Current training skill, Current skill finish
  • Unread mail, Industry jobs, Next industry finish
  • Sell orders, Buy orders, Jump fatigue

The integration uses the python-eveonline library (v0.4.0) and implements OAuth2 via Application Credentials. It supports multiple characters and reconfiguration.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

Add a new integration for Eve Online (eveonline) that uses OAuth2
via EVE SSO application credentials to connect to the EVE Swagger
Interface (ESI) API.

Platform: sensor (16 sensors)
- 2 server sensors: players online, server version
- 14 character sensors: location, ship, wallet, skills, skill queue,
  mail, industry jobs, market orders, jump fatigue, and more

Uses the python-eveonline library (v0.2.1) for all ESI API communication.
Quality scale: bronze.
Add binary_sensor platform with 2 sensors:
- Character online (connectivity device class)
- Server VIP mode (diagnostic, disabled by default)

Also adds corresponding tests and translations.
- Add loggers to manifest.json
- Add PARALLEL_UPDATES = 0 to sensor and binary_sensor platforms
- Implement reauthentication flow (reauth_confirm step + OAuth2)
- Implement reconfiguration flow
- Add exception translations (authentication_failed, update_failed,
  oauth2_implementation_unavailable)
- Create diagnostics.py with redacted config entry data
- Create icons.json with mdi icons for all entities
- Add strict typing to .strict-typing
- Update quality_scale.yaml: all rules done or exempt
- Update manifest quality_scale to platinum
- Add tests: reauth, reauth mismatch, reconfigure, diagnostics, auth error
- 18 tests passing
Copy link
Copy Markdown

@home-assistant home-assistant bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new eveonline Home Assistant integration that authenticates via Eve SSO (OAuth2 / application_credentials) and exposes Tranquility server status plus per-character telemetry as sensors and binary sensors.

Changes:

  • Introduces the new homeassistant.components.eveonline integration (OAuth2 config flow, coordinator, entities, sensors/binary_sensors, diagnostics, translations/icons, manifest/quality scale).
  • Adds comprehensive test coverage for config flow, setup/unload, entities, and diagnostics (including snapshots).
  • Registers the integration across generated registries, strict typing/mypy settings, code ownership, and requirements lists.

Reviewed changes

Copilot reviewed 27 out of 30 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
homeassistant/components/eveonline/init.py Sets up platforms and OAuth2 session/client wiring; forwards entry setups.
homeassistant/components/eveonline/api.py Implements EveOnline auth adapter backed by HA OAuth2Session.
homeassistant/components/eveonline/application_credentials.py Declares the Eve SSO authorization/token endpoints for application_credentials.
homeassistant/components/eveonline/binary_sensor.py Adds server + character binary sensors backed by the coordinator.
homeassistant/components/eveonline/config_flow.py Implements OAuth2 config flow, unique-id handling, reauth/reconfigure.
homeassistant/components/eveonline/const.py Defines domain, OAuth endpoints, and required ESI scopes.
homeassistant/components/eveonline/coordinator.py Polls ESI endpoints and aggregates server + character data.
homeassistant/components/eveonline/diagnostics.py Provides diagnostics payload and redaction.
homeassistant/components/eveonline/entity.py Defines base entities and device registry metadata.
homeassistant/components/eveonline/icons.json Adds icon mappings for entities.
homeassistant/components/eveonline/manifest.json Declares integration metadata, deps, requirements, and iot_class.
homeassistant/components/eveonline/quality_scale.yaml Documents quality scale rule status for the new integration.
homeassistant/components/eveonline/sensor.py Adds server + character sensors backed by the coordinator.
homeassistant/components/eveonline/strings.json Adds translations for config flow, entity names, and exceptions.
homeassistant/generated/application_credentials.py Registers eveonline as providing application credentials.
homeassistant/generated/config_flows.py Registers eveonline as having a config flow.
homeassistant/generated/integrations.json Adds eveonline integration metadata to generated registry.
tests/components/eveonline/init.py Initializes the test package for the integration.
tests/components/eveonline/conftest.py Provides fixtures for credentials, config entry, and mocked client responses.
tests/components/eveonline/test_binary_sensor.py Validates binary sensor creation, state, and default-disabled behavior.
tests/components/eveonline/test_config_flow.py Validates user flow, duplicate handling, reauth, and reconfigure.
tests/components/eveonline/test_diagnostics.py Validates diagnostics output via snapshot testing.
tests/components/eveonline/test_init.py Validates setup success and error paths, plus unload behavior.
tests/components/eveonline/test_sensor.py Validates sensor values and unavailable states.
tests/components/eveonline/snapshots/test_diagnostics.ambr Snapshot for diagnostics payload.
CODEOWNERS Adds ownership for integration and its tests.
.strict-typing Enforces strict typing for homeassistant.components.eveonline.*.
mypy.ini Adds mypy strictness configuration for the integration package.
requirements_all.txt Adds python-eveonline==0.2.1 to core requirements list.
requirements_test_all.txt Adds python-eveonline==0.2.1 to test requirements list.

Copilot AI review requested due to automatic review settings March 27, 2026 08:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 27 out of 30 changed files in this pull request and generated 5 comments.

Copilot AI review requested due to automatic review settings March 27, 2026 09:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 27 out of 30 changed files in this pull request and generated 4 comments.

- test_config_flow: JWT decode errors (invalid, malformed, missing subject)
- test_config_flow: reconfigure account mismatch
- test_init: network error during setup (aiohttp.ClientError)
- test_init: optional endpoint graceful degradation (EveOnlineError, ClientError)
- test_init: auth error propagation from optional endpoints
- test_init: list endpoint error returns empty lists

Total tests: 27 (was 18)
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 23 out of 26 changed files in this pull request and generated 4 comments.

Copilot AI review requested due to automatic review settings March 30, 2026 21:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 23 out of 26 changed files in this pull request and generated 4 comments.

Copilot AI review requested due to automatic review settings March 30, 2026 22:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 23 out of 26 changed files in this pull request and generated 2 comments.

@ronaldvdmeer
Copy link
Copy Markdown
Contributor Author

ronaldvdmeer commented Mar 30, 2026

Hi @joostlek, thanks for the review! Here's a summary of everything that has been addressed with less complexity in mind:

Your review comments

# Topic Change
1 quality_scale.yaml Marked icon-translations and strict-typing as done
2 available_fn Removed available property — coordinator unavailability is handled by CoordinatorEntity
3 Translated units Switched to UnitOfCurrency.ISK, UnitOfTime.SECONDS, UnitOfInformation.MEGABYTES
4 CONF_ constants Replaced string literals with CONF_CHARACTER_ID, CONF_CHARACTER_NAME
5 Ownership mechanism Removed the EveOnlineAccountManager / shared-client concept entirely
6 Reconfigure Removed the reconfigure flow
7 JWT decode Replaced manual base64/JSON parsing with jwt.decode(..., options={"verify_signature": False})
8 Fewer sensors Removed the server sensors (players_online, server_version) entirely. The integration now only creates one device per character, with 14 character sensors. See comments: #166674 (comment)
9 DOMAIN prefix in unique_id Removed DOMAIN prefix — unique IDs are now just {character_id}_{sensor_key}

Additional fixes (from Copilot review + testing)

  • Server sensors removed: EveOnlineServerEntity, EveOnlineServerSensor, and SERVER_SENSORS are gone — this also eliminates the unique_id collision bug that would occur with multiple characters
  • Coordinator connectivity check: Replaced async_get_server_status() (called once per character, result discarded) with async_get_character_online() as the primary required call that raises UpdateFailed on error
  • token_type key: Fixed "type": "Bearer""token_type": "Bearer" in test fixtures
  • Tests: Parametrized the bad-JWT config flow tests, removed duplicate test_setup_entry_auth_error
  • Translations: Restored sell_orders and ship entries in strings.json and icons.json (accidentally dropped in an earlier edit)

The docs PR is updated separately to remove the server sensors section.

@ronaldvdmeer ronaldvdmeer requested a review from joostlek March 30, 2026 22:33
Copilot AI review requested due to automatic review settings March 31, 2026 09:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 23 out of 26 changed files in this pull request and generated 4 comments.

@ronaldvdmeer ronaldvdmeer marked this pull request as ready for review March 31, 2026 11:28
Copilot AI review requested due to automatic review settings April 2, 2026 20:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 23 out of 26 changed files in this pull request and generated 4 comments.

…s, snapshot tests, parametrize tests

- Fix manifest.json: set integration_type to 'service' (not 'hub')
- quality_scale.yaml: add missing Silver rule config-entry-unloading; fix reauthentication-flow to todo (no async_step_reauth in config_flow)
- conftest.py: use CONF_CHARACTER_ID/CONF_CHARACTER_NAME constants; add init_integration fixture
- test_sensor.py: use snapshot_platform for entity state testing; enable disabled entities before snapshot; add parametrized value test and unavailable sensor test
- test_init.py: use init_integration fixture; merge 3 duplicate optional endpoint error tests into one parametrized test; add missing imports
Copilot AI review requested due to automatic review settings April 4, 2026 21:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 27 changed files in this pull request and generated 1 comment.



@pytest.fixture
def mock_eveonline_client() -> Generator[AsyncMock]:
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the fixture return type annotation to use the full Generator[YieldType, SendType, ReturnType] form (e.g., Generator[AsyncMock, None, None]) to satisfy strict typing and avoid mypy errors.

Suggested change
def mock_eveonline_client() -> Generator[AsyncMock]:
def mock_eveonline_client() -> Generator[AsyncMock, None, None]:

Copilot uses AI. Check for mistakes.
- conftest.py: use .return_value = instead of AsyncMock(return_value=...) — autospec already creates AsyncMock for coroutine methods
- sensor.py: remove redundant round() in wallet_balance value_fn; suggested_display_precision handles display rounding
- quality_scale.yaml: add comment to todo rules (reauthentication-flow, diagnostics, reconfiguration-flow)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants