Skip to content

Commit ea8ae45

Browse files
Crocmagnonclaude
andcommitted
Add Data Grand Lyon integration
New integration for Data Grand Lyon open data platform. Supports config subentries for transit stops (with estimated/theoretical passage merging) and bike sharing stations (with electrical/mechanical bike breakdown). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a5b830c commit ea8ae45

File tree

19 files changed

+2574
-0
lines changed

19 files changed

+2574
-0
lines changed

.strict-typing

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ homeassistant.components.counter.*
154154
homeassistant.components.cover.*
155155
homeassistant.components.cpuspeed.*
156156
homeassistant.components.crownstone.*
157+
homeassistant.components.data_grandlyon.*
157158
homeassistant.components.date.*
158159
homeassistant.components.datetime.*
159160
homeassistant.components.deako.*

CODEOWNERS

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
"""The Data Grand Lyon integration."""
2+
3+
from __future__ import annotations
4+
5+
from data_grand_lyon_ha import DataGrandLyonClient
6+
7+
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform
8+
from homeassistant.core import HomeAssistant
9+
from homeassistant.helpers.aiohttp_client import async_get_clientsession
10+
11+
from .coordinator import DataGrandLyonConfigEntry, DataGrandLyonCoordinator
12+
13+
PLATFORMS: list[Platform] = [Platform.SENSOR]
14+
15+
16+
async def async_setup_entry(
17+
hass: HomeAssistant, entry: DataGrandLyonConfigEntry
18+
) -> bool:
19+
"""Set up Data Grand Lyon from a config entry."""
20+
session = async_get_clientsession(hass)
21+
client = DataGrandLyonClient(
22+
session=session,
23+
username=entry.data.get(CONF_USERNAME),
24+
password=entry.data.get(CONF_PASSWORD),
25+
)
26+
27+
coordinator = DataGrandLyonCoordinator(hass, entry, client)
28+
await coordinator.async_config_entry_first_refresh()
29+
30+
entry.runtime_data = coordinator
31+
32+
entry.async_on_unload(entry.add_update_listener(async_update_entry))
33+
34+
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
35+
36+
return True
37+
38+
39+
async def async_update_entry(
40+
hass: HomeAssistant, entry: DataGrandLyonConfigEntry
41+
) -> None:
42+
"""Handle config entry update (e.g., subentry changes)."""
43+
await hass.config_entries.async_reload(entry.entry_id)
44+
45+
46+
async def async_unload_entry(
47+
hass: HomeAssistant, entry: DataGrandLyonConfigEntry
48+
) -> bool:
49+
"""Unload a config entry."""
50+
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)

0 commit comments

Comments
 (0)