Skip to content

Commit 3d96031

Browse files
committed
DNS Server
1 parent b4d32f0 commit 3d96031

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

models/network/fritzbox_wan_model.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def __init__(self, is_connected: bool, is_linked: bool, connection_uptime: int,
1616
max_bitrate_upstream_str: str, max_byterate_downstream: float, max_byterate_upstream: float,
1717
transmission_rate_downstream: int, transmission_rate_upstream: int,
1818
transmission_rate_downstream_str: str, transmission_rate_upstream_str: str,
19-
current_downstream_rate: int, current_upstream_rate: int):
19+
current_downstream_rate: int, current_upstream_rate: int, dns_server: str):
2020
self.is_connected: bool = is_connected
2121
self.is_linked: bool = is_linked
2222
self.connection_uptime: int = connection_uptime
@@ -41,6 +41,7 @@ def __init__(self, is_connected: bool, is_linked: bool, connection_uptime: int,
4141
self.transmission_rate_upstream_str: str = transmission_rate_upstream_str
4242
self.current_downstream_rate: int = current_downstream_rate
4343
self.current_upstream_rate: int = current_upstream_rate
44+
self.dns_server: str = dns_server
4445

4546
def influx_data(self) -> str:
4647
influx_result = list()
@@ -61,5 +62,6 @@ def influx_data(self) -> str:
6162
InfluxPrint.append(influx_result, "TransmissionRateUpstream", self.transmission_rate_upstream)
6263
InfluxPrint.append(influx_result, "ByteReceiveRate", self.current_downstream_rate)
6364
InfluxPrint.append(influx_result, "ByteSendRate", self.current_upstream_rate)
65+
InfluxPrint.append(influx_result, "DNSServers", self.dns_server)
6466

6567
return ",".join(influx_result)

modules/network/fritz_connect_wan.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ def stats(self) -> FritzboxWANModel:
3232
transmission_rate_downstream_str=self.transmission_rate_downstream_str(),
3333
transmission_rate_upstream_str=self.transmission_rate_upstream_str(),
3434
current_downstream_rate=self.current_downstream_rate(),
35-
current_upstream_rate=self.current_upstream_rate()
35+
current_upstream_rate=self.current_upstream_rate(),
36+
dns_server=self.dns_server()
3637
)
3738

3839
return wan_model
@@ -115,3 +116,10 @@ def packet_downstream_rate(self) -> int:
115116
def packet_upstream_rate(self) -> int:
116117
return self.__WAN_ADDON.get('NewPacketSendRate')
117118

119+
def dns_server(self) -> str:
120+
dns_server_str = ""
121+
if self.__WAN_ADDON.get('NewDNSServer1'):
122+
dns_server_str = self.__WAN_ADDON.get('NewDNSServer1')
123+
if self.__WAN_ADDON.get('NewDNSServer2'):
124+
dns_server_str = f"{dns_server_str},{self.__WAN_ADDON.get('NewDNSServer2')}"
125+
return dns_server_str

0 commit comments

Comments
 (0)