-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integration Update Speed #46
Comments
Can you enable logging and paste output? The behavior is to check every 10 minutes, but if the most recent update shows the game starting within 20 minutes, the interval updates to 10 seconds. Logically this should capture all games and have you in 10s intervals anywhere between 9:59 until kickoff or kickoff itself. The only thing I can think of is the kickoff time changing close to kickoff. |
Thanks for responding. I only have the Seahawks configured and game is on
right now. It is updating every 10ish seconds currently. I'll have to wait
until the next game and start the debug logs starting around the 25 minute
mark and see if it changes to 10 seconds when it hits 20 minutes. Next
Seahawks game is 1:05 on 10/22 so I'll turn it on around 12:40. Thanks!
…On Sun, Oct 15, 2023 at 12:10 PM Zac ***@***.***> wrote:
Can you enable logging and paste output? The behavior is to check every 10
minutes, but if the most recent update shows the game starting within 20
minutes, the interval updates to 10 seconds.
Logically this should capture all games and have you in 10s intervals
anywhere between 9:59 until kickoff or kickoff itself.
The only thing I can think of is the kickoff time changing close to
kickoff.
—
Reply to this email directly, view it on GitHub
<#46 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASH5EGIXUOEHLKYUJMCHQODX7QYLLAVCNFSM6AAAAAA6BEJO4SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRTGQ3TQMRUHE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
- Andrew
|
Appreciate the logs. The logic is pretty basic, but it could even just be a weird race condition and I need to bump the "poll fast" trigger from 20 to 30 min (not a big deal). As a fellow [tortured] Hawks fan I will be at the clink for next week's game so will check back in afterward 😎. |
Ok so here are some things I found out.
My 10 minute updates were currently at 12:44 and 12:54. Once the 12:54
update happened (since it was within 20 minutes of the game), it changed to
update every 5 seconds.
I have an automation to alert me that kickoff is "in 15 minutes" and it
didn't trigger, which is weird.
- platform: state
entity_id:
- sensor.nfl
to: in 15 minutes
for:
hours: 0
minutes: 0
seconds: 0
So then, kickoff happened and the sensor didn't flip from PRE to IN. A few
seconds after actual kickoff, the sensor went unavailable and stayed
unavailable for a couple of minutes. Then became available again and the
sensor then changed from unavailable to IN.
Logs attached.
Hope you are having fun at the game!
…On Sun, Oct 15, 2023 at 1:13 PM Zac ***@***.***> wrote:
Appreciate the logs. The logic is pretty basic, but it could even just be
a weird race condition and I need to bump the "poll fast" trigger from 20
to 30 min (not a big deal).
As a fellow [tortured] Hawks fan I will be at the clink for next week's
game so will check back in afterward 😎.
—
Reply to this email directly, view it on GitHub
<#46 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASH5EGN72ZTVGNCFDNQ7IGDX7Q7WVAVCNFSM6AAAAAA6BEJO4SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRTGQ4TEOJXHA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
- Andrew
|
You're checking the state of the actual sensor, which will never evaluate to "in 15 minutes". The only states for the sensor are "PRE", "IN", "POST" and "BYE". You could change the automation to work with the 'kickoff_in' attribute, but I think you'd be better off with a template trigger that uses the date attribute and compares it to the current time. I think something like this would work. You'd probably want to add a condition that sensor.nfl state is "PRE", otherwise reboots after (up until Wednesday of the following week) or during the game would have the potential to trigger the automation as well. |
Thanks for the info and template suggestions. I very much appreciate it.
I didn't copy the attribute portion of that trigger so it was working some
of the time:
platform: state
entity_id:
- sensor.nfl
to: in 15 minutes
for:
hours: 0
minutes: 0
seconds: 0
attribute: kickoff_in
I'll try out your template for sure. Templating is something I want to get
more proficient at. That looks way better and more reliable than what I was
doing!
…On Tue, Oct 24, 2023, 12:27 D34DC3N73R ***@***.***> wrote:
You're checking the state of the actual sensor, which will never evaluate
to "in 15 minutes". The only states for the sensor are "PRE", "IN", "POST"
and "BYE".
You could change the automation to work with the 'kickoff_in' attribute,
but I think you'd be better off with a template trigger that uses the date
attribute and compares it to the current time. I think something like this
would work.
{{ not is_state('sensor.nfl', 'unknown') and not is_state('sensor.nfl',
'unavailable') and as_timestamp(state_attr('sensor.nfl', 'date')) <=
(as_timestamp(now()) + (15 * 60)) }}
That has the benefit of triggering the automation even if the sensor is
unavailable for the 15th minute before the game.
You'd probably want to add a condition that sensor.nfl state is "PRE",
otherwise reboots after (up until Wednesday of the following week) or
during the game would have the potential to trigger the automation as well.
—
Reply to this email directly, view it on GitHub
<#46 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASH5EGP4BNVUDMCCYE6MP5TYBAJAPAVCNFSM6AAAAAA6BEJO4SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZXHA4DSNBZHE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
you can incorporate the PRE condition in the template as well You can test out any template in developer tools > templates |
Fyi - with today's seahawks game, as soon as the kickoff happened, it went from PRE to unavailable. Then about 30 seconds later, it turned to IN. So something seems to be happening right at kickoff to make the integration go unavailable. Here is the error I see in the Core logs: This error originated from a custom integration. Logger: custom_components.nfl Error fetching NFL data: 0, message='Attempt to decode JSON with unexpected mimetype: ', url=URL('http://site.api.espn.com/apis/site/v2/sports/football/nfl/scoreboard') |
Thanks for the log output. Looks like a race condition where the game's kickoff time has passed, but ESPN has yet to create all the data (probably because in reality the game hasn't actually started). I can probably fix by wrapping a bunch of stuff in try/catch. |
Hey there, just an update to this. Same thing occurring this season. As soon as kickoff happened today, the sensor went unavailable and then came back a little later. I didn't have debug on, but I caught this in the logs. 2024-09-15 10:03:10.646 ERROR (MainThread) [custom_components.nfl] Error fetching NFL data: 'awayTimeouts' 2024-09-15 10:05:07.658 DEBUG (MainThread) [custom_components.nfl] Getting state for SEA from http://site.api.espn.com/apis/site/v2/sports/football/nfl/scoreboard |
Hi there - I have noticed this year that when in PRE status (especially when getting close to the game like under an hour), that the card doesn't seem to update very fast (updates every 20 minutes or so). I have some super sweet lighting automations tied to when the status of the game switches from PRE to IN and today for example, the integration didn't update until about 4 minutes after kick off. Is there anyway to increase the update frequency when it gets close to the start of the game? Thanks!
The text was updated successfully, but these errors were encountered: