Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/multi_ap_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Multi-AP report
about: Report a problem or test result for the Multi-AP release
title: "[Multi-AP] "
labels: "bug"
assignees: ""
---

## Before submitting

- Confirm that you are using the current Multi-AP release.
- Search existing issues for the same behavior.
- Remove passwords, tokens, private IP addresses, tag identifiers, location names, and other personal data from logs and screenshots.

## Environment

- Multi-AP release version:
- Home Assistant version:
- Installation method (manual/HACS):
- Number of OpenEPaperLink APs:
- AP hardware and firmware versions:
- Number of tags visible through more than one AP:
- BLE tags in the same HA instance (yes/no):

## Result

- Expected behavior:
- Actual behavior:
- Steps to reproduce:
- Does the problem remain after restarting Home Assistant?
- Does routing recover when the affected AP comes back online?

## Sanitized diagnostics and logs

Attach only the smallest relevant excerpt. Enable debug logging if needed, reproduce the problem once, and sanitize all private data before posting.
48 changes: 48 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,53 @@
# Changelog

## [3.0.1](https://github.com/wendefeuer/Home_Assistant_Integration/compare/3.0.1-multi-ap.1...3.0.1) (2026-07-14)

### Release

* promote the validated Multi-AP beta to the stable `3.0.1` fork release
* no functional code changes compared with `3.0.1-multi-ap.1`
* retain the backup, rollback, known-limitations, and sanitized issue-reporting guidance

### Validation

* nine focused Multi-AP tests passed
* Python 3.12 compilation and JSON/translation validation passed
* live validation passed on Home Assistant Core 2026.7.2 with two APs and shared tags
* AP fallback/recovery, separate AP reboot, and unchanged BLE operation were verified

## [3.0.1-multi-ap.1](https://github.com/wendefeuer/Home_Assistant_Integration/compare/3.0.0...3.0.1-multi-ap.1) (2026-07-14)

> **Pre-release:** Test version for broader Multi-AP validation. Back up Home Assistant and the existing integration folder before installation.

### Features

* allow multiple AP config entries while continuing to reject duplicate hosts
* keep one logical Home Assistant device per physical tag across multiple APs
* route tag state and actions to an online AP, preferring the freshest `last_seen`
* create unique AP device identifiers and separate per-entry tag stores
* add debug logging for routing candidates, the selected AP, and the selection reason

### Bug Fixes

* retain a shared tag when it is deleted or blacklisted on only one AP
* route `reboot_ap` to the explicitly selected AP device
* treat an accepted AP reboot followed by the expected connection loss as successful

### Validation

* nine focused Multi-AP tests passed
* Python compilation and JSON/translation validation passed
* live validation passed on Home Assistant Core 2026.7.2 with two APs and shared tags
* AP fallback/recovery, separate AP reboot, and unchanged BLE operation were verified
* 27 existing image snapshot differences were reproduced unchanged on the upstream code in the same Windows/Pillow environment and are not caused by this beta

### Known limitations

* pre-release from a public fork; not yet merged into the upstream stable release
* Multi-AP routing covers AP-based tags; BLE paths are intentionally unchanged
* the selected AP can change when connectivity or tag `last_seen` data changes
* broader field testing with other AP counts, firmware combinations, and Home Assistant versions is still required

## [3.0.0](https://github.com/OpenEPaperLink/Home_Assistant_Integration/compare/2.8.0...3.0.0) (2026-03-27)


Expand Down
56 changes: 55 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,60 @@

Home Assistant Integration for the [OpenEPaperLink](https://github.com/jjwbruijn/OpenEPaperLink) project, enabling control and monitoring of electronic shelf labels (ESLs) through Home Assistant.

## Multi-AP release / Multi-AP-Version

> [!IMPORTANT]
> **Create a Home Assistant backup and a separate copy of your existing `custom_components/open_epaper_link` folder before installation.** Version `3.0.1` is the stable Multi-AP release of this public fork and has not yet been merged into the upstream project.
>
> **Vor der Installation ein Home-Assistant-Backup und zusätzlich eine Kopie des vorhandenen Ordners `custom_components/open_epaper_link` erstellen.** Version `3.0.1` ist die stabile Multi-AP-Version dieses öffentlichen Forks und noch nicht in das Upstream-Projekt übernommen.

Release version: [`3.0.1`](https://github.com/wendefeuer/Home_Assistant_Integration/releases/tag/3.0.1)

Feedback and bug reports: [GitHub Issues in the fork](https://github.com/wendefeuer/Home_Assistant_Integration/issues/new/choose)

### English Multi-AP installation

This release allows multiple OpenEPaperLink AP config entries in one Home Assistant instance. A physical tag remains one logical Home Assistant device, and tag actions are routed to an online AP with the freshest `last_seen` value.

1. Create a full Home Assistant backup.
2. Back up the existing `/config/custom_components/open_epaper_link` folder separately.
3. Install the release using one of these methods:
- **HACS custom repository (recommended):** In HACS, open the three-dot menu, select **Custom repositories**, add `https://github.com/wendefeuer/Home_Assistant_Integration` as type **Integration**, then use **Download** or **Redownload**. Under **Need a different version?**, select `3.0.1` if necessary.
- **Manual:** Download the source archive from the [`3.0.1` release](https://github.com/wendefeuer/Home_Assistant_Integration/releases/tag/3.0.1), extract it, and copy its `custom_components/open_epaper_link` folder to `/config/custom_components/open_epaper_link`, replacing the integration files.
4. Restart Home Assistant. Do not edit files below `.storage`.
5. Open **Settings → Devices & services → OpenEPaperLink** and add each AP separately. Existing AP entries can remain in place.
6. Verify that every AP has its own device, shared tags appear only once, and a test action reaches the expected online AP.

To roll back, restore the backed-up integration folder or reinstall the latest upstream stable release, restart Home Assistant, and verify the integration and its devices again.

When reporting a problem, use the [fork issue tracker](https://github.com/wendefeuer/Home_Assistant_Integration/issues/new/choose) and include the release version, Home Assistant version, AP count and firmware versions, reproduction steps, and sanitized logs. Remove tokens, passwords, private addresses, tag identifiers, and other personal data before posting.

### Deutsche Multi-AP-Installation

Diese Version erlaubt mehrere OpenEPaperLink-AP-Konfigurationseinträge in einer Home-Assistant-Instanz. Ein physisches Tag bleibt ein logisches Home-Assistant-Gerät; Tag-Aktionen werden an einen erreichbaren AP mit dem neuesten `last_seen`-Wert geleitet.

1. Ein vollständiges Home-Assistant-Backup erstellen.
2. Den vorhandenen Ordner `/config/custom_components/open_epaper_link` zusätzlich separat sichern.
3. Die Version mit einer der folgenden Methoden installieren:
- **HACS Custom Repository (empfohlen):** In HACS das Drei-Punkte-Menü öffnen, **Benutzerdefinierte Repositories** auswählen, `https://github.com/wendefeuer/Home_Assistant_Integration` mit dem Typ **Integration** hinzufügen und anschließend **Herunterladen** oder **Erneut herunterladen** wählen. Unter **Andere Version benötigt?** bei Bedarf `3.0.1` auswählen.
- **Manuell:** Das Quellarchiv der [Version `3.0.1`](https://github.com/wendefeuer/Home_Assistant_Integration/releases/tag/3.0.1) herunterladen, entpacken und den enthaltenen Ordner `custom_components/open_epaper_link` nach `/config/custom_components/open_epaper_link` kopieren. Dabei die vorhandenen Integrationsdateien ersetzen.
4. Home Assistant neu starten. Keine Dateien unter `.storage` bearbeiten.
5. Unter **Einstellungen → Geräte & Dienste → OpenEPaperLink** jeden AP einzeln hinzufügen. Vorhandene AP-Einträge können bestehen bleiben.
6. Prüfen, ob jeder AP ein eigenes Gerät besitzt, gemeinsam sichtbare Tags nur einmal erscheinen und eine Testaktion den erwarteten erreichbaren AP erreicht.

Für ein Rollback den gesicherten Integrationsordner wiederherstellen oder die aktuelle stabile Upstream-Version erneut installieren, Home Assistant neu starten und anschließend Integration und Geräte erneut prüfen.

Probleme bitte zentral im [Issue-Tracker des Forks](https://github.com/wendefeuer/Home_Assistant_Integration/issues/new/choose) melden. Dabei Release-Version, Home-Assistant-Version, Anzahl und Firmwarestände der APs, Reproduktionsschritte und bereinigte Logs angeben. Tokens, Passwörter, private Adressen, Tag-Kennungen und andere personenbezogene Daten vor dem Veröffentlichen entfernen.

### Known limitations / Bekannte Einschränkungen

- This is a stable release of a public fork and is not yet part of the upstream project. / Dies ist eine stabile Version eines öffentlichen Forks und noch nicht Teil des Upstream-Projekts.
- Multi-AP routing applies to AP-based tags. Existing BLE behavior is intentionally unchanged. / Das Multi-AP-Routing gilt für AP-basierte Tags. Das bestehende BLE-Verhalten bleibt absichtlich unverändert.
- Routing depends on AP connectivity and the most recent tag `last_seen` data. The selected AP can therefore change after a newer check-in or an AP outage. / Das Routing hängt von der AP-Erreichbarkeit und den neuesten `last_seen`-Daten des Tags ab. Der gewählte AP kann sich daher nach einem neueren Check-in oder AP-Ausfall ändern.
- A tag shared by multiple APs is intentionally shown as one HA device and has no permanent parent-AP assignment. / Ein von mehreren APs erfasstes Tag wird absichtlich als ein HA-Gerät angezeigt und besitzt keine dauerhafte Zuordnung zu einem übergeordneten AP.
- An AP reboot can close the HTTP connection before returning a response; an accepted reboot request followed by that disconnect is treated as successful. / Ein AP-Neustart kann die HTTP-Verbindung schließen, bevor eine Antwort zurückkommt; eine zuvor angenommene Neustartanforderung wird in diesem Fall als erfolgreich behandelt.
- Version `3.0.1` was validated with two APs on Home Assistant Core 2026.7.2. Other AP counts, firmware combinations, and HA versions have not been validated to the same extent. / Version `3.0.1` wurde mit zwei APs unter Home Assistant Core 2026.7.2 geprüft. Andere AP-Anzahlen, Firmwarekombinationen und HA-Versionen wurden noch nicht im gleichen Umfang validiert.

## Requirements

### Hardware
Expand Down Expand Up @@ -142,7 +196,7 @@ After setup, you can configure additional options through the integration's opti
**AP Device Configuration:**
- **Automatic Discovery** (recommended): APs are automatically discovered via DHCP when connected to the network
- **Manual Setup** (fallback): Go to Settings → Integrations → Add Integration and enter your AP's IP address
- ⚠️ **Single Hub Limitation**: Only one AP hub allowed per Home Assistant instance
- **Multiple AP hubs supported**: Add every AP separately. A physical tag remains one logical Home Assistant device; actions are routed to the online AP with the freshest tag check-in.
- All tags connected to the AP are automatically discovered

**BLE Device Discovery:**
Expand Down
35 changes: 35 additions & 0 deletions custom_components/open_epaper_link/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from .ble import BLEDeviceMetadata
from .const import DOMAIN
from .coordinator import Hub
from .hub_manager import get_hub_manager
from .runtime_data import OpenEPaperLinkConfigEntry, OpenEPaperLinkBLERuntimeData
from .services import async_setup_services
from .tag_types import get_tag_types_manager
Expand Down Expand Up @@ -108,6 +109,8 @@ async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->

Version 3 -> 4: Fix color support.

Version 4 -> 5: Enable multi-AP runtime and AP-specific storage.

Returns:
bool: True if migration was successful, False otherwise.
"""
Expand Down Expand Up @@ -224,6 +227,10 @@ async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
)
_LOGGER.info("Successfully migrated config entry to version 4")

if config_entry.version == 4:
hass.config_entries.async_update_entry(config_entry, version=5)
_LOGGER.info("Successfully migrated config entry to multi-AP schema version 5")

return True


Expand Down Expand Up @@ -430,6 +437,7 @@ def _ble_device_found(
await hub.async_setup_initial()

entry.runtime_data = hub
get_hub_manager(hass).register_hub(hub)

removed_entities = await async_migrate_camera_entities(hass, entry)
if removed_entities:
Expand All @@ -448,6 +456,7 @@ def _ble_device_found(
)

await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
await async_cleanup_legacy_ap_device(hass)

async def start_websocket(_):
"""Start WebSocket connection after HA is fully started."""
Expand Down Expand Up @@ -515,6 +524,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: OpenEPaperLinkConfigEnt
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)

if unload_ok:
get_hub_manager(hass).unregister_hub(entry.entry_id)
await hub.shutdown()

return unload_ok
Expand Down Expand Up @@ -546,6 +556,9 @@ async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
hass: Home Assistant instance
entry: Configuration entry being removed
"""
if CONF_HOST in entry.data:
await storage.async_remove_store(hass, f"{DOMAIN}_tags_{entry.entry_id}")

# Only remove shared storage files if this is the last config entry
remaining_entries = [
config_entry for config_entry in hass.config_entries.async_entries(DOMAIN)
Expand Down Expand Up @@ -624,6 +637,28 @@ async def async_remove_storage_files(hass: HomeAssistant) -> None:
_LOGGER.debug("Reset tag types manager singleton")


async def async_cleanup_legacy_ap_device(hass: HomeAssistant) -> None:
"""Remove the old globally identified AP device once it is orphaned."""
device_registry = dr.async_get(hass)
legacy_device = device_registry.async_get_device(identifiers={(DOMAIN, "ap")})
if legacy_device is None:
return

entity_registry = er.async_get(hass)
if any(
entity.device_id == legacy_device.id
for entity in entity_registry.entities.values()
):
_LOGGER.debug(
"Legacy AP device %s still owns entities; deferring cleanup",
legacy_device.id,
)
return

device_registry.async_remove_device(legacy_device.id)
_LOGGER.info("Removed orphaned legacy OpenEPaperLink AP device")



async def _send_welcome_image(
hass: HomeAssistant,
Expand Down
13 changes: 10 additions & 3 deletions custom_components/open_epaper_link/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from .tag_types import get_tag_types_manager
from .util import is_ble_entry
from .const import DOMAIN
from .hub_manager import get_hub_manager

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -59,6 +60,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: OpenEPaperLinkConfigEntr

# AP device setup (original logic)
hub = entry_data
hub_manager = get_hub_manager(hass)

# Track added tags to prevent duplicates
added_tags = set()
Expand All @@ -85,9 +87,12 @@ async def async_add_tag_buttons(tag_mac: str) -> None:
tag_mac: MAC address of the tag to create buttons for
"""

# Skip if tag is blacklisted
if tag_mac in hub.get_blacklisted_tags():
_LOGGER.debug("Skipping button creation for blacklisted tag: %s", tag_mac)
if not hub_manager.is_tag_entity_owner(entry.entry_id, tag_mac):
return

# Skip only when no AP exposes an eligible copy of the tag.
if not hub_manager.hubs_for_tag(tag_mac):
_LOGGER.debug("Skipping button creation for unavailable tag: %s", tag_mac)
return

if tag_mac in added_tags:
Expand Down Expand Up @@ -145,6 +150,8 @@ async def handle_blacklist_update() -> None:
if device:
for identifier in device.identifiers:
if identifier[0] == DOMAIN and identifier[1] in hub.get_blacklisted_tags():
if hub_manager.hubs_for_tag(identifier[1]):
continue
entities_to_remove.append(entity.entity_id)
# Add device to removal list
devices_to_remove.add(device.id)
Expand Down
13 changes: 1 addition & 12 deletions custom_components/open_epaper_link/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
context between user interactions.
"""

VERSION = 4
VERSION = 5

def __init__(self) -> None:
"""Initialize flow."""
Expand Down Expand Up @@ -108,11 +108,6 @@ async def async_step_user(
FlowResult: Result of the flow step, either showing the form
again (with errors if applicable) or creating an entry
"""
# Check for existing AP hub entries immediately (before showing form)
for entry_id, entry_data in self.hass.data.get(DOMAIN, {}).items():
if not is_ble_entry(entry_data): # This is an AP (Hub object)
return self.async_abort(reason="single_instance_allowed")

errors: dict[str, str] = {}

if user_input is not None:
Expand Down Expand Up @@ -393,12 +388,6 @@ async def async_step_dhcp(
# Extract host IP from discovery info
host = discovery_info.ip

# Check for existing AP entries in config entries
# AP entries have CONF_HOST in data, BLE entries have device_type
for entry in self._async_current_entries():
if CONF_HOST in entry.data:
return self.async_abort(reason="single_instance_allowed")

# Set unique_id to IP address (same as manual setup)
# This ensures DHCP and manual discoveries are treated as the same entry
await self.async_set_unique_id(host)
Expand Down
Loading
Loading