ynot123 / LMS_Controls

Control your Logitech / Squeezeserver players from Home Assistant and Google Home
63 stars 16 forks source link

GUI issue with Google Mini #16

Closed Mattat01 closed 5 years ago

Mattat01 commented 5 years ago

Hi,

Great work, BTW. I'm installing this and am at the point of testing the GUI. I've found that the 'pause, play, next' glance card works perfectly with my LMS, however, when testing it with the Google Mini the play turns off the speaker. I assume it is because the script first turns the unit on and then starts playing, and the turning on puts Google Mini into idle/ready mode. Also, although it may have nothing to do with your work, when playing Spotify on Google Mini the 'next' button takes the current song to the last second or so instead of the start of the next song (this doesn't occur with my LMS).

I am also regularly getting this error when pressing play, whether it plays or not, and possibly when taking other actions: Error while executing automation automation.lms_gui_update_player_values. Invalid data for call_service at pos 2: expected float for dictionary value @ data['value'], but I've not tracked down the automation for that yet.

I also don't seem to be able to get sync or player controls to command the Google Mini yet, but I may still have the config wrong...

Thanks for the good work.

Cheers, Matthew

Mattat01 commented 5 years ago

I was able to fix it, as expected, with this code:

    lms_cmd_start_player:
      alias:  "LMS command to re-start a media player"
      sequence:
#        - service:  media_player.turn_on
#          data_template:
#            entity_id: "media_player.{{states.input_select.lms_player.state}}"
        - service:  media_player.media_play
          data_template:
            entity_id: "media_player.{{states.input_select.lms_player.state}}"

But I don't know if it will break something else. My LMS still pauses and plays as expected.

ynot123 commented 5 years ago

If you're player is off in LMS then start_player may not function properly. Originally I put that turn_on command there to take care of the player if it was off. If it's now acting as a toggle, then perhaps I may change that bit of code. I will have to review in the future.

Is your google mini setup in LMS using Chromecast plugin in LMS? The LMSControls application will only work properly if it's part of the LMS server system. Mine seem to function as expected. I will do a little more testing with mine to ensure its good. Barely use the mini's due to sound quality issues.

Mattat01 commented 5 years ago

Thanks. It looks like something is required to turn the google mini on if it has gone to sleep (to put it in an idle state), but it does seem to toggle power if it is already on. Perhaps it could be conditional "if it's state is off"?

ynot123 commented 5 years ago

Mine seem to work fine, you will get a chime as it wakes up from the idle state, then it plays as designed. That's what the turn on script does, if an LMS player is off or sleep state. I supposed I could try to query for the state first, but I seem to see no issue with it as is.

Let me know if you're good with closing this item.

Mattat01 commented 5 years ago

Yes, feel free to close it. I've looked closer and the issue I reported was when I'd asked google play a song (though its own link to spotify), then paused it on the LMS control and then tried to play again (it set the mini to idle). I think this is to be expected as LMS is playing a separate system!

I am still getting this error fairly often:

Error running command:bash /config/shell/qry_player_stat.sh {{text1}}, return code: -11

I suspect my config is off somewhere. Do you know what might throw this error?

Thanks.

ynot123 commented 5 years ago

Not too sure about your error code. Usually supposed to be an integer between 0 and 255 if it's a bash shell error. The only thing I can suggest is to turn on the logging for shell command and see what's being sent exactly that causes those errors. To turn on the logging for shell see below for your configuration.yaml file.

logger:
  default: critical
###  Enable the logs below if you need to debug the application
  logs:
    homeassistant.components.shell_command: debug
#    homeassistant.components.intent_script: debug
#    homeassistant.components.dialogflow: debug
#    homeassistant.components.media_player.squeezebox: debug
Mattat01 commented 5 years ago

Thanks. I'll look into it and let you know if it is anything other than my bad config!!!

Thanks again for the component, good work.

ynot123 commented 5 years ago

Welcome