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
8 changed files with 11 additions and 17 deletions
|
@ -1,7 +1,7 @@
|
|||
"""Support for FRITZ!Box routers."""
|
||||
import logging
|
||||
|
||||
from fritzconnection import FritzHosts # pylint: disable=import-error
|
||||
from fritzconnection.lib.fritzhosts import FritzHosts
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.device_tracker import (
|
||||
|
@ -68,7 +68,7 @@ class FritzBoxScanner(DeviceScanner):
|
|||
self._update_info()
|
||||
active_hosts = []
|
||||
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"])
|
||||
return active_hosts
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"domain": "fritz",
|
||||
"name": "AVM Fritzbox",
|
||||
"documentation": "https://www.home-assistant.io/integrations/fritz",
|
||||
"requirements": ["fritzconnection==0.8.4"],
|
||||
"requirements": ["fritzconnection==1.2.0"],
|
||||
"dependencies": [],
|
||||
"codeowners": []
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"domain": "fritzbox_callmonitor",
|
||||
"name": "AVM FRITZ!Box Call Monitor",
|
||||
"documentation": "https://www.home-assistant.io/integrations/fritzbox_callmonitor",
|
||||
"requirements": ["fritzconnection==0.8.4"],
|
||||
"requirements": ["fritzconnection==1.2.0"],
|
||||
"dependencies": [],
|
||||
"codeowners": []
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import socket
|
|||
import threading
|
||||
import time
|
||||
|
||||
import fritzconnection as fc # pylint: disable=import-error
|
||||
from fritzconnection.lib.fritzphonebook import FritzPhonebook
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
|
@ -256,7 +256,7 @@ class FritzBoxPhonebook:
|
|||
self.prefixes = prefixes or []
|
||||
|
||||
# Establish a connection to the FRITZ!Box.
|
||||
self.fph = fc.FritzPhonebook(
|
||||
self.fph = FritzPhonebook(
|
||||
address=self.host, user=self.username, password=self.password
|
||||
)
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"domain": "fritzbox_netmonitor",
|
||||
"name": "AVM FRITZ!Box Net Monitor",
|
||||
"documentation": "https://www.home-assistant.io/integrations/fritzbox_netmonitor",
|
||||
"requirements": ["fritzconnection==0.8.4"],
|
||||
"requirements": ["fritzconnection==1.2.0"],
|
||||
"dependencies": [],
|
||||
"codeowners": []
|
||||
}
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from fritzconnection import FritzStatus # pylint: disable=import-error
|
||||
from fritzconnection.fritzconnection import ( # pylint: disable=import-error
|
||||
FritzConnectionException,
|
||||
)
|
||||
from fritzconnection.core.exceptions import FritzConnectionException
|
||||
from fritzconnection.lib.fritzstatus import FritzStatus
|
||||
from requests.exceptions import RequestException
|
||||
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_UP = "max_byte_rate_up"
|
||||
ATTR_UPTIME = "uptime"
|
||||
ATTR_WAN_ACCESS_TYPE = "wan_access_type"
|
||||
|
||||
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=5)
|
||||
|
||||
|
@ -73,7 +70,7 @@ class FritzboxMonitorSensor(Entity):
|
|||
self._name = name
|
||||
self._fstatus = fstatus
|
||||
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._bytes_sent = self._bytes_received = None
|
||||
self._transmission_rate_up = None
|
||||
|
@ -104,7 +101,6 @@ class FritzboxMonitorSensor(Entity):
|
|||
attr = {
|
||||
ATTR_IS_LINKED: self._is_linked,
|
||||
ATTR_IS_CONNECTED: self._is_connected,
|
||||
ATTR_WAN_ACCESS_TYPE: self._wan_access_type,
|
||||
ATTR_EXTERNAL_IP: self._external_ip,
|
||||
ATTR_UPTIME: self._uptime,
|
||||
ATTR_BYTES_SENT: self._bytes_sent,
|
||||
|
@ -122,7 +118,6 @@ class FritzboxMonitorSensor(Entity):
|
|||
try:
|
||||
self._is_linked = self._fstatus.is_linked
|
||||
self._is_connected = self._fstatus.is_connected
|
||||
self._wan_access_type = self._fstatus.wan_access_type
|
||||
self._external_ip = self._fstatus.external_ip
|
||||
self._uptime = self._fstatus.uptime
|
||||
self._bytes_sent = self._fstatus.bytes_sent
|
||||
|
|
|
@ -546,7 +546,7 @@ freesms==0.1.2
|
|||
# homeassistant.components.fritz
|
||||
# homeassistant.components.fritzbox_callmonitor
|
||||
# homeassistant.components.fritzbox_netmonitor
|
||||
# fritzconnection==0.8.4
|
||||
fritzconnection==1.2.0
|
||||
|
||||
# homeassistant.components.fritzdect
|
||||
fritzhome==1.0.4
|
||||
|
|
|
@ -25,7 +25,6 @@ COMMENT_REQUIREMENTS = (
|
|||
"envirophat",
|
||||
"evdev",
|
||||
"face_recognition",
|
||||
"fritzconnection",
|
||||
"i2csense",
|
||||
"opencv-python-headless",
|
||||
"py_noaa",
|
||||
|
|
Loading…
Add table
Reference in a new issue