Skip to content

Commit

Permalink
feat: Add some extra data fields (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
lhw authored Dec 28, 2024
1 parent 033d6ea commit 875ad53
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions aiocloudweather/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ def __init__(
self.port: int = port

# Proxy functionality
self.proxy: None | CloudWeatherProxy = None
self.dns_servers: list[str] = dns_servers or ["9.9.9.9"]
self.proxy_sinks: list[DataSink] | None = proxy_sinks
self.proxy_enabled: bool = proxy_sinks and len(proxy_sinks) > 0
if self.proxy_enabled:
self.proxy = CloudWeatherProxy(proxy_sinks, dns_servers or ["9.9.9.9"])
Expand Down Expand Up @@ -66,6 +69,14 @@ async def update_config(
await self.proxy.close()
self.proxy = CloudWeatherProxy(proxy_sinks, dns_servers or ["9.9.9.9"])

def get_active_proxies(self) -> list[DataSink]:
"""Get the active proxies."""
return self.proxy_sinks

def get_dns_servers(self) -> list[str]:
"""Get the DNS servers."""
return self.dns_servers

async def _new_dataset_cb(self, dataset: WeatherStation) -> None:
"""Internal new sensor callback
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ commands =

[testenv:black]
commands =
black --target-version py312 --check aiocloudweather setup.py tests
black --target-version py313 --check aiocloudweather setup.py tests

[testenv:tests]
commands =
Expand Down

0 comments on commit 875ad53

Please sign in to comment.