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

Changing the Volume don't work when the Wifi Device goes into sleep mode #55

Open
epicbenz opened this issue Oct 30, 2023 · 6 comments
Open
Assignees
Labels
question Further information is requested

Comments

@epicbenz
Copy link

epicbenz commented Oct 30, 2023

Describe Your Problem:

Hi Joey, its me again xD

I noticed the following problem, maybe you can help me with it.
As you have already recognized in problem #47, the Amazon Echo Dot goes into sleep mode after some time. Here you had the idea to insert a retry delay for the device.
Is that also possible for the volume control?
Background is that I would like to build an automation, where at different times a different volume is set.
However, if I activate a trigger (e.g.) a time and the Amazon Echo is then in sleep mode, then I get the error below and the volume is not changed.
When the Amazon Echo is not in sleep mode, changing the volume works without problems.
Is there also a possibility here with a retry delay or does this only work when "switching on" the playlist?

Logs:

[10/30/2023, 9:20:04 PM] [HomebridgeSpotifySpeaker] SpotifyDeviceNotFoundError: "{\"error\":{\"status\":404,\"message\":\"Device not found\"}}"

Plugin Config:

{
    "bridge": {
        "name": "Homebridge XXXX",
        "username": "XX:XX:XX:XX:XX:XX",
        "port": 51640,
        "pin": "xxx-xx-xxx",
        "advertiser": "avahi"
    },
    "accessories": [],
    "platforms": [],
        {
            "name": "HomebridgeSpotifySpeaker",
            "spotifyClientId": "ClientID",
            "spotifyClientSecret": "ClientSecret",
            "spotifyRedirectUri": "https://example.com/callback",
            "spotifyAuthCode": "AuthCode",
            "spotifyPollInterval": 20,
            "deviceNotFoundRetry": {
                "enable": true,
                "retryDelay": 2000
            },
            "devices": [
                {
                    "deviceName": "Bad Musik",
                    "deviceType": "speaker",
                    "spotifyDeviceName": "Andreas' 2. Echo Dot",
                    "spotifyPlaylistUrl": "https://open.spotify.com/playlist/xxxxxxxxxx",
                    "playlistShuffle": true,
                    "playlistRepeat": false
                }
            ],
            "debug": false,
            "platform": "HomebridgeSpotifySpeaker"
        },
    "disabledPlugins": []
}


Screenshots:

Environment:

  • Plugin Version: v1.3.3
  • Homebridge Version: v1.6.1
  • Node.js Version: v18.15.0
  • NPM Version:
  • Operating System: Synology NAS
@epicbenz epicbenz added the question Further information is requested label Oct 30, 2023
@epicbenz
Copy link
Author

A Little Reminder :)

@joeyhage
Copy link
Owner

@epicbenz the retry I put in place previously is also in place for changing volume. As I think about what you are asking, I don't think it is possible using Spotify. Here's why:

If the device you want to change the volume of is sleeping, that means there is nothing playing on the device. If nothing is playing, then Spotify doesn't have an active connection to the device. Based on what I have experienced, an active connection to the device is required to change the volume.

You may need to start a playlist, change the volume, then stop the playlist if you want to change the volume while nothing is playing.

@epicbenz
Copy link
Author

epicbenz commented Dec 4, 2023

@epicbenz the retry I put in place previously is also in place for changing volume. As I think about what you are asking, I don't think it is possible using Spotify. Here's why:

If the device you want to change the volume of is sleeping, that means there is nothing playing on the device. If nothing is playing, then Spotify doesn't have an active connection to the device. Based on what I have experienced, an active connection to the device is required to change the volume.

You may need to start a playlist, change the volume, then stop the playlist if you want to change the volume while nothing is playing.

Hmm, okay i have thought that it won't be possible.

Thanks anyway for your work.

@epicbenz epicbenz closed this as completed Dec 4, 2023
@epicbenz epicbenz reopened this Dec 5, 2023
@epicbenz
Copy link
Author

epicbenz commented Dec 5, 2023

@epicbenz the retry I put in place previously is also in place for changing volume. As I think about what you are asking, I don't think it is possible using Spotify. Here's why:

If the device you want to change the volume of is sleeping, that means there is nothing playing on the device. If nothing is playing, then Spotify doesn't have an active connection to the device. Based on what I have experienced, an active connection to the device is required to change the volume.

You may need to start a playlist, change the volume, then stop the playlist if you want to change the volume while nothing is playing.

Hi,

I think I have an idea to solve this problem.

Would it be possible to do this?:

  1. Trigger (Time) -> Echo plays a playlist with a silent song, wait 30 seconds and than changes the volume to xx% wait again 30 seconds and stops playing
  2. Trigger (Sensor) -> Echo plays the normal playlist
  3. Trigger (other Time) -> Echo plays a playlist with a silent song, wait 30 seconds and than changes the volume to xx% wait again 30 seconds and stops playing

Or is it not possible to deposit two different playlists/songs?

I have tried to do my Automation in Home Assistant but there is the same problem with the idle of the echo dot.

@epicbenz
Copy link
Author

epicbenz commented Dec 8, 2023

@joeyhage

I have tried this:

I have set a second device with another name and another playlist. So I have the device "Bad 1" with playlist 1 and device "Bad 2" with a completely silent playlist.

Now I have created an automation, In that the time triggers "Bad 2" and the Echo Dot plays a silent Playlist. After 1 min the volume is changed to xx%. After another Minute I stop "Bad 2", so the Echo Dot changes silent the volume.

But sometimes it works perfectly, and sometimes I get this error:

[12/8/2023, 10:30:03 PM] [HomebridgeSpotifySpeaker] Unexpected error when making request to Spotify: {"error":{"status":403,"message":"Player command failed: Restriction violated","reason":"UNKNOWN"}}

Do you know what is wrong or why it sometimes works and sometimes not?

I really don't get it why it sometimes works exactly like it should and sometimes just not.

@joeyhage
Copy link
Owner

@epicbenz Apologies for the delayed response! I did a little research and it sounds like that error happens when a play request is sent to a device already playing or a pause request is sent to a device that is already paused.

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

No branches or pull requests

2 participants