mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Fix 'NewIPAddress' error in component fritz (#30210)
* Fix 'NewIPAddress' error in component fritzbox * Upgrade to fritzconnection 1.2.0
This commit is contained in:
parent
1e3b3ecbe6
commit
0d688faa56
@ -1,7 +1,7 @@
|
|||||||
"""Support for FRITZ!Box routers."""
|
"""Support for FRITZ!Box routers."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from fritzconnection import FritzHosts # pylint: disable=import-error
|
from fritzconnection.lib.fritzhosts import FritzHosts
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.device_tracker import (
|
from homeassistant.components.device_tracker import (
|
||||||
@ -68,7 +68,7 @@ class FritzBoxScanner(DeviceScanner):
|
|||||||
self._update_info()
|
self._update_info()
|
||||||
active_hosts = []
|
active_hosts = []
|
||||||
for known_host in self.last_results:
|
for known_host in self.last_results:
|
||||||
if known_host["status"] == "1" and known_host.get("mac"):
|
if known_host["status"] and known_host.get("mac"):
|
||||||
active_hosts.append(known_host["mac"])
|
active_hosts.append(known_host["mac"])
|
||||||
return active_hosts
|
return active_hosts
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"domain": "fritz",
|
"domain": "fritz",
|
||||||
"name": "AVM Fritzbox",
|
"name": "AVM Fritzbox",
|
||||||
"documentation": "https://www.home-assistant.io/integrations/fritz",
|
"documentation": "https://www.home-assistant.io/integrations/fritz",
|
||||||
"requirements": ["fritzconnection==0.8.4"],
|
"requirements": ["fritzconnection==1.2.0"],
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"codeowners": []
|
"codeowners": []
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"domain": "fritzbox_callmonitor",
|
"domain": "fritzbox_callmonitor",
|
||||||
"name": "AVM FRITZ!Box Call Monitor",
|
"name": "AVM FRITZ!Box Call Monitor",
|
||||||
"documentation": "https://www.home-assistant.io/integrations/fritzbox_callmonitor",
|
"documentation": "https://www.home-assistant.io/integrations/fritzbox_callmonitor",
|
||||||
"requirements": ["fritzconnection==0.8.4"],
|
"requirements": ["fritzconnection==1.2.0"],
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"codeowners": []
|
"codeowners": []
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import socket
|
|||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import fritzconnection as fc # pylint: disable=import-error
|
from fritzconnection.lib.fritzphonebook import FritzPhonebook
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
@ -256,7 +256,7 @@ class FritzBoxPhonebook:
|
|||||||
self.prefixes = prefixes or []
|
self.prefixes = prefixes or []
|
||||||
|
|
||||||
# Establish a connection to the FRITZ!Box.
|
# Establish a connection to the FRITZ!Box.
|
||||||
self.fph = fc.FritzPhonebook(
|
self.fph = FritzPhonebook(
|
||||||
address=self.host, user=self.username, password=self.password
|
address=self.host, user=self.username, password=self.password
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"domain": "fritzbox_netmonitor",
|
"domain": "fritzbox_netmonitor",
|
||||||
"name": "AVM FRITZ!Box Net Monitor",
|
"name": "AVM FRITZ!Box Net Monitor",
|
||||||
"documentation": "https://www.home-assistant.io/integrations/fritzbox_netmonitor",
|
"documentation": "https://www.home-assistant.io/integrations/fritzbox_netmonitor",
|
||||||
"requirements": ["fritzconnection==0.8.4"],
|
"requirements": ["fritzconnection==1.2.0"],
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"codeowners": []
|
"codeowners": []
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,8 @@
|
|||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from fritzconnection import FritzStatus # pylint: disable=import-error
|
from fritzconnection.core.exceptions import FritzConnectionException
|
||||||
from fritzconnection.fritzconnection import ( # pylint: disable=import-error
|
from fritzconnection.lib.fritzstatus import FritzStatus
|
||||||
FritzConnectionException,
|
|
||||||
)
|
|
||||||
from requests.exceptions import RequestException
|
from requests.exceptions import RequestException
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
@ -30,7 +28,6 @@ ATTR_IS_LINKED = "is_linked"
|
|||||||
ATTR_MAX_BYTE_RATE_DOWN = "max_byte_rate_down"
|
ATTR_MAX_BYTE_RATE_DOWN = "max_byte_rate_down"
|
||||||
ATTR_MAX_BYTE_RATE_UP = "max_byte_rate_up"
|
ATTR_MAX_BYTE_RATE_UP = "max_byte_rate_up"
|
||||||
ATTR_UPTIME = "uptime"
|
ATTR_UPTIME = "uptime"
|
||||||
ATTR_WAN_ACCESS_TYPE = "wan_access_type"
|
|
||||||
|
|
||||||
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=5)
|
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=5)
|
||||||
|
|
||||||
@ -73,7 +70,7 @@ class FritzboxMonitorSensor(Entity):
|
|||||||
self._name = name
|
self._name = name
|
||||||
self._fstatus = fstatus
|
self._fstatus = fstatus
|
||||||
self._state = STATE_UNAVAILABLE
|
self._state = STATE_UNAVAILABLE
|
||||||
self._is_linked = self._is_connected = self._wan_access_type = None
|
self._is_linked = self._is_connected = None
|
||||||
self._external_ip = self._uptime = None
|
self._external_ip = self._uptime = None
|
||||||
self._bytes_sent = self._bytes_received = None
|
self._bytes_sent = self._bytes_received = None
|
||||||
self._transmission_rate_up = None
|
self._transmission_rate_up = None
|
||||||
@ -104,7 +101,6 @@ class FritzboxMonitorSensor(Entity):
|
|||||||
attr = {
|
attr = {
|
||||||
ATTR_IS_LINKED: self._is_linked,
|
ATTR_IS_LINKED: self._is_linked,
|
||||||
ATTR_IS_CONNECTED: self._is_connected,
|
ATTR_IS_CONNECTED: self._is_connected,
|
||||||
ATTR_WAN_ACCESS_TYPE: self._wan_access_type,
|
|
||||||
ATTR_EXTERNAL_IP: self._external_ip,
|
ATTR_EXTERNAL_IP: self._external_ip,
|
||||||
ATTR_UPTIME: self._uptime,
|
ATTR_UPTIME: self._uptime,
|
||||||
ATTR_BYTES_SENT: self._bytes_sent,
|
ATTR_BYTES_SENT: self._bytes_sent,
|
||||||
@ -122,7 +118,6 @@ class FritzboxMonitorSensor(Entity):
|
|||||||
try:
|
try:
|
||||||
self._is_linked = self._fstatus.is_linked
|
self._is_linked = self._fstatus.is_linked
|
||||||
self._is_connected = self._fstatus.is_connected
|
self._is_connected = self._fstatus.is_connected
|
||||||
self._wan_access_type = self._fstatus.wan_access_type
|
|
||||||
self._external_ip = self._fstatus.external_ip
|
self._external_ip = self._fstatus.external_ip
|
||||||
self._uptime = self._fstatus.uptime
|
self._uptime = self._fstatus.uptime
|
||||||
self._bytes_sent = self._fstatus.bytes_sent
|
self._bytes_sent = self._fstatus.bytes_sent
|
||||||
|
@ -546,7 +546,7 @@ freesms==0.1.2
|
|||||||
# homeassistant.components.fritz
|
# homeassistant.components.fritz
|
||||||
# homeassistant.components.fritzbox_callmonitor
|
# homeassistant.components.fritzbox_callmonitor
|
||||||
# homeassistant.components.fritzbox_netmonitor
|
# homeassistant.components.fritzbox_netmonitor
|
||||||
# fritzconnection==0.8.4
|
fritzconnection==1.2.0
|
||||||
|
|
||||||
# homeassistant.components.fritzdect
|
# homeassistant.components.fritzdect
|
||||||
fritzhome==1.0.4
|
fritzhome==1.0.4
|
||||||
|
@ -25,7 +25,6 @@ COMMENT_REQUIREMENTS = (
|
|||||||
"envirophat",
|
"envirophat",
|
||||||
"evdev",
|
"evdev",
|
||||||
"face_recognition",
|
"face_recognition",
|
||||||
"fritzconnection",
|
|
||||||
"i2csense",
|
"i2csense",
|
||||||
"opencv-python-headless",
|
"opencv-python-headless",
|
||||||
"py_noaa",
|
"py_noaa",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user