onlyoneme / home-assistant-custom-components-wiim

WiiM devices integration for Home Assistant.
65 stars 9 forks source link

"Playing" when Toslink is selected but nothing is played #12

Open jaid33 opened 1 year ago

jaid33 commented 1 year ago

Hi,

is it possible to distinguish between really playing and just "ready" when optical-in is selected? In the Wiim App I can see some activity symbol, when Toslink is selected and something is played, in Home Assistant it says always playing, even when the optical source is completely powered off. Screenshot_20231003-153745 Screenshot_20231003-153911

onlyoneme commented 1 year ago

This activity icon depends on the play/pause state, it does not reflect if data is coming thru the optical input or not.

jaid33 commented 1 year ago

I understand. Do you know why the HA integration always states "Playing", even when the app says "Paused"? Is this a common problem or only for me? Seems to happen only when Toslink is selected (and maybe Anlaog - didn't test), for Chromecast/Squeezelite/BT it seems to work as expected.

onlyoneme commented 1 year ago

The easiest answer is: because there is no UPnP state check in the code when toslink input is selected, thus it doesn't show a paused state :) Is it somehow important to have it in HA?

jaid33 commented 1 year ago

I have a automation to switch my amplifier on, when something is played and off when it is stopped for some time (it's an old anlog amp with quite some standby power consumption). Currently I have a workaround to switch it also on, when my TV is turn on, but for some situations it's quite tricky to find the right conditions.

onlyoneme commented 1 year ago

Aa I said there is no way actually to detect if an active audio stream is incoming to the WiiM. All I can add is detecting a pause state when toslink is selected.

jaid33 commented 1 year ago

I think this would already fix my problem (or make it at least easier). If I turn off my TV now, the app switches to "paused" after a few seconds and the automatic input selection of the wiim is also working pretty good.

mainTAP commented 1 year ago

I'm having the same issue, detecting a pause state when toslink is selected would be great. It seems like WiiM is reporting 'state' as 'stop' via getPlayerStatus when there's nothing coming in via Toslink.

onlyoneme commented 1 year ago

It rather represents paused state as a stopped status, but WiiM will not go into paused when autosense is disabled even if there is no longer spdif stream coming via optical input.

mainTAP commented 1 year ago

Is there any reason for disregarding the reported state when the source is optical/line in ? Paused or stop would both be useful when the wiim detects that there's no input. If the autosense is disabled, wiim won't go to paused state but that's fine as that's what autosense means so it would have to be stopped/changed manually, and in home assistant it would work as it is now, but if autosense is enabled, it would show the state based on what wiim thinks. thank you

onlyoneme commented 1 year ago

The only reason I can guess is that state tracking for the optical input wasn't very useful when there was no autosense function yet available.

Javerre commented 3 months ago

Any plan to implement this? I find it confusing that the state reported by the HA integration is different (and less useful) than the state reported by the REST API (getPlayerStatus).

I have raised a ticket with WiIM to ask if they could provide an API that exposes whether the player is active or in standby (as used to drive the 12v trigger on the WiiM Pro Plus) but in the absence of this a status that matches the REST API would still be a help when it comes to creating automations.

Javerre commented 2 months ago

I got a response from WiiM support but it was not very helpful. Basically their position is “the app does not need this so we are not putting it in the API”. Fair enough, I guess, but effectively a dead end.

As this was my only interest in this integration I have abandoned using this codebase and just added a REST HA integration based on the state reported by the HTTP API getPlayerStatus. That works better for my purposes as it more accurately reflects whether something is playing or not.