Skip to content
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

State not updating consistently #149

Open
jhemak opened this issue Dec 31, 2024 · 19 comments
Open

State not updating consistently #149

jhemak opened this issue Dec 31, 2024 · 19 comments

Comments

@jhemak
Copy link

jhemak commented Dec 31, 2024

I am seeing situations where the player state is not updating automatically. When the player is on, the state sometimes does not update unless I change the volume using HA, which seems to trigger an immediate update. If the player is off, the state may remain idle or paused in HA and changing the volume does not update. If I reload the integration, however, the state correctly changes to off.

@cdnninja
Copy link
Owner

Could I get a copy of the debug logs? What I have seen in the past is the server side stops sending updates. A "wake up" is needed. Right now this integration does that at the set update interval if is hasn't seen an update. Maybe I need to make that more aggressive.

@jhemak
Copy link
Author

jhemak commented Jan 2, 2025

What sort of test do I need to do in order to capture the information you are looking for in the debug logs?

Your suggestion sounds right -- what is the current update interval?

@cdnninja
Copy link
Owner

cdnninja commented Jan 2, 2025

Just ensure the symptom of no update happens.

The update interval isn't really relevant, since it's pushed from the server in real time. The poll to api is set in your config. I think default is an hour or so.

@jhemak
Copy link
Author

jhemak commented Jan 3, 2025

There's a lot of info in the log - I'm not sure I want to share it in full here. If that means you aren't able to investigate further at this time, then feel free to close this.

However, I do notice messages in the logs once per hour where it looks like Status and Config is retrieved. There are success messages at the end of each block.

Even so, I observed that the state of a device that had gone Idle several hours earlier was still reflected in HA as "Playing" until I reloaded the integration at which point the state immediately changed to Off.

The last message related to that device, aside from the subsequent hourly polls, refers to inactivityShutdown.

Sort of seems to me that messages are being delivered, but the state in not updating in HA until the reload.

@cdnninja
Copy link
Owner

cdnninja commented Jan 3, 2025

Any Mqtt disconnect messages in the logs?

You could try see if dropping the update interval to 30 improves things.

Also does opening the native Yoto app "wake it up"?

@jhemak
Copy link
Author

jhemak commented Jan 3, 2025

The only disconnect message in the logs are when I reload the integration.

A couple things I've found:

  • when the device goes idle and then auto-powers off, it keeps its state in HA but shows as Offline in the native app
  • after this, when the device is powered on, it keeps its state in HA but shows as Online in the native app

Opening the native app doesn't change anything in HA. Reloading the integration causes the correct state to be displayed.

@cdnninja
Copy link
Owner

cdnninja commented Jan 3, 2025

What's your update interval set to?

@jhemak
Copy link
Author

jhemak commented Jan 3, 2025

30 min

@cdnninja
Copy link
Owner

cdnninja commented Jan 3, 2025

After other sensors update does it work okay? Does using the native app also solve it?

@jhemak
Copy link
Author

jhemak commented Jan 3, 2025

Sorry, I'm not sure I understand either of those questions. Please clarify what you'd like me to test and I'll be happy to give it a try!

@cdnninja
Copy link
Owner

cdnninja commented Jan 4, 2025

Typically I find if the server side stops sending updates for card playing status. 1. Open the app and see content in it. It will also update home assistant. 2. If you see the 30 minute update interval hit. It will "wake up" the server as well as I have code that pings server side.

I am trying to confirm if both one and two occur. If so reducing you update interval will improve or remove you issue.

@jhemak
Copy link
Author

jhemak commented Jan 4, 2025

I just woke up a player and started content. HA continued to show "Off". I then opened the native app and selected the player to see the content that was playing. This action in the native app caused the state in HA to update to "Playing."

@cdnninja
Copy link
Owner

cdnninja commented Jan 4, 2025

Okay. Assuming it shows playing and the correct content try drop your update interval to 20 minutes and see if that helps.

@jhemak
Copy link
Author

jhemak commented Jan 4, 2025

Unfortunately, that does not seem to have changed anything.

@jhemak
Copy link
Author

jhemak commented Jan 15, 2025

Just an update that this continues. Are you seeing the same symptoms? For now I have the integration reloading via an automation every 20 min as a workaround.

@cdnninja
Copy link
Owner

No I don't have this issue. Without logs, screenshots etc not much I can do.

@wardy277
Copy link

wardy277 commented Jan 20, 2025

I also have this issue. It happened this morning. The yoto player was on and playing a card. The home assistant entity showed it as off since the night before.

I didn't touch home assistant, I mearly opened the yoto app which shows the yoto playing. Going back to home assistant, it now correctly shows as playing.

There is nothing in the logs at this time.

This has happened before, so seems like the plugin is asleep. If the 30 minute wake action was working, the sensor would wait for this, and not instantly update when the yoto app is opened

This plugin works great most of the time. I get instant updates and use it to alert when it's being playing for over an hour at night and when the battery is low.

@cdnninja
Copy link
Owner

@wardy277 debug logs must be enabled for it to show info that is helpful. What I have experienced in the past is this:

  1. MQTT messages from Yoto server side should keep coming until we disconnect.
  2. After some time the server decides to stop sending us messages.
  3. "pinging" the server for an update wakes this up and we get updates again.

A few things wake up the yoto server:

  1. Opening the native app.
  2. Us sending any command.

Right now when the update interval is hit we do two broad things:

  1. Update API dataset such as device configuration (Day/Night mode settings, alarm settings etc)
  2. If last update from the server is dated on the mqtt (what's playing) side send an update request.

I can only assume this is the case but still need logs to confirm we aren't loosing connection or something like that. It does sound like connection is still good though since native app fixes it.

I personally haven't experienced it since putting in that update request into the code awhile back however my personal automations currently aren't tied to card insert so may miss this.

Logs would be great for this - I want to confirm:

  1. Messaging from mqtt stop coming in.
  2. No disconnect errors occur.
  3. What interval are we requesting an update to mqtt when this occurs - maybe I need more aggressive logic on this.

When this occur if you don't open the app does it recover on next scan interval?

@cdnninja
Copy link
Owner

Is this occurring when the device is powered off, you turn it on and insert a card?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants