Repository: home-assistant/core
Pull request: Subscribe to Traccar Server events
<!--
  You are amazing! Thanks for contributing to our project!
  Please, DO NOT DELETE ANY TEXT from this template! (unless instructed).
-->
## Proposed change
<!--
  Describe the big picture of your changes here to communicate to the
  maintainers why we should accept this pull request. If it fixes a bug
  or resolves a feature request, be sure to link to that issue in the
  additional information section.
-->

Implement websocket subscription for Traccar Server events for instant updates inside of Home Assistant.
For now, only the position and device events are implemented (the "events" event will come later once the events handling is moved over to event entities)


## Type of change
<!--
  What type of change does your PR introduce to Home Assistant?
  NOTE: Please, check only 1! box!
  If your PR requires multiple boxes to be checked, you'll most likely need to
  split it into multiple PRs. This makes things easier and faster to code review.
-->

- [ ] Dependency upgrade
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New integration (thank you!)
- [x] 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
<!--
  Details are important, and help maintainers processing your PR.
  Please be sure to fill out additional details, if applicable.
-->

- This PR fixes or closes issue: fixes #110166
- This PR is related to issue: 
- Link to documentation pull request: 

## Checklist
<!--
  Put an `x` in the boxes that apply. You can also fill these out after
  creating the PR. If you're unsure about any of them, don't hesitate to ask.
  We're here to help! This is simply a reminder of what we are going to look
  for before merging your code.
-->

- [x] The code change is tested and works locally.
- [x] Local tests pass. **Your PR cannot be merged unless tests pass**
- [x] There is no commented out code in this PR.
- [ ] I have followed the [development checklist][dev-checklist]
- [ ] I have followed the [perfect PR recommendations][perfect-pr]
- [x] The code has been formatted using Ruff (`ruff format homeassistant tests`)
- [ ] Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

- [ ] Documentation added/updated for [www.home-assistant.io][docs-repository]

If the code communicates with devices, web services, or third-party tools:

- [ ] The [manifest file][manifest-docs] 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 link to the changelog, or at minimum a diff between library versions is added to the PR description.
- [ ] Untested files have been added to `.coveragerc`.

<!--
  This project is very active and we have a high turnover of pull requests.

  Unfortunately, the number of incoming pull requests is higher than what our
  reviewers can review and merge so there is a long backlog of pull requests
  waiting for review. You can help here!
  
  By reviewing another pull request, you will help raise the code quality of
  that pull request and the final review will be faster. This way the general
  pace of pull request reviews will go up and your wait time will go down.
  
  When picking a pull request to review, try to choose one that hasn't yet
  been reviewed.

  Thanks for helping out!
-->

To help with the load of incoming pull requests:

- [ ] I have reviewed two other [open pull requests][prs] in this repository.

[prs]: https://github.com/home-assistant/core/pulls?q=is%3Aopen+is%3Apr+-author%3A%40me+-draft%3Atrue+-label%3Awaiting-for-upstream+sort%3Acreated-desc+review%3Anone+-status%3Afailure

<!--
  Thank you for contributing <3

  Below, some useful links you could explore:
-->
[dev-checklist]: https://developers.home-assistant.io/docs/development_checklist/
[manifest-docs]: https://developers.home-assistant.io/docs/creating_integration_manifest/
[quality-scale]: https://developers.home-assistant.io/docs/integration_quality_scale_index/
[docs-repository]: https://github.com/home-assistant/home-assistant.io
[perfect-pr]: https://developers.home-assistant.io/docs/review-process/#creating-the-perfect-pr


Problem statement:
Home Assistant 2024.2.0 and greater Integration Traccar now sends Status / Location even if device offline
### The problem

Now that Traccar Integration is setup via UI it seems to get the device status from traccar AND proccessing it even if the device is offline.
Real World impact:
A person / account in HA has multiple device tracker (Mobile Companion App and Traccar).
Now the person.<name> gets updated with either location that was send last?!
Tracker B (Traccar) goes offline in City A. Person moves to City B, but the offline tracker stuck in City A with state offline still sends old coordinates and overwrites the more recent correct location. I debugged this shit like for 3 days now and finally found it is the traccar integration that behaves different than before.

### What version of Home Assistant Core has the issue?

core-2024.2.0

### What was the last working version of Home Assistant Core?

2024.1.5

### What type of installation are you running?

Home Assistant Container

### Integration causing the issue

person

### Link to integration documentation on our website


### Diagnostics information

_No response_

### Example YAML snippet

_No response_

### Anything in the logs that might be useful for us?

_No response_

### Additional information

I believe that this information is enough to recreate the issue. I checkt the mobile app logs, i checked the debug log of the mobile app, i checked location with the android device and everything was correct. In the DB i found that the only place where these gps coordinates originated from are traccar device_tracker. If you need anything else let me know.

Hints from issue discussion:
Hey there @ludeeus, mind taking a look at this issue as it has been labeled with an integration (`traccar`) you are listed as a [code owner](https://github.com/home-assistant/core/blob/dev/CODEOWNERS#L1396) for? Thanks!

<details>
<summary>Code owner commands</summary>


Code owners of `traccar` can trigger bot actions by commenting:

- `@home-assistant close` Closes the issue.
- `@home-assistant rename Awesome new title` Renames the issue.
- `@home-assistant reopen` Reopen the issue.
- `@home-assistant unassign traccar` Removes the current integration label and assignees on the issue, add the integration domain after the command.
- `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
- `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

</details>


<sub><sup>(message by CodeOwnersMention)</sup></sub>

---

[traccar documentation](https://www.home-assistant.io/integrations/traccar)
[traccar source](https://github.com/home-assistant/core/tree/dev/homeassistant/components/traccar)
<sub><sup>(message by IssueLinks)</sup></sub>
This is not new behavior, offline devices was never discarded, as traccar still report it's last known location.
What did change was the move from legacy to standard tracking.
Maybe the person integration handles that differently.
Okay so should i move the issue to integration person?
I am a little lost here. Definitive a change in 2024.2. 
[traccar_server documentation](https://www.home-assistant.io/integrations/traccar_server)
[traccar_server source](https://github.com/home-assistant/core/tree/dev/homeassistant/components/traccar_server)
Ill see if I can implement a limiter on the state writes. That's probably something that could be added regardless.
In an upcoming version I will move the position updates over to WebSocket, and there it would not be an issue anyway.
That has nothing to do with the issue described above.
@ludeeus  on traccar server web interface it shows time elapsed from last device position sent.

Can this last time be included as an attribute ?

I agree that is good to have device information even when offline, but at least if we get information from last time device was seen it can help more than just the "offline" status
You can allread get that with the custom attributes configuration options 
> You can allread get that with the custom attributes configuration options

I have tried already but only items that are inside the traccar attributes element are working. 
I have tried with fixTime, deviceTime and serverTime, protocol without success. 
But all elements inside attributes worked.


just removed lat/lon from this sample from a request to traccar/api/positions

```json
{"id":2842283,"attributes":{"batteryLevel":68.0,"temp.ambient":27.0,"gear":"P","ignition":true,"ignitionState":"On","chargePortConnected":false,"charge":false,"power.mW":"913800.06","batteryLevel.wh":46240.0,"appVersion":"0.26.0.0010","distance":0.0,"totalDistance":1838677.54,"motion":false,"hours":121571571},"deviceId":135,"protocol":"carstatsviewer","serverTime":"2024-01-11T22:38:15.982+00:00","deviceTime":"2024-01-11T22:38:11.416+00:00","fixTime":"2024-01-11T22:38:11.416+00:00","outdated":false,"valid":true,"latitude":0.0,"longitude":0.0,"altitude":789.6577,"speed":0.0,"course":0.0,"address":null,"accuracy":0.0,"network":null,"geofenceIds":[112]}

```


Ah okay, my bad i thought you meant they where attributes

Commit message: Subscribe to Traccar Server events

Patch to review:
diff --git a/homeassistant/components/traccar_server/__init__.py b/homeassistant/components/traccar_server/__init__.py
index 53770757c8189f..5f37be16e046fd 100644
--- a/homeassistant/components/traccar_server/__init__.py
+++ b/homeassistant/components/traccar_server/__init__.py
@@ -1,6 +1,9 @@
 """The Traccar Server integration."""
 from __future__ import annotations
 
+from datetime import timedelta
+
+from aiohttp import CookieJar
 from pytraccar import ApiClient
 
 from homeassistant.config_entries import ConfigEntry
@@ -14,7 +17,8 @@
     Platform,
 )
 from homeassistant.core import HomeAssistant
-from homeassistant.helpers.aiohttp_client import async_get_clientsession
+from homeassistant.helpers.aiohttp_client import async_create_clientsession
+from homeassistant.helpers.event import async_track_time_interval
 
 from .const import (
     CONF_CUSTOM_ATTRIBUTES,
@@ -30,10 +34,16 @@
 
 async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
     """Set up Traccar Server from a config entry."""
+    client_session = async_create_clientsession(
+        hass,
+        cookie_jar=CookieJar(
+            unsafe=not entry.data[CONF_SSL] or not entry.data[CONF_VERIFY_SSL]
+        ),
+    )
     coordinator = TraccarServerCoordinator(
         hass=hass,
         client=ApiClient(
-            client_session=async_get_clientsession(hass),
+            client_session=client_session,
             host=entry.data[CONF_HOST],
             port=entry.data[CONF_PORT],
             username=entry.data[CONF_USERNAME],
@@ -54,6 +64,16 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
 
     await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
     entry.async_on_unload(entry.add_update_listener(async_reload_entry))
+    if entry.options.get(CONF_EVENTS):
+        entry.async_on_unload(
+            async_track_time_interval(
+                hass,
+                coordinator.import_events,
+                timedelta(seconds=30),
+                cancel_on_shutdown=True,
+                name="traccar_server_import_events",
+            )
+        )
 
     return True
 
diff --git a/homeassistant/components/traccar_server/coordinator.py b/homeassistant/components/traccar_server/coordinator.py
index df9b5adaf1a53f..ee4a18643cb78a 100644
--- a/homeassistant/components/traccar_server/coordinator.py
+++ b/homeassistant/components/traccar_server/coordinator.py
@@ -2,7 +2,7 @@
 from __future__ import annotations
 
 import asyncio
-from datetime import datetime, timedelta
+from datetime import datetime
 from typing import TYPE_CHECKING, Any, TypedDict
 
 from pytraccar import (
@@ -10,11 +10,14 @@
     DeviceModel,
     GeofenceModel,
     PositionModel,
+    SubscriptionData,
     TraccarException,
 )
 
 from homeassistant.config_entries import ConfigEntry
+from homeassistant.const import EVENT_HOMEASSISTANT_STOP
 from homeassistant.core import HomeAssistant
+from homeassistant.helpers.dispatcher import dispatcher_send
 from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
 from homeassistant.util import dt as dt_util
 
@@ -31,7 +34,7 @@ class TraccarServerCoordinatorDataDevice(TypedDict):
     attributes: dict[str, Any]
 
 
-TraccarServerCoordinatorData = dict[str, TraccarServerCoordinatorDataDevice]
+TraccarServerCoordinatorData = dict[int, TraccarServerCoordinatorDataDevice]
 
 
 class TraccarServerCoordinator(DataUpdateCoordinator[TraccarServerCoordinatorData]):
@@ -54,14 +57,17 @@ def __init__(
             hass=hass,
             logger=LOGGER,
             name=DOMAIN,
-            update_interval=timedelta(seconds=30),
+            update_interval=None,
         )
         self.client = client
         self.custom_attributes = custom_attributes
         self.events = events
         self.max_accuracy = max_accuracy
         self.skip_accuracy_filter_for = skip_accuracy_filter_for
+        self._geofences: list[GeofenceModel] = []
         self._last_event_import: datetime | None = None
+        self._subscription: asyncio.Task | None = None
+        self._should_log_subscription_error: bool = True
 
     async def _async_update_data(self) -> TraccarServerCoordinatorData:
         """Fetch data from Traccar Server."""
@@ -85,35 +91,16 @@ async def _async_update_data(self) -> TraccarServerCoordinatorData:
             assert isinstance(positions, list[PositionModel])  # type: ignore[misc]
             assert isinstance(geofences, list[GeofenceModel])  # type: ignore[misc]
 
+        self._geofences = geofences
+
         for position in positions:
             if (device := get_device(position["deviceId"], devices)) is None:
                 continue
 
-            attr = {}
-            skip_accuracy_filter = False
-
-            for custom_attr in self.custom_attributes:
-                attr[custom_attr] = device["attributes"].get(
-                    custom_attr,
-                    position["attributes"].get(custom_attr, None),
-                )
-                if custom_attr in self.skip_accuracy_filter_for:
-                    skip_accuracy_filter = True
-
-            accuracy = position["accuracy"] or 0.0
-            if (
-                not skip_accuracy_filter
-                and self.max_accuracy > 0
-                and accuracy > self.max_accuracy
-            ):
-                LOGGER.debug(
-                    "Excluded position by accuracy filter: %f (%s)",
-                    accuracy,
-                    device["id"],
-                )
+            if (attr := self._attrs(device, position)) is None:
                 continue
 
-            data[device["uniqueId"]] = {
+            data[device["id"]] = {
                 "device": device,
                 "geofence": get_first_geofence(
                     geofences,
@@ -123,12 +110,47 @@ async def _async_update_data(self) -> TraccarServerCoordinatorData:
                 "attributes": attr,
             }
 
-        if self.events:
-            self.hass.async_create_task(self.import_events(devices))
+        await self.subscribe()
 
         return data
 
-    async def import_events(self, devices: list[DeviceModel]) -> None:
+    async def handle_sunscription_data(self, data: SubscriptionData) -> None:
+        """Handle subscription data."""
+        self.logger.debug("Received subscription data: %s", data)
+        self._should_log_subscription_error = True
+        update_devices = set()
+        for device in data.get("devices") or []:
+            device_id = device["id"]
+            if device_id not in self.data:
+                continue
+
+            if (attr := self._attrs(device, self.data[device_id]["position"])) is None:
+                continue
+
+            self.data[device_id]["device"] = device
+            self.data[device_id]["attributes"] = attr
+            update_devices.add(device_id)
+
+        for position in data.get("positions") or []:
+            device_id = position["deviceId"]
+            if device_id not in self.data:
+                continue
+
+            if (attr := self._attrs(self.data[device_id]["device"], position)) is None:
+                continue
+
+            self.data[device_id]["position"] = position
+            self.data[device_id]["attributes"] = attr
+            self.data[device_id]["geofence"] = get_first_geofence(
+                self._geofences,
+                position["geofenceIds"] or [],
+            )
+            update_devices.add(device_id)
+
+        for device_id in update_devices:
+            dispatcher_send(self.hass, f"{DOMAIN}_{device_id}")
+
+    async def import_events(self, *args) -> None:
         """Import events from Traccar."""
         start_time = dt_util.utcnow().replace(tzinfo=None)
         end_time = None
@@ -137,7 +159,7 @@ async def import_events(self, devices: list[DeviceModel]) -> None:
             end_time = start_time - (start_time - self._last_event_import)
 
         events = await self.client.get_reports_events(
-            devices=[device["id"] for device in devices],
+            devices=list(self.data),
             start_time=start_time,
             end_time=end_time,
             event_types=self.events,
@@ -147,7 +169,7 @@ async def import_events(self, devices: list[DeviceModel]) -> None:
 
         self._last_event_import = start_time
         for event in events:
-            device = get_device(event["deviceId"], devices)
+            device = self.data[event["deviceId"]]["device"]
             self.hass.bus.async_fire(
                 # This goes against two of the HA core guidelines:
                 # 1. Event names should be prefixed with the domain name of
@@ -165,3 +187,58 @@ async def import_events(self, devices: list[DeviceModel]) -> None:
                     "attributes": event["attributes"],
                 },
             )
+
+    async def unsubscribe(self, *args) -> None:
+        """Unsubscribe from Traccar Server."""
+        if self._subscription is None:
+            return
+        self._should_log_subscription_error = False
+        self._subscription.cancel()
+        self._subscription = None
+
+    async def subscribe(self) -> None:
+        """Subscribe to events."""
+        if self._subscription is not None:
+            return
+
+        async def _subscriber():
+            try:
+                await self.client.subscribe(self.handle_sunscription_data)
+            except TraccarException as ex:
+                if self._should_log_subscription_error:
+                    self._should_log_subscription_error = False
+                    LOGGER.error("Error while subscribing to Traccar: %s", ex)
+                # Retry after 10 seconds
+                await asyncio.sleep(10)
+                await self.unsubscribe()
+                await self.subscribe()
+
+        self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, self.unsubscribe)
+        self.config_entry.async_on_unload(self.unsubscribe)
+        self._subscription = asyncio.create_task(_subscriber())
+
+    def _attrs(
+        self,
+        device: DeviceModel,
+        position: PositionModel,
+    ) -> None | dict[str, Any]:
+        """Filter attributes."""
+        attr = {}
+        skip_accuracy_filter = False
+
+        for custom_attr in self.custom_attributes:
+            if custom_attr in self.skip_accuracy_filter_for:
+                skip_accuracy_filter = True
+            attr[custom_attr] = device["attributes"].get(
+                custom_attr,
+                position["attributes"].get(custom_attr, None),
+            )
+
+        accuracy = position["accuracy"] or 0.0
+        if (
+            not skip_accuracy_filter
+            and self.max_accuracy > 0
+            and accuracy > self.max_accuracy
+        ):
+            return None
+        return attr
diff --git a/homeassistant/components/traccar_server/diagnostics.py b/homeassistant/components/traccar_server/diagnostics.py
index ce29649939898a..15b94a2b880b42 100644
--- a/homeassistant/components/traccar_server/diagnostics.py
+++ b/homeassistant/components/traccar_server/diagnostics.py
@@ -30,6 +30,7 @@ async def async_get_config_entry_diagnostics(
 
     return async_redact_data(
         {
+            "subscription_status": coordinator.client.subscription_status,
             "config_entry_options": dict(config_entry.options),
             "coordinator_data": coordinator.data,
             "entities": [
@@ -63,6 +64,7 @@ async def async_get_device_diagnostics(
 
     return async_redact_data(
         {
+            "subscription_status": coordinator.client.subscription_status,
             "config_entry_options": dict(entry.options),
             "coordinator_data": coordinator.data,
             "entities": [
diff --git a/homeassistant/components/traccar_server/entity.py b/homeassistant/components/traccar_server/entity.py
index d44c78cafae4a4..bb824cf77c8f63 100644
--- a/homeassistant/components/traccar_server/entity.py
+++ b/homeassistant/components/traccar_server/entity.py
@@ -6,6 +6,7 @@
 from pytraccar import DeviceModel, GeofenceModel, PositionModel
 
 from homeassistant.helpers.device_registry import DeviceInfo
+from homeassistant.helpers.dispatcher import async_dispatcher_connect
 from homeassistant.helpers.update_coordinator import CoordinatorEntity
 
 from .const import DOMAIN
@@ -22,7 +23,7 @@ def __init__(
     ) -> None:
         """Initialize the Traccar Server entity."""
         super().__init__(coordinator)
-        self.device_id = device["uniqueId"]
+        self.device_id = device["id"]
         self._attr_device_info = DeviceInfo(
             identifiers={(DOMAIN, device["uniqueId"])},
             model=device["model"],
@@ -57,3 +58,14 @@ def traccar_position(self) -> PositionModel:
     def traccar_attributes(self) -> dict[str, Any]:
         """Return the attributes."""
         return self.coordinator.data[self.device_id]["attributes"]
+
+    async def async_added_to_hass(self) -> None:
+        """Entity added to hass."""
+        self.async_on_remove(
+            async_dispatcher_connect(
+                self.hass,
+                f"{DOMAIN}_{self.device_id}",
+                self.async_write_ha_state,
+            )
+        )
+        await super().async_added_to_hass()
diff --git a/homeassistant/components/traccar_server/manifest.json b/homeassistant/components/traccar_server/manifest.json
index 8fc49d00d246e8..5fac2f108f7d90 100644
--- a/homeassistant/components/traccar_server/manifest.json
+++ b/homeassistant/components/traccar_server/manifest.json
@@ -4,6 +4,6 @@
   "codeowners": ["@ludeeus"],
   "config_flow": true,
   "documentation": "https://www.home-assistant.io/integrations/traccar_server",
-  "iot_class": "local_polling",
+  "iot_class": "local_push",
   "requirements": ["pytraccar==2.1.1"]
 }
diff --git a/homeassistant/generated/integrations.json b/homeassistant/generated/integrations.json
index 520344480b972a..90e50e22339750 100644
--- a/homeassistant/generated/integrations.json
+++ b/homeassistant/generated/integrations.json
@@ -6208,7 +6208,7 @@
         "traccar_server": {
           "integration_type": "hub",
           "config_flow": true,
-          "iot_class": "local_polling",
+          "iot_class": "local_push",
           "name": "Traccar Server"
         }
       }
diff --git a/tests/components/traccar_server/conftest.py b/tests/components/traccar_server/conftest.py
index 10cc6192d38268..b313cb6734d4bb 100644
--- a/tests/components/traccar_server/conftest.py
+++ b/tests/components/traccar_server/conftest.py
@@ -3,7 +3,7 @@
 from unittest.mock import AsyncMock, patch
 
 import pytest
-from pytraccar import ApiClient
+from pytraccar import ApiClient, SubscriptionStatus
 
 from homeassistant.components.traccar_server.const import (
     CONF_CUSTOM_ATTRIBUTES,
@@ -39,6 +39,7 @@ def mock_traccar_api_client() -> Generator[AsyncMock, None, None]:
         new=mock_client,
     ):
         client: ApiClient = mock_client.return_value
+        client.subscription_status = SubscriptionStatus.DISCONNECTED
         client.get_devices.return_value = load_json_array_fixture(
             "traccar_server/devices.json"
         )
@@ -55,6 +56,8 @@ def mock_traccar_api_client() -> Generator[AsyncMock, None, None]:
             "traccar_server/reports_events.json"
         )
 
+        client.subscribe = AsyncMock()
+
         yield client
 
 
diff --git a/tests/components/traccar_server/snapshots/test_diagnostics.ambr b/tests/components/traccar_server/snapshots/test_diagnostics.ambr
index 0492291384d70b..1726f1c3d45e89 100644
--- a/tests/components/traccar_server/snapshots/test_diagnostics.ambr
+++ b/tests/components/traccar_server/snapshots/test_diagnostics.ambr
@@ -13,7 +13,7 @@
       ]),
     }),
     'coordinator_data': dict({
-      'abc123': dict({
+      '0': dict({
         'attributes': dict({
           'custom_attr_1': 'custom_attr_1_value',
         }),
@@ -96,6 +96,7 @@
         }),
       }),
     ]),
+    'subscription_status': 'disconnected',
   })
 # ---
 # name: test_entry_diagnostics[entry]
@@ -112,7 +113,7 @@
       ]),
     }),
     'coordinator_data': dict({
-      'abc123': dict({
+      '0': dict({
         'attributes': dict({
           'custom_attr_1': 'custom_attr_1_value',
         }),
@@ -195,5 +196,6 @@
         }),
       }),
     ]),
+    'subscription_status': 'disconnected',
   })
 # ---


Code review comments:
diff_hunk: @@ -123,12 +110,47 @@ async def _async_update_data(self) -> TraccarServerCoordinatorData:
                 "attributes": attr,
             }
 
-        if self.events:
-            self.hass.async_create_task(self.import_events(devices))
+        await self.subscribe()
 
         return data
 
-    async def import_events(self, devices: list[DeviceModel]) -> None:
+    async def handle_sunscription_data(self, data: SubscriptionData) -> None:
path: homeassistant/components/traccar_server/coordinator.py
text: @user1:
```suggestion
    async def handle_subscription_data(self, data: SubscriptionData) -> None:
```


@author:
🌞