Skip to content

New: Threema Integration#165787

Closed
LukasQ wants to merge 1 commit intohome-assistant:devfrom
LukasQ:feature/threema
Closed

New: Threema Integration#165787
LukasQ wants to merge 1 commit intohome-assistant:devfrom
LukasQ:feature/threema

Conversation

@LukasQ
Copy link
Copy Markdown

@LukasQ LukasQ commented Mar 17, 2026

Breaking change

Proposed change

My first core PR 🥳

Privacy matters. Threema is one of the few messengers that doesn't require a phone number, is fully end-to-end encrypted by default, and is open source. With over 12 million users — especially popular in the DACH region — it's a natural fit for Home Assistant
This integration brings Threema Gateway support to HA Core, enabling users to send secure text messages from their automations. It supports both E2E encrypted and simple transport modes, key pair generation during setup, and a QR code entity for identity verification — staying true to Threema's security-first philosophy.

What's included:

  • Config flow with credential validation, key generation, and reauthentication
  • threema.send_message service (E2E encrypted or simple mode) - QR code image entity for gateway identity verification
  • Full test coverage (config flow, setup/unload, service calls, error handling, image platform)
  • Silver quality scale compliance

What's not included (intentionally)

  • No notify entity — NotifyEntity.async_send_message doesn't support recipients, and Threema always requires one. The custom service is the right interface here. Built on the official SDK. Depends on threema.gateway==8.0.0 and qrcode==8.2

Additional developer related info is added to the readme.md, including a small roadmap.

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:

Copilot AI review requested due to automatic review settings March 17, 2026 12:07
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.

Hi @HoneysHope

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant
Copy link
Copy Markdown

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@LukasQ LukasQ changed the title Feature/threema New: Threema Integration Mar 17, 2026
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 Threema Gateway integration to Home Assistant Core, enabling secure (optionally E2E) outbound messaging via a dedicated threema.send_message service and a QR-code image entity for gateway identity verification.

Changes:

  • Implement Threema integration core: config flow (including key generation + reauth), API client, service registration, and an image platform for gateway QR code.
  • Add full test suite covering config flow, setup/unload, service calls, error handling, and image entity behavior.
  • Register new dependencies (threema.gateway, qrcode) and update generated integration indexes / strict typing configuration.

Reviewed changes

Copilot reviewed 18 out of 20 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/components/threema/init.py Adds test package marker for the new integration tests.
tests/components/threema/conftest.py Provides fixtures for config entries, gateway connection mocking, and integration setup.
tests/components/threema/test_config_flow.py Tests user setup flows (existing/new gateway), validation, and reauthentication.
tests/components/threema/test_image.py Tests QR-code image entity creation and availability behavior.
tests/components/threema/test_init.py Tests integration setup/unload and send_message service behavior and errors.
requirements_all.txt Adds runtime dependencies for the new integration.
requirements_test_all.txt Adds test environment dependencies for the new integration.
homeassistant/generated/integrations.json Registers the new integration in generated integration metadata.
homeassistant/generated/config_flows.py Registers threema as having a config flow.
homeassistant/components/threema/strings.json Adds translations for config flow, service, entity, and exception messages.
homeassistant/components/threema/services.yaml Declares the threema.send_message service schema/selectors.
homeassistant/components/threema/quality_scale.yaml Declares Integration Quality Scale compliance/exemptions.
homeassistant/components/threema/manifest.json Adds manifest metadata and requirements for the integration.
homeassistant/components/threema/const.py Introduces integration constants and config keys.
homeassistant/components/threema/client.py Implements Threema Gateway SDK wrapper: credential validation, send, and key generation.
homeassistant/components/threema/config_flow.py Implements setup flow (existing/new), key generation, validation, and reauth.
homeassistant/components/threema/image.py Implements QR-code ImageEntity for gateway identity verification.
homeassistant/components/threema/init.py Sets up the integration entry and registers the send_message service.
homeassistant/components/threema/README.md Adds integration-specific usage and developer-facing notes/roadmap.
.strict-typing Enables strict typing checks for the new integration module.

You can also share your feedback on Copilot code review. Take the survey.

self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Generate keys for a new Gateway ID."""
if user_input is not None:
Comment on lines +148 to +163
if self._private_key:
schema = vol.Schema(
{
vol.Required(CONF_GATEWAY_ID): str,
vol.Required(CONF_API_SECRET): str,
}
)
else:
schema = vol.Schema(
{
vol.Required(CONF_GATEWAY_ID): str,
vol.Required(CONF_API_SECRET): str,
vol.Optional(CONF_PRIVATE_KEY): str,
vol.Optional(CONF_PUBLIC_KEY): str,
}
)
@LukasQ
Copy link
Copy Markdown
Author

LukasQ commented Mar 17, 2026

Link to documentation pull request: home-assistant/home-assistant.io#44160
Link to the brands pull request: home-assistant/brands#9994

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.

Hi @HoneysHope

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

Copilot AI review requested due to automatic review settings March 17, 2026 13:23
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.

Hi @HoneysHope

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

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 Home Assistant Core integration for sending messages via Threema Gateway, including config flow onboarding/reauth, a threema.send_message service, and an optional QR-code image entity for gateway identity verification.

Changes:

  • Introduces the threema integration (client, config flow, service registration, image platform, translations, quality scale metadata).
  • Adds full test suite coverage for setup/unload, config flow paths, service behavior, and image entity creation.
  • Registers new dependencies and updates generated integration/config-flow indices.

Reviewed changes

Copilot reviewed 18 out of 20 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
homeassistant/components/threema/init.py Integration setup/entry setup and threema.send_message service implementation
homeassistant/components/threema/client.py Threema Gateway client wrapper (credential validation, send message, key generation)
homeassistant/components/threema/config_flow.py Config flow for existing/new gateway setup + reauthentication
homeassistant/components/threema/const.py Integration constants
homeassistant/components/threema/image.py QR-code ImageEntity platform for gateway public key verification
homeassistant/components/threema/manifest.json Integration metadata + requirements
homeassistant/components/threema/quality_scale.yaml Quality Scale self-assessment
homeassistant/components/threema/services.yaml Service schema metadata for UI
homeassistant/components/threema/strings.json Translations (config flow, exceptions, entity/service strings)
homeassistant/components/threema/README.md Integration developer/user notes (in-repo)
tests/components/threema/init.py Test package marker
tests/components/threema/conftest.py Threema test fixtures and mocks
tests/components/threema/test_config_flow.py Config flow test coverage
tests/components/threema/test_image.py Image platform test coverage
tests/components/threema/test_init.py Setup/unload and service-call test coverage
requirements_all.txt Adds qrcode and threema.gateway dependencies
requirements_test_all.txt Adds test requirements for the integration dependencies
homeassistant/generated/integrations.json Registers the new integration in generated metadata
homeassistant/generated/config_flows.py Registers the new config flow domain
.strict-typing Enables strict typing checks for homeassistant.components.threema.*

You can also share your feedback on Copilot code review. Take the survey.

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.

Hi @HoneysHope

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

Copilot AI review requested due to automatic review settings March 17, 2026 14:01
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.

Hi @HoneysHope

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

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.

Hi @HoneysHope

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

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 Home Assistant Core integration for sending Threema Gateway messages, including config flow setup and an optional QR-code image entity for identity verification.

Changes:

  • Introduces the threema integration (client, config flow, service registration, and image platform).
  • Adds dependencies (threema.gateway, qrcode) and updates generated integration/config-flow registries.
  • Adds a full test suite for config flow, setup/unload, service calls, and image entity creation/availability.

Reviewed changes

Copilot reviewed 19 out of 21 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
homeassistant/components/threema/__init__.py Registers the integration, sets up config entries, and adds the threema.send_message service.
homeassistant/components/threema/client.py Implements Threema Gateway connection, credential validation, and message sending.
homeassistant/components/threema/config_flow.py Implements config flow for existing/new gateway setup and reauthentication.
homeassistant/components/threema/const.py Adds integration constants and config keys.
homeassistant/components/threema/image.py Adds an image entity that generates a gateway verification QR code.
homeassistant/components/threema/icons.json Adds service icon metadata.
homeassistant/components/threema/manifest.json Declares integration metadata and runtime requirements.
homeassistant/components/threema/quality_scale.yaml Declares quality scale rule compliance status for the integration.
homeassistant/components/threema/services.yaml Declares UI selectors for the send_message service fields.
homeassistant/components/threema/strings.json Adds translations for config flow, services, entity name, and exceptions.
homeassistant/components/threema/README.md Adds integration documentation/roadmap (in-repo).
homeassistant/generated/config_flows.py Registers threema as having a config flow (generated file update).
homeassistant/generated/integrations.json Registers the new integration metadata (generated file update).
requirements_all.txt Adds integration dependencies to the full requirements set.
requirements_test_all.txt Adds integration dependencies to the test requirements set.
.strict-typing Enables strict typing for the new integration module.
tests/components/threema/__init__.py Adds test package marker for threema tests.
tests/components/threema/conftest.py Adds fixtures for config entries, gateway connection, and message sending mocks.
tests/components/threema/test_config_flow.py Adds config flow tests for existing/new setup and reauth scenarios.
tests/components/threema/test_image.py Adds tests for QR image entity creation and availability.
tests/components/threema/test_init.py Adds tests for setup/unload and service behavior/error handling.

You can also share your feedback on Copilot code review. Take the survey.

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.

Hi @HoneysHope

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

Copilot AI review requested due to automatic review settings March 18, 2026 07:53
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.

Hi @HoneysHope

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

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

This PR introduces a new Threema Gateway integration to Home Assistant Core, enabling automations/scripts to send Threema messages via the official Gateway API, including optional E2E mode and a QR-code image entity for key verification.

Changes:

  • Adds the Threema integration (config flow, runtime client, service, and QR-code image platform).
  • Introduces full test scaffolding for config flow, setup/unload, services, and image entity behavior.
  • Registers new dependencies and enables strict typing/mypy settings for the new integration.

Reviewed changes

Copilot reviewed 21 out of 23 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/components/threema/init.py Declares the Threema test package.
tests/components/threema/conftest.py Adds fixtures for config entries, gateway connection, and message send mocks.
tests/components/threema/test_config_flow.py Covers user flow, key generation, credential validation, and reauth flows.
tests/components/threema/test_image.py Tests QR-code image entity creation and availability behavior.
tests/components/threema/test_init.py Tests config entry setup/unload and threema.send_message service behavior.
requirements_test_all.txt Adds qrcode and threema.gateway to the test requirements set.
requirements_all.txt Adds qrcode and threema.gateway to the full requirements set.
mypy.ini Enables strict mypy settings for homeassistant.components.threema.*.
homeassistant/generated/integrations.json Registers the new threema integration metadata.
homeassistant/generated/config_flows.py Adds threema to the generated config flow list.
homeassistant/components/threema/strings.json Adds config flow/service/entity strings and translated exception messages.
homeassistant/components/threema/services.yaml Declares threema.send_message service fields and selectors.
homeassistant/components/threema/quality_scale.yaml Declares (claimed) quality scale compliance status/exemptions.
homeassistant/components/threema/manifest.json Defines the integration manifest and runtime dependencies.
homeassistant/components/threema/image.py Implements an ImageEntity that renders the gateway verification QR code.
homeassistant/components/threema/icons.json Defines a service icon for send_message.
homeassistant/components/threema/const.py Adds integration constants and config keys.
homeassistant/components/threema/config_flow.py Implements user setup (existing/new), credential validation, and reauth.
homeassistant/components/threema/client.py Wraps threema.gateway SDK for credential validation, send, and key generation.
homeassistant/components/threema/init.py Sets up config entries and registers the send_message service.
homeassistant/components/threema/README.md Adds integration-specific README/roadmap and usage notes.
CODEOWNERS Adds ownership entries for the new integration and its tests.
.strict-typing Adds homeassistant.components.threema.* to strict typing enforcement.

You can also share your feedback on Copilot code review. Take the survey.

@home-assistant home-assistant bot dismissed stale reviews from themself March 18, 2026 14:42

Stale

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 Home Assistant Core integration for the Threema Gateway, allowing users to send Threema messages via a dedicated service and optionally expose a QR-code image entity for gateway identity verification.

Changes:

  • Introduces the threema integration with config flow (incl. key generation) and a threema.send_message service.
  • Adds an ImageEntity that generates and exposes a QR code when a public key is configured.
  • Adds dependencies, strict-typing/mypy configuration, generated metadata updates, and a comprehensive initial test suite.

Reviewed changes

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

Show a summary per file
File Description
homeassistant/components/threema/init.py Component setup, config-entry setup/unload, and send_message service implementation
homeassistant/components/threema/client.py Threema Gateway client wrapper (credential validation, send message, key generation)
homeassistant/components/threema/config_flow.py Config flow for existing/new gateway setup and reauthentication
homeassistant/components/threema/const.py Integration constants
homeassistant/components/threema/image.py QR code ImageEntity implementation
homeassistant/components/threema/icons.json Service icon definition
homeassistant/components/threema/manifest.json Integration manifest, requirements, metadata
homeassistant/components/threema/quality_scale.yaml Quality scale self-assessment
homeassistant/components/threema/services.yaml Service field selectors for UI
homeassistant/components/threema/strings.json Translations for config flow, services, and exceptions
homeassistant/components/threema/README.md Developer/user-facing integration notes and examples
tests/components/threema/init.py Test package marker
tests/components/threema/conftest.py Shared fixtures for Threema tests
tests/components/threema/test_config_flow.py Config flow and reauth tests
tests/components/threema/test_image.py QR code image entity tests
tests/components/threema/test_init.py Setup/unload and service-call tests
requirements_all.txt Adds runtime dependencies for the integration
requirements_test_all.txt Adds test dependencies for the integration
mypy.ini Enables strict mypy settings for homeassistant.components.threema.*
.strict-typing Enforces strict typing for the new integration package
homeassistant/generated/config_flows.py Adds threema to generated config flow list
homeassistant/generated/integrations.json Registers integration metadata in generated integrations index
CODEOWNERS Assigns code ownership for integration and its tests

You can also share your feedback on Copilot code review. Take the survey.

@LukasQ
Copy link
Copy Markdown
Author

LukasQ commented Mar 18, 2026

Tests pass, only the Renault integrations' tests fail, Copilot Comments are resolved.
What now?

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.

Hi @HoneysHope

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant home-assistant bot marked this pull request as draft March 19, 2026 06:31
@LukasQ LukasQ marked this pull request as ready for review March 19, 2026 06:32
Copilot AI review requested due to automatic review settings March 19, 2026 06:32
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 Home Assistant Core integration (threema) to send Threema Gateway text messages (simple or E2E based on configured keys) and optionally expose a QR-code image entity for gateway identity verification.

Changes:

  • Introduces the Threema integration with config flow (including reauth), client wrapper, service registration, and an image platform for a gateway QR code.
  • Adds translations (strings.json), service schema (services.yaml), icons, manifest, and quality scale metadata; registers the integration in generated files.
  • Adds comprehensive tests for config flow, setup/unload, service behavior, and image entity behavior; adds new third-party requirements and strict typing config.

Reviewed changes

Copilot reviewed 21 out of 23 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
homeassistant/components/threema/__init__.py Integration setup, config entry setup/unload, and threema.send_message service handler.
homeassistant/components/threema/client.py Threema Gateway API wrapper (credential validation, message sending, key generation).
homeassistant/components/threema/config_flow.py User setup flow (existing/new), credential validation, and reauthentication flow.
homeassistant/components/threema/const.py Integration constants.
homeassistant/components/threema/image.py QR code ImageEntity generation from the configured public key.
homeassistant/components/threema/icons.json Service icon definition.
homeassistant/components/threema/manifest.json Integration metadata and dependencies.
homeassistant/components/threema/quality_scale.yaml Quality scale checklist/status for the integration.
homeassistant/components/threema/services.yaml Service field selectors for send_message.
homeassistant/components/threema/strings.json Config flow, entity, service, and exception translations.
homeassistant/components/threema/README.md Additional integration documentation included in-core.
tests/components/threema/__init__.py Test package marker for the integration.
tests/components/threema/conftest.py Shared fixtures for Threema integration tests.
tests/components/threema/test_config_flow.py Config flow + reauth tests.
tests/components/threema/test_image.py QR code image entity tests.
tests/components/threema/test_init.py Setup/unload + service-call tests.
homeassistant/generated/config_flows.py Registers the new integration’s config flow.
homeassistant/generated/integrations.json Adds generated integration metadata entry.
requirements_all.txt Adds qrcode and threema.gateway runtime requirements.
requirements_test_all.txt Adds qrcode and threema.gateway for tests.
mypy.ini Enables strict mypy settings for homeassistant.components.threema.*.
.strict-typing Adds homeassistant.components.threema.* to strict typing set.
CODEOWNERS Adds code ownership for the new integration and tests.

You can also share your feedback on Copilot code review. Take the survey.

Copilot AI review requested due to automatic review settings March 19, 2026 07:44
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.

Hi @HoneysHope

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant home-assistant bot marked this pull request as draft March 19, 2026 07:44
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.

Hi @HoneysHope

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

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 Threema Gateway integration to Home Assistant Core, enabling secure message sending via a dedicated threema.send_message service and optionally exposing a QR-code image entity for gateway identity verification.

Changes:

  • Implemented the Threema integration (config flow, API client, service registration, and QR-code image platform).
  • Added translations, service schema/icons, manifest, quality scale metadata, and strict typing configuration.
  • Added comprehensive tests and updated dependency/ownership/generated metadata files.

Reviewed changes

Copilot reviewed 21 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
homeassistant/components/threema/__init__.py Registers the send_message service and sets up/unloads the config entry.
homeassistant/components/threema/client.py Implements Threema Gateway client (credential validation, sending, key generation).
homeassistant/components/threema/config_flow.py Adds user setup flow (new/existing), credential validation, and reauth handling.
homeassistant/components/threema/const.py Defines integration constants and config keys.
homeassistant/components/threema/image.py Adds QR code ImageEntity for public-key verification.
homeassistant/components/threema/manifest.json Declares integration metadata and requirements.
homeassistant/components/threema/strings.json Provides config flow, service, entity, and exception translations.
homeassistant/components/threema/services.yaml Defines service selectors/fields for UI/service docs.
homeassistant/components/threema/icons.json Adds service icon metadata.
homeassistant/components/threema/quality_scale.yaml Documents quality scale compliance/exemptions.
homeassistant/components/threema/README.md Adds developer/user-facing integration notes and roadmap.
tests/components/threema/conftest.py Provides fixtures for config entries and gateway mocks.
tests/components/threema/test_init.py Tests setup/unload behavior and service call paths/errors.
tests/components/threema/test_config_flow.py Tests config flow (existing/new, validation, reauth, failures).
tests/components/threema/test_image.py Tests QR image entity creation and availability behavior.
tests/components/threema/__init__.py Marks the Threema test package.
requirements_all.txt Adds integration dependencies to the consolidated requirements list.
requirements_test_all.txt Adds integration dependencies to the test requirements list.
mypy.ini Enables strict mypy settings for the new integration package.
.strict-typing Enforces strict typing for homeassistant.components.threema.*.
homeassistant/generated/integrations.json Registers the new integration in generated metadata.
homeassistant/generated/config_flows.py Registers the config flow in generated metadata.
CODEOWNERS Adds code ownership entries for integration and tests.

You can also share your feedback on Copilot code review. Take the survey.

@LukasQ LukasQ marked this pull request as ready for review March 19, 2026 08:11
@LukasQ
Copy link
Copy Markdown
Author

LukasQ commented Mar 19, 2026

The codecov/patch/required check fails due to "Missing Base Report" — the base commit doesn't have coverage data uploaded IMHO. This should resolve after the next merge with dev or when CI re-runs against a base that has coverage. Not a code coverage issue.

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.

There is a merge conflict.

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.

Hi @balloob-travel

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@LukasQ
Copy link
Copy Markdown
Author

LukasQ commented Mar 19, 2026

Sorry for the mentions all, seems like i pushed with a different git config and didn't realize....

Add new integration for Threema Gateway messaging service.
Supports E2E encrypted and simple text messaging, key pair
generation, QR code identity verification, and reauthentication.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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 Home Assistant Core integration for sending messages via the Threema Gateway, including config flow setup (with optional key generation), a threema.send_message service, and an optional QR-code image entity for identity verification.

Changes:

  • Introduces the threema integration (config flow, client, service registration, QR image platform, translations, manifest, quality scale).
  • Adds full test coverage for config flow, setup/unload, service behavior, and image entity creation.
  • Updates generated integration metadata and adds new third-party requirements.

Reviewed changes

Copilot reviewed 21 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
homeassistant/components/threema/__init__.py Registers the send_message service and sets up/unloads the config entry + image platform.
homeassistant/components/threema/client.py Wraps the Threema Gateway SDK for credential validation, message sending, and key generation.
homeassistant/components/threema/config_flow.py Implements user setup (existing/new), credential validation, and reauth flow.
homeassistant/components/threema/image.py Adds a QR-code ImageEntity for gateway identity verification when a public key is present.
homeassistant/components/threema/manifest.json Declares integration metadata and pins qrcode + threema.gateway.
homeassistant/components/threema/strings.json / icons.json / services.yaml Service + config flow translations and service selector metadata.
homeassistant/components/threema/quality_scale.yaml Declares quality scale compliance for the new integration.
homeassistant/components/threema/README.md Adds a README (currently mostly end-user oriented).
tests/components/threema/* Adds fixtures and tests for config flow, init/setup, service calls, and image platform.
requirements_all.txt / requirements_test_all.txt Adds Threema dependencies and also bumps several unrelated packages.
homeassistant/generated/* Registers the new integration in generated metadata.
mypy.ini / .strict-typing Enables strict typing settings for homeassistant.components.threema.*.
CODEOWNERS Adds Threema ownership, but also removes Starlink ownership lines.
Comments suppressed due to low confidence (3)

CODEOWNERS:1620

  • The Starlink CODEOWNERS entries were removed, but the Starlink integration (/homeassistant/components/starlink/) still exists. This would orphan that integration from review ownership; please restore the removed Starlink lines (or update them intentionally in a dedicated PR).
/homeassistant/components/starline/ @anonym-tsk
/tests/components/starline/ @anonym-tsk
/homeassistant/components/starlink/ @boswelja
/tests/components/starlink/ @boswelja

requirements_all.txt:280

  • This requirements update includes multiple unrelated dependency version bumps (e.g., aiohasupervisor/axis/pysmartthings/python-roborock/pyweatherflowudp/victron-ble-ha-parser) in a PR whose stated purpose is adding the Threema integration. Please revert unrelated bumps or split them into a separate dependency-upgrade PR to keep the change focused and easier to review.
aioharmony==0.5.3

# homeassistant.components.hassio
aiohasupervisor==0.4.1

requirements_test_all.txt:270

  • This requirements update includes multiple unrelated dependency version bumps (e.g., aiohasupervisor/axis/pysmartthings/python-roborock/pyweatherflowudp/victron-ble-ha-parser) in a PR whose stated purpose is adding the Threema integration. Please revert unrelated bumps or split them into a separate dependency-upgrade PR to keep the change focused and easier to review.
aioharmony==0.5.3

# homeassistant.components.hassio
aiohasupervisor==0.4.1

# homeassistant.components.home_connect
aiohomeconnect==0.32.0

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +102 to +110
except ThreemaAuthError as err:
_LOGGER.warning(
"Authentication failed sending message; check your Gateway credentials"
)
raise HomeAssistantError(
translation_domain=DOMAIN,
translation_key="send_error",
translation_placeholders={"error": str(err)},
) from err
Comment on lines +52 to +56
async def async_added_to_hass(self) -> None:
"""Generate QR code when entity is added to hass."""
await super().async_added_to_hass()
await self.hass.async_add_executor_job(self._generate_qr_code)
if self._qr_image_bytes is not None:
Comment on lines +1 to +53
# Threema Gateway Integration for Home Assistant

Send secure, end-to-end encrypted messages from Home Assistant to any Threema user using the Threema Gateway service.

## What is Threema Gateway?

[Threema Gateway](https://gateway.threema.ch/) allows you to send Threema messages programmatically. This integration enables Home Assistant to send notifications and alerts to Threema users.

**Common Use Cases:**
- Security alerts (door/window sensors)
- Temperature warnings
- System notifications
- Daily summaries

## Prerequisites

1. **Threema Gateway Account** - Sign up at [gateway.threema.ch](https://gateway.threema.ch/)
2. **Gateway Credentials** - You'll receive a Gateway ID (starts with `*`) and API Secret
3. **Message Credits** - Purchase credits to send messages

## Installation

### Step 1: Add Integration

1. Go to **Settings** > **Devices & Services**
2. Click **+ Add Integration**
3. Search for **"Threema"**
4. Follow the setup wizard

### Step 2: Choose Setup Type

#### Option A: Create NEW Gateway ID (Recommended for E2E)
1. Select "Create NEW Gateway ID"
2. Home Assistant generates a key pair
3. **Copy the public key** shown on screen (hex part only, without `public:` prefix)
4. Go to https://gateway.threema.ch/ and create an **End-to-End Gateway ID**
5. **Paste the public key** during registration
6. Return to Home Assistant, enter your new Gateway ID and API Secret
7. Keys are automatically stored

#### Option B: Use EXISTING Gateway ID
1. Select "Use EXISTING Gateway ID"
2. Enter your Gateway ID and API Secret
3. **For E2E mode:** Also enter your private key (format: `private:abc123def456...`)
4. **Optionally:** Enter your public key (format: `public:def456abc123...`)
5. **For Basic mode:** Leave key fields empty

**Key Format Examples:**
```
Private Key: private:1a2b3c4d5e6f7890abcdef1234567890...
Public Key: public:9876543210fedcba0987654321fedcba...
```

@MartinHjelmare
Copy link
Copy Markdown
Member

MartinHjelmare commented Mar 19, 2026

Please open a new PR so we don't keep spamming all that have now been targeted as notified to this thread.

@LukasQ LukasQ mentioned this pull request Mar 19, 2026
21 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants