Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

update_entity triggers speedtest when used from a button, but not from an automation (edit: at top of hour) #96441

Closed
jason-curtis opened this issue Jul 12, 2023 · 16 comments

Comments

@jason-curtis
Copy link

jason-curtis commented Jul 12, 2023

The problem

I can't get speedtest to reliably trigger from an automation running at the top of the hour.
edit: workaround per @JN-Jones: adjust the minute to not be 0 or 30.

Here's my automation config:

id: '1687990373473'
alias: Speedtest
description: >-
  runs a speed test hourly but only if the internet hasn't been in use in the
  last ~minute
trigger:
  - platform: time_pattern
    minutes: 0
condition:
  - condition: and
    conditions:
      - condition: numeric_state
        entity_id: sensor.xe75pro_kib_s_sent
        below: 500
      - condition: numeric_state
        entity_id: sensor.xe75pro_kib_s_received
        below: 100
action:
  - service: homeassistant.update_entity
    data: {}
    target:
      entity_id: sensor.speedtest_download
mode: single

Here's an example trace from 8am on July 10:
image

Looks like it worked, right? But when I actually check the data, there is no speed test conducted at that time:
image
I included the network activity in that view so you can see there was a successful test at 10 AM but nothing happened at 8 AM.

Usage with a lovelace button is working

At the same time, I have a lovelace button set up that successfully triggers a speed test every time:

  - show_name: true
    show_icon: true
    type: button
    tap_action:
      action: call-service
      service: homeassistant.update_entity
      target:
        entity_id: sensor.speedtest_download
      data: {}

What version of Home Assistant Core has the issue?

core-2023.7.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

speedtestdotnet

Link to integration documentation on our website

https://www.home-assistant.io/integrations/speedtestdotnet/

Diagnostics information

No response

Example YAML snippet

id: '1687990373473'
alias: Speedtest
description: >-
  runs a speed test hourly but only if the internet hasn't been in use in the
  last ~minute
trigger:
  - platform: time_pattern
    minutes: 0
condition:
  - condition: and
    conditions:
      - condition: numeric_state
        entity_id: sensor.xe75pro_kib_s_sent
        below: 500
      - condition: numeric_state
        entity_id: sensor.xe75pro_kib_s_received
        below: 100
action:
  - service: homeassistant.update_entity
    data: {}
    target:
      entity_id: sensor.speedtest_download
mode: single

Anything in the logs that might be useful for us?

nothing obvious in the logs. It seems like the `homeassistant.update_entity` fires but then nothing happens. I've tried turning on debug logging.

Additional information

No response

@home-assistant
Copy link

Hey there @rohankapoorcom, @engrbm87, mind taking a look at this issue as it has been labeled with an integration (speedtestdotnet) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of speedtestdotnet can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign speedtestdotnet Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


speedtestdotnet documentation
speedtestdotnet source
(message by IssueLinks)

@davidrustingha
Copy link

Same here.
The automation runs smoothly, but doesn't actually update the sensor. Manually triggering the automation does trigger an update.

- alias: Speedtest Check
  id: speed_test_check
  trigger:
    - platform: time_pattern
      minutes: 30
  action:
    - service: homeassistant.update_entity
      data:
        entity_id: sensor.speedtest_download

@DarthSonic
Copy link

Gott the very same issue in my HA installation. Using Integration reload to get new measurement.

@JN-Jones
Copy link

Looks to me like this, #85375, #80290 and possibly #89854 are all the same issue, updates at full and possibly half hours fail because of an issue in the underlying cli tool. Moving the update check two minutes after the full hour worked for me.

@DarthSonic
Copy link

Yes. Triggering every 4 hours on the second minute of the hour works! Thx!

@jason-curtis jason-curtis changed the title update_entity triggers speedtest when used from a button, but not from an automation update_entity triggers speedtest when used from a button, but not from an automation (edit: at top of hour) Aug 24, 2023
@jason-curtis
Copy link
Author

jason-curtis commented Aug 24, 2023

@JN-Jones your workaround works for me too so I added it to the issue description, thank you!

It looks like like sivel/speedtest-cli/#796 would fix this, but in the meantime we can just stop hammering the speedtest servers all at the same time!

@dirrgang
Copy link
Contributor

Ah, sweet. In the meantime this is how I added randomness to the test:

alias: Speedtest
description: ""
trigger:
  - platform: time
    at: "01:00:00"
condition: []
action:
  - delay: "{{ (range(1, 5)|random|int) }}:{{ (range(1, 60)|random|int) }}:00"
  - service: homeassistant.update_entity
    data: {}
    target:
      entity_id:
        - sensor.speedtest_ping
mode: single

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@JN-Jones
Copy link

Yep, still an issue

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@JN-Jones
Copy link

Can corfirm this issue persists in 2024.03.1

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@jason-curtis
Copy link
Author

jason-curtis commented Jun 14, 2024 via email

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@jason-curtis
Copy link
Author

still relevant; good to have this marked as "open" so that folks can find it and the workaround.

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@issue-triage-workflows issue-triage-workflows bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 18, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jan 17, 2025
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

6 participants