Clean up speedtest (#41139)

* Remove unused error string + add server list log msg

* Use more common reference texts

* Revert translation files + correct typos
This commit is contained in:
Philip Allgaier 2020-10-12 06:03:45 +02:00 committed by GitHub
parent f787289ea0
commit 59edb25e4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 10 additions and 27 deletions

View file

@ -1,2 +1,2 @@
speedtest: speedtest:
description: Immediately take a speedest with Fast.com description: Immediately execute a speed test with Fast.com

View file

@ -1,5 +1,5 @@
speedtest: speedtest:
description: Immediately take a speedest with iperf3 description: Immediately execute a speed test with iperf3
fields: fields:
host: host:
description: The host name of the iperf3 server (already configured) to run a test with. description: The host name of the iperf3 server (already configured) to run a test with.

View file

@ -60,7 +60,6 @@ def server_id_valid(server_id):
async def async_setup(hass, config): async def async_setup(hass, config):
"""Import integration from config.""" """Import integration from config."""
if DOMAIN in config: if DOMAIN in config:
hass.async_create_task( hass.async_create_task(
hass.config_entries.flow.async_init( hass.config_entries.flow.async_init(
@ -139,6 +138,7 @@ class SpeedTestDataCoordinator(DataUpdateCoordinator):
try: try:
server_list = self.api.get_servers() server_list = self.api.get_servers()
except speedtest.ConfigRetrievalError: except speedtest.ConfigRetrievalError:
_LOGGER.debug("Error retrieving server list")
return return
self.servers[DEFAULT_SERVER] = {} self.servers[DEFAULT_SERVER] = {}

View file

@ -1,6 +1,4 @@
"""Config flow for Speedtest.net.""" """Config flow for Speedtest.net."""
import logging
import voluptuous as vol import voluptuous as vol
from homeassistant import config_entries from homeassistant import config_entries
@ -18,8 +16,6 @@ from .const import (
) )
from .const import DOMAIN # pylint: disable=unused-import from .const import DOMAIN # pylint: disable=unused-import
_LOGGER = logging.getLogger(__name__)
class SpeedTestFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): class SpeedTestFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
"""Handle Speedtest.net config flow.""" """Handle Speedtest.net config flow."""

View file

@ -1,6 +1,4 @@
"""Support for Speedtest.net internet speed testing sensor.""" """Support for Speedtest.net internet speed testing sensor."""
import logging
from homeassistant.const import ATTR_ATTRIBUTION from homeassistant.const import ATTR_ATTRIBUTION
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.helpers.restore_state import RestoreEntity from homeassistant.helpers.restore_state import RestoreEntity
@ -19,8 +17,6 @@ from .const import (
SENSOR_TYPES, SENSOR_TYPES,
) )
_LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass, config_entry, async_add_entities): async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the Speedtestdotnet sensors.""" """Set up the Speedtestdotnet sensors."""

View file

@ -1,2 +1,2 @@
speedtest: speedtest:
description: Immediately take a speedest with Speedtest.net description: Immediately execute a speed test with Speedtest.net

View file

@ -2,13 +2,12 @@
"config": { "config": {
"step": { "step": {
"user": { "user": {
"title": "Set up SpeedTest", "description": "[%key:common::config_flow::description::confirm_setup%]"
"description": "Are you sure you want to set up SpeedTest?"
} }
}, },
"abort": { "abort": {
"single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]", "single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]",
"wrong_server_id": "Server id is not valid" "wrong_server_id": "Server ID is not valid"
} }
}, },
"options": { "options": {
@ -20,9 +19,6 @@
"server_name": "Select test server" "server_name": "Select test server"
} }
} }
},
"error": {
"retrive_error": "Error retriving servers list"
} }
} }
} }

View file

@ -1,21 +1,16 @@
{ {
"config": { "config": {
"abort": { "abort": {
"one_instance_allowed": "Only a single instance is necessary.", "single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]",
"single_instance_allowed": "Already configured. Only a single configuration possible.", "wrong_server_id": "Server ID is not valid"
"wrong_server_id": "Server id is not valid"
}, },
"step": { "step": {
"user": { "user": {
"description": "Are you sure you want to set up SpeedTest?", "description": "[%key:common::config_flow::description::confirm_setup%]"
"title": "Set up SpeedTest"
} }
} }
}, },
"options": { "options": {
"error": {
"retrive_error": "Error retriving servers list"
},
"step": { "step": {
"init": { "init": {
"data": { "data": {