Skip to content

Commit 3143ec9

Browse files
authored
2024 codestyle and modernization - part 2 (#90)
1 parent 0acc32e commit 3143ec9

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,23 @@
22
[![GitHub release](https://img.shields.io/github/release/iMicknl/ha-sagemcom-fast.svg)](https://github.com/iMicknl/ha-sagemcom-fast/releases/)
33
[![HA integration usage](https://img.shields.io/badge/dynamic/json?color=41BDF5&logo=home-assistant&label=integration%20usage&suffix=%20installs&cacheSeconds=15600&url=https://analytics.home-assistant.io/custom_integrations.json&query=$.sagemcom_fast.total)](https://analytics.home-assistant.io/custom_integrations.json)
44

5-
# Sagemcom F@st - Home Assistant (work in progress)
5+
# Sagemcom F@st integration for Home Assistant
66

7-
This integration adds support for Sagemcom F@st routers to Home Assistant. Currently this is a work in progress where only a basic device_tracker is supported, however in the future sensors will be added as well.
7+
This integration adds support for Sagemcom F@st routers to Home Assistant. Currently only a basic device_tracker entity is supported, however this could be extended in the future with more sensors.
88

99
Sagemcom F@st routers are used by many providers worldwide, but many of them did rebrand the router. Examples are the b-box from Proximus, Home Hub from bell and the Smart Hub from BT.
1010

11+
## Features
12+
13+
- Device Tracker, to track connected devices to your router (WiFi and Ethernet)
14+
- Reboot button, to reboot your gateway from Home Assistant
15+
16+
## Known limitations / issues
17+
18+
Since this integration is only used by a few users, not much time has been spent on the development lately. There are currently some known limitations and bugs. Contributions are welcome!
19+
20+
- After reboot, not connected devices have status 'unavailable' [#14](https://github.com/iMicknl/ha-sagemcom-fast/issues/14)
21+
1122
## Installation
1223

1324
### Manual

custom_components/sagemcom_fast/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
132132
return unload_ok
133133

134134

135-
async def update_listener(hass: HomeAssistant, entry: ConfigEntry):
135+
async def update_listener(hass: HomeAssistant, entry: ConfigEntry) -> None:
136136
"""Update when entry options update."""
137137
if entry.options[CONF_SCAN_INTERVAL]:
138138
data: HomeAssistantSagemcomFastData = hass.data[DOMAIN][entry.entry_id]

custom_components/sagemcom_fast/config_flow.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ async def async_step_user(self, user_input=None):
7979
errors = {}
8080

8181
if user_input:
82+
# TODO change to gateway mac address or something more unique
8283
await self.async_set_unique_id(user_input.get(CONF_HOST))
8384
self._abort_if_unique_id_configured()
8485

custom_components/sagemcom_fast/device_tracker.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33

44
from homeassistant.components.device_tracker import SourceType
55
from homeassistant.components.device_tracker.config_entry import ScannerEntity
6+
from homeassistant.config_entries import ConfigEntry
7+
from homeassistant.core import HomeAssistant
68
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC, DeviceInfo
9+
from homeassistant.helpers.entity_platform import AddEntitiesCallback
710
from homeassistant.helpers.restore_state import RestoreEntity
811
from homeassistant.helpers.typing import StateType
912
from homeassistant.helpers.update_coordinator import CoordinatorEntity
@@ -14,12 +17,16 @@
1417
from .coordinator import SagemcomDataUpdateCoordinator
1518

1619

17-
async def async_setup_entry(hass, config_entry, async_add_entities):
18-
"""Set up from config entry."""
19-
data: HomeAssistantSagemcomFastData = hass.data[DOMAIN][config_entry.entry_id]
20+
async def async_setup_entry(
21+
hass: HomeAssistant,
22+
entry: ConfigEntry,
23+
async_add_entities: AddEntitiesCallback,
24+
) -> None:
25+
"""Set up device tracker from config entry."""
26+
data: HomeAssistantSagemcomFastData = hass.data[DOMAIN][entry.entry_id]
2027

2128
async_add_entities(
22-
SagemcomScannerEntity(data.coordinator, idx, config_entry.entry_id)
29+
SagemcomScannerEntity(data.coordinator, idx, entry.entry_id)
2330
for idx, device in data.coordinator.data.items()
2431
)
2532

0 commit comments

Comments
 (0)