Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Home Assistant Core integration for Threema Gateway, enabling secure outbound messaging via a dedicated threema.send_message service and providing a QR-code image entity for gateway identity verification.
Changes:
- Introduces the
threemaintegration (config flow, runtime client, service registration, and image platform). - Adds translations, service metadata, icons, and quality scale declaration for the integration.
- Adds full test suite coverage and registers new dependencies + strict typing configuration.
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 |
Integration setup/unload and send_message service handler |
homeassistant/components/threema/client.py |
Threema Gateway SDK wrapper client + key generation |
homeassistant/components/threema/config_flow.py |
Multi-step config flow including key generation + reauth |
homeassistant/components/threema/const.py |
Integration constants |
homeassistant/components/threema/image.py |
QR code ImageEntity implementation |
homeassistant/components/threema/icons.json |
Service icon metadata |
homeassistant/components/threema/manifest.json |
Integration manifest + requirements |
homeassistant/components/threema/quality_scale.yaml |
Declared quality scale status |
homeassistant/components/threema/services.yaml |
Service schema/selector metadata |
homeassistant/components/threema/strings.json |
Config flow/service/exception translations |
homeassistant/components/threema/README.md |
Developer-focused integration documentation |
tests/components/threema/__init__.py |
Test package marker |
tests/components/threema/conftest.py |
Shared fixtures and mocks for Threema tests |
tests/components/threema/test_config_flow.py |
Config flow + reauth tests |
tests/components/threema/test_image.py |
QR image entity tests |
tests/components/threema/test_init.py |
Setup/unload + service behavior tests |
requirements_all.txt |
Adds runtime dependencies for the integration |
requirements_test_all.txt |
Adds test environment dependencies |
mypy.ini |
Enables strict mypy checks for homeassistant.components.threema.* |
.strict-typing |
Marks integration as strict-typing |
homeassistant/generated/config_flows.py |
Registers config flow domain |
homeassistant/generated/integrations.json |
Adds generated integration metadata |
CODEOWNERS |
Adds code ownership entries for the new integration and tests |
You can also share your feedback on Copilot code review. Take the survey.
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>
good catch. Co-authored-by: Norbert Rittel <norbert@rittel.de>
Co-authored-by: Norbert Rittel <norbert@rittel.de>
There was a problem hiding this comment.
Pull request overview
Adds a new Home Assistant Core integration for the Threema Gateway, enabling automations to send Threema messages (simple transport or E2E) and exposing a QR-code image entity for gateway identity verification.
Changes:
- Implement Threema integration core: config flow (including key generation + reauth), runtime client wrapper, and
threema.send_messageservice. - Add image platform entity that renders the gateway public key as a PNG QR code.
- Add full test suite plus dependency pins, strict typing config, and generated metadata updates.
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 | Registers service, sets up config entries, forwards to image platform |
| homeassistant/components/threema/client.py | Wraps threema.gateway SDK for validation and message sending + key generation |
| homeassistant/components/threema/config_flow.py | Multi-step config flow (existing/new gateway), validation, and reauth |
| homeassistant/components/threema/const.py | Domain and config key constants |
| homeassistant/components/threema/image.py | ImageEntity that generates/stores QR code PNG bytes |
| homeassistant/components/threema/manifest.json | Declares integration metadata, requirements, logging, quality scale |
| homeassistant/components/threema/ गुणवत्ता_scale.yaml | Quality scale status declarations for the new integration |
| homeassistant/components/threema/services.yaml | Service selectors/field requirements for send_message |
| homeassistant/components/threema/strings.json | Config flow/service/entity/exception translations |
| homeassistant/components/threema/icons.json | Service icon mapping |
| homeassistant/components/threema/README.md | Developer-facing integration architecture/decisions notes |
| tests/components/threema/init.py | Test package marker for the integration |
| tests/components/threema/conftest.py | Shared fixtures for config entries and SDK patching |
| tests/components/threema/test_config_flow.py | Config flow test coverage (new/existing/reauth/error paths) |
| tests/components/threema/test_init.py | Setup/unload + service behavior tests |
| tests/components/threema/test_image.py | QR image entity creation/availability tests |
| requirements_all.txt | Adds runtime dependency pins for Threema + QR generation |
| requirements_test_all.txt | Adds test dependency pins for Threema + QR generation |
| mypy.ini | Enables strict mypy settings for homeassistant.components.threema.* |
| .strict-typing | Adds the integration to strict typing enforcement list |
| homeassistant/generated/integrations.json | Registers the new integration in generated metadata |
| homeassistant/generated/config_flows.py | Registers config flow domain in generated list |
| CODEOWNERS | Adds code ownership for integration + tests |
You can also share your feedback on Copilot code review. Take the survey.
joostlek
left a comment
There was a problem hiding this comment.
Hello 👋🏻,
So I would love to know a few things:
- I know Threema as a chat app, what is the gateway qr code supposed to do?
- Please make sure you either include a platform or services, not both. But preferrably a platform as that shows how state is handled in the integration
- The current service has a recipient and a message, I would strongly consider to look at a notify entity. A benefit of using the notify entity is that you can group them and for example send a message to both telegram and threema with a group of notify entities, or send it to alexa if you want to. You would likely have to look into subentries for this one, given that we need to know the recipients before we can create the entity.
- What's the idea behind the client.py? Ideally we have all device specific logic in a library hosted on pypi, and not in the integration
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
QR Code displays the gateway's public key in Threema's 3mid: verification format. Users scan it with the Threema app to verify the gateway's identity — the three green dots confirming authenticity. Same verification mechanism as Threema's contact verification.
Platform vs Service / Notify Entity: I originally used a service because I'm planning to extend this with image/file support. Now that you mentioned it, I could also go the Telegram way and use 'data'
The SDK (threema.gateway) handles all API communication — HTTP requests, encryption, key management, and the Threema protocol. client.py is essentially glue code: it maps SDK exceptions to HA-specific exception types and manages the connection context. Happy to extract it into a separate PyPI package if you feel that's necessary, but the actual device/service logic lives in the SDK already. |
I believe data is for the old notify service, which is different In any case, I think we should limit the initial scope, and I think a notify entity would make sense right of the bat, I would like to have more opinions on the image entity, so I think we can get it in a mergable state faster with notify entities and leave the other discussions for a later PR. (as in, I need to double check we like the qe code dependency in its current form as its not in a library) |
There was a problem hiding this comment.
Pull request overview
Adds a new Home Assistant Threema Gateway integration (service-based) to enable sending Threema messages from automations, including an optional QR-code image entity for gateway identity verification.
Changes:
- Introduces the
threemaintegration with config flow (including key generation + reauth) and athreema.send_messageservice. - Adds an image platform entity that generates a QR code from the gateway public key.
- Adds dependencies, typing config, generated integration metadata, and comprehensive tests.
Reviewed changes
Copilot reviewed 21 out of 23 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
homeassistant/components/threema/__init__.py |
Registers send_message service; sets up/unloads config entries and forwards to image platform. |
homeassistant/components/threema/client.py |
Implements ThreemaAPIClient wrapper and keypair generation helper. |
homeassistant/components/threema/config_flow.py |
Implements multi-step config flow (existing/new setup, credential validation, reauth). |
homeassistant/components/threema/const.py |
Defines integration constants and config keys. |
homeassistant/components/threema/image.py |
Adds QR-code ImageEntity for gateway identity verification. |
homeassistant/components/threema/manifest.json |
Declares integration metadata and requirements. |
homeassistant/components/threema/quality_scale.yaml |
Declares quality-scale compliance status for the new integration. |
homeassistant/components/threema/services.yaml |
Defines UI selectors/fields for threema.send_message. |
homeassistant/components/threema/strings.json |
Adds translations for config flow, service fields, and raised exceptions. |
homeassistant/components/threema/icons.json |
Adds service icon mapping. |
homeassistant/components/threema/README.md |
Adds developer-facing integration documentation/architecture notes. |
tests/components/threema/__init__.py |
Adds test package marker for the integration tests. |
tests/components/threema/conftest.py |
Provides fixtures for config entries, connection mocks, and message mocks. |
tests/components/threema/test_config_flow.py |
Tests config flow paths (existing/new, validation errors, reauth). |
tests/components/threema/test_image.py |
Tests QR-code image entity creation and availability. |
tests/components/threema/test_init.py |
Tests setup/unload and send_message service behavior & errors. |
requirements_all.txt |
Adds runtime requirements (qrcode, threema.gateway). |
requirements_test_all.txt |
Adds test requirements (qrcode, threema.gateway). |
.strict-typing |
Enables strict typing for the new integration module. |
mypy.ini |
Adds a strict mypy section for homeassistant.components.threema.*. |
homeassistant/generated/integrations.json |
Registers generated integration metadata entry for threema. |
homeassistant/generated/config_flows.py |
Registers threema in the generated config flow list. |
CODEOWNERS |
Assigns code ownership for the new integration and its tests. |
You can also share your feedback on Copilot code review. Take the survey.
Already working on it.
It's already used by e.g. the PSN Integration afaik and I recommend strongly to include a QR code (whatever lib to use ;) ) to implement full verification in the first shot. Ideas? |
|
Well we still want to limit to a single platform in the initial PR, so you'd have to pick anyhow :) |
|
Putting back to draft as the library seems to use nacllib which doesn't seem to work on my dev environment |
edenhaus
left a comment
There was a problem hiding this comment.
The library requires system packages to be installed and this is not anymore allowed. Currently the required libsodium is installed as it's part of a subsub dependency of ffmpeg but that could change anytime
Proposed change
My first core PR 🥳
Reopened as a clean PR after the previous one (#165787) was closed due to force-push noise affecting other contributors. Apologies for the disruption.
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:
threema.send_message service (E2E encrypted or simple mode)notify entityQR code image entity for gateway identity verificationfuture releaseWhat's not included (intentionally)
Additional developer related info is added to the readme.md, including a small roadmap.
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: