Create button to update speedtest

I’ve got a scheduled speedtest integration working, looking like this:

image

and using this script:

sensor:
- platform: speedtest
  minute: 30
  hour: 3
  monitored_conditions:
   - ping
   - dowload
   - upload

So it is running every night at 3.30am.

Now I want to create an update button on this automation part, where I can manually trigger:

sensor.update_speedtest

(which works from a direct service call)

How can I achieve this?

I think a script should do it.

script:
  update_speedtest:
    sequence:
      - service: sensor.update_speedtest
1 Like

Seems to work fine! Thanks for your quick response! I was quite close except for one uppercase too much :wink:

Is this still possible using the speedtest integration as i am unable to call the service or find the update entity. Tia

I think the service call is now part of homeassistant.update ?!?

  action:
    service: homeassistant.update_entity
    data: {}
    target:
      entity_id: sensor.speedtest_download
1 Like

I made a button to call the reload speedtest if anybody wants the code

First a script, i have made the script so it can only run once in 20 seconds to prevent repeated pressing as it shows as unavailable whilst reloading

sequence:
  - condition: not
    conditions:
      - condition: state
        entity_id: sensor.speedtest_download
        state: unavailable
  - service: homeassistant.reload_config_entry
    data:
      entity_id: sensor.speedtest_download
  - delay:
      hours: 0
      minutes: 0
      seconds: 20
      milliseconds: 0
alias: Speedtest update
mode: single

Then the button is a custom button card.

show_name: true
show_icon: true
type: button
tap_action:
  action: call-service
  service: script.speed_test
  data: {}
  target: {}
name: Speed Test
icon: mdi:speedometer
entity: sensor.speedtest_download
show_state: true

2 Likes