Split out speedtestdotnet into a sensor and component (#8378)

* Rename sensor.speedtest to sensor.speedtestdotnet

* Split out speedtestdotnet into a sensor and component

* Fix example

* Collapse down to a single component page

* Reset permissions

* ✏️ Tweaks
This commit is contained in:
Rohan Kapoor 2019-02-12 00:57:15 -08:00 committed by Franck Nijhof
parent 9b03a15e16
commit da057b01bd

View File

@ -8,41 +8,42 @@ comments: false
sharing: true
footer: true
logo: speedtest.png
ha_category: System Monitor
ha_category:
- System Monitor
- Sensor
featured: false
ha_release: 0.13
ha_iot_class: "Cloud Polling"
redirect_from:
- /components/sensor.speedtest/
- /components/sensor.speedtestdotnet/
---
The `speedtest` sensor component uses the [Speedtest.net](https://speedtest.net/)
web service to measure network bandwidth performance.
The `speedtestdotnet` component uses the [Speedtest.net](https://speedtest.net/) web service to measure network bandwidth performance.
Enabling this component will automatically create the Speedtest.net Sensors for the monitored conditions (below).
By default, a speed test will be run every hour. The user can change the update frequency in the configuration by defining the `update_interval` for a speed test to run.
## {% linkable_title Configuration %}
By default, it will run every hour. The user can change the update frequency in
the configuration by defining the minute and hour for a speed test to run.
For the `server_id` check the list of
[available servers](https://www.speedtest.net/speedtest-servers.php).
To add a Speedtest.net sensor to your installation,
add the following to your `configuration.yaml` file:
To add Speedtest.net sensors to your installation, add the following to your `configuration.yaml` file:
Once per hour, on the hour (default):
```yaml
# Example configuration.yaml entry
sensor:
- platform: speedtest
monitored_conditions:
- ping
- download
- upload
speedtestdotnet:
```
{% configuration %}
monitored_conditions:
description: Sensors to display in the frontend.
required: true
required: false
default: All keys
type: list
keys:
ping:
@ -55,29 +56,40 @@ sensor:
description: Specify the speed test server to perform the test against.
required: false
type: integer
hour:
description: Specify the hour(s) of the day to schedule the speed test. Use a list for multiple entries.
update_interval:
description: "Minimum time interval between updates. Supported formats: `update_interval: 'HH:MM:SS'`, `update_interval: 'HH:MM'` and Time period dictionary (see example below)."
required: false
type: [int, list]
minute:
description: Specify the minute(s) of the hour to schedule the speed test. Use a list for multiple entries.
required: false
type: [int, list]
default: 0
second:
description: Specify the second(s) of the minute to schedule the speed test. Use a list for multiple entries.
required: false
type: [int, list]
default: 0
default: 60 minutes
type: time
manual:
description: >
`true` or `false` to turn manual mode on or off.
Manual mode will disable scheduled speed tests.
`true` or `false` to turn manual mode on or off. Manual mode will disable scheduled speed tests.
required: false
type: boolean
default: false
{% endconfiguration %}
#### {% linkable_title Time period dictionary example %}
```yaml
update_interval:
# At least one of these must be specified:
days: 0
hours: 0
minutes: 3
seconds: 30
milliseconds: 0
```
### {% linkable_title Service %}
Once loaded, the `speedtestdotnet` component will expose a service (`speedtestdotnet.speedtest`) that can be called to run a Speedtest.net speed test on demand. This service takes no parameters. This can be useful if you have enabled manual mode.
```yaml
action:
service: speedtestdotnet.speedtest
```
This component uses [speedtest-cli](https://github.com/sivel/speedtest-cli) to
gather network performance data from Speedtest.net.
Please be aware of the potential
@ -91,7 +103,7 @@ test. You can turn on manual mode to disable the scheduled speed tests.
## {% linkable_title Examples %}
In this section, you find some real-life examples of how to use this sensor.
In this section, you find some real-life examples of how to use this component.
### {% linkable_title Run periodically %}
@ -99,31 +111,9 @@ Every half hour of every day:
```yaml
# Example configuration.yaml entry
sensor:
- platform: speedtest
minute:
- 0
- 30
monitored_conditions:
- ping
- download
- upload
```
### {% linkable_title Run at a specific time %}
Everyday at 12:30AM, 6:30AM, 12:30PM, 6:30PM:
```yaml
# Example configuration.yaml entry
sensor:
- platform: speedtest
minute: 30
hour:
- 0
- 6
- 12
- 18
speedtest:
update_interval:
minutes: 30
monitored_conditions:
- ping
- download
@ -139,7 +129,7 @@ automation:
- alias: "Internet Speed Glow Connect Great"
trigger:
- platform: template
value_template: "{{ states('sensor.speedtest_download')|float > 10 }}"
value_template: "{{ states('sensor.speedtest_download')|float >= 10 }}"
action:
- service: shell_command.green
@ -155,7 +145,7 @@ automation:
## {% linkable_title Notes %}
- When running on Raspberry Pi, just note that the maximum speed is limited by its 100 Mbit/s LAN adapter.
- Running this platform can have negative effects on the system's performance as it requires a fair amount of memory.
- Running this component can have negative effects on the system's performance as it requires a fair amount of memory.
- Entries under `monitored_conditions` only control what entities are available in Home Assistant, it does not disable the condition from running.
- If ran frequently, this component has the ability to use a considerable amount of data. Frequent updates should be avoided on bandwidth-capped connections.
- While running, your network capacity is fully utilized. This may have a negative effect on other devices in use the network such as gaming consoles or streaming boxes.