Black
This commit is contained in:
1 parent
da05dfe708
commit
4de97abc3a
2676 files changed
+163166
-140084
No files matched your search
@@ -6,23 +6,20 @@ from homeassistant.helpers.restore_state import RestoreEntity
|
||||
|
||||
from . import ATTR_VERSION, DATA_UPDATED, DOMAIN as IPERF3_DOMAIN, SENSOR_TYPES
|
||||
|
||||
ATTRIBUTION = 'Data retrieved using Iperf3'
|
||||
ATTRIBUTION = "Data retrieved using Iperf3"
|
||||
|
||||
ICON = 'mdi:speedometer'
|
||||
ICON = "mdi:speedometer"
|
||||
|
||||
ATTR_PROTOCOL = 'Protocol'
|
||||
ATTR_REMOTE_HOST = 'Remote Server'
|
||||
ATTR_REMOTE_PORT = 'Remote Port'
|
||||
ATTR_PROTOCOL = "Protocol"
|
||||
ATTR_REMOTE_HOST = "Remote Server"
|
||||
ATTR_REMOTE_PORT = "Remote Port"
|
||||
|
||||
|
||||
async def async_setup_platform(
|
||||
hass, config, async_add_entities, discovery_info):
|
||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info):
|
||||
"""Set up the Iperf3 sensor."""
|
||||
sensors = []
|
||||
for iperf3_host in hass.data[IPERF3_DOMAIN].values():
|
||||
sensors.extend(
|
||||
[Iperf3Sensor(iperf3_host, sensor) for sensor in discovery_info]
|
||||
)
|
||||
sensors.extend([Iperf3Sensor(iperf3_host, sensor) for sensor in discovery_info])
|
||||
async_add_entities(sensors, True)
|
||||
|
||||
|
||||
@@ -31,8 +28,7 @@ class Iperf3Sensor(RestoreEntity):
|
||||
|
||||
def __init__(self, iperf3_data, sensor_type):
|
||||
"""Initialize the sensor."""
|
||||
self._name = \
|
||||
"{} {}".format(SENSOR_TYPES[sensor_type][0], iperf3_data.host)
|
||||
self._name = "{} {}".format(SENSOR_TYPES[sensor_type][0], iperf3_data.host)
|
||||
self._state = None
|
||||
self._sensor_type = sensor_type
|
||||
self._unit_of_measurement = SENSOR_TYPES[sensor_type][1]
|
||||
@@ -66,7 +62,7 @@ class Iperf3Sensor(RestoreEntity):
|
||||
ATTR_PROTOCOL: self._iperf3_data.protocol,
|
||||
ATTR_REMOTE_HOST: self._iperf3_data.host,
|
||||
ATTR_REMOTE_PORT: self._iperf3_data.port,
|
||||
ATTR_VERSION: self._iperf3_data.data[ATTR_VERSION]
|
||||
ATTR_VERSION: self._iperf3_data.data[ATTR_VERSION],
|
||||
}
|
||||
|
||||
@property
|
||||
|
||||
Reference in new issue
Block a user