ynot123 / LMS_Controls

Control your Logitech / Squeezeserver players from Home Assistant and Google Home
62 stars 15 forks source link

Startup automation error #18

Closed Bram1nat0r closed 5 years ago

Bram1nat0r commented 5 years ago

Hi,

First of all, hats off to you!! Another good use of my Google Assistant! Works like a charm. Still need time to figure out, how to start translating everything to Dutch. Anyhow : I've gone through the closed thread: Error in automation? opened on Feb7 (not sure if I can re-open this..?), because I'm getting the same error at Hassio startup.

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']

The entity : sensor.raw_volume returns : 30 mixer%20bass%3A0 mixer%20treble%3A0

Did your troubleshoot tips, and I found one player that returns that strange string value for "volume":

Player information:

Player Model: Squeezebox Boom Player Type: boom Firmware: 57 Player IP Address: 192.168.XXX.XXX Player MAC Address: 00:04:20:1e:d9:99

bash-4.4# bash qry_player_stat.sh 00:04:20:1e:d9:99 lms_username is: null login is: not required and lms_secure is: 0 HA Token is: XXXXXXXXXX My Domain is: XXXX.XXXX.XXXX:XXXX My lms_ip: 192.168.XXX.XXX My lms_cli_port: 9090

Query is: 00%3A04%3A20%3A1e%3Ad9%3A99 status player_name%3AZolder%20Achterkamer%20Squeezebox player_connected%3A1 player_ip%3A192.168.XXX.XXX%3A35453 power%3A0 signalstrength%3A0 mode%3Astop remote%3A1 current_title%3A time%3A248.512169057846 rate%3A1 duration%3A264.293 mixer%20volume%3A30 mixer%20bass%3A0 mixer%20treble%3A0 playlist%20repeat%3A0 playlist%20shuffle%3A0 playlist%20mode%3Aoff seq_no%3A0 playlist_cur_index%3A9 playlist_timestamp%3A1557156981.99936 playlist_tracks%3A10 digital_volume_control%3A1 remoteMeta%3AHASH(0xfbdff38) No Sleep Parameter Found - setting to 0 volume:30 mixer%20bass%3A0 mixer%20treble%3A0 shuffle:Off repeat:Off sleep:0 {"attributes": {}, "context": {"id": "f74f479373eb44ba9d1374b20478f4c6", "parent_id": null, "user_id": "dda06aac0709441dadbed8a375df61c9"}, "entity_id": "sensor.raw_volume", "last_changed": "2019-05-09T14:54:19.357134+00:00", "last_updated": "2019-05-09T14:54:19.357134+00:00", "state": "76"} {"attributes": {}, "context": {"id": "49d7327014da4e42aa8a03f7e6ea1658", "parent_id": null, "user_id": "dda06aac0709441dadbed8a375df61c9"}, "entity_id": "sensor.raw_shuffle", "last_changed": "2019-05-09T13:29:53.496936+00:00", "last_updated": "2019-05-09T13:29:53.496936+00:00", "state": "Off"} {"attributes": {}, "context": {"id": "2840f2f4a93c474c9758ceca4d0bef4d", "parent_id": null, "user_id": "dda06aac0709441dadbed8a375df61c9"}, "entity_id": "sensor.raw_repeat", "last_changed": "2019-05-09T13:29:53.638447+00:00", "last_updated": "2019-05-09T13:29:53.638447+00:00", "state": "Off"} {"attributes": {}, "context": {"id": "0114c6cf6f8246d9bee80db3781884a5", "parent_id": null, "user_id": "dda06aac0709441dadbed8a375df61c9"}, "entity_id": "sensor.raw_sleep", "last_changed": "2019-05-09T13:29:53.797022+00:00", "last_updated": "2019-05-09T13:29:53.797022+00:00", "state": "0"}

Any idea what's the problem?

ynot123 commented 5 years ago

Yep, I think so. Thanks for the full output makes troubleshooting much easier. The problem seems to lie in the trim command that strips out the volume number from the player status. The squeezebox boom supports additional settings that many other players don't like bass and treble and these are being returned as well. So to fix, in the shell script qry_player_stat.sh try replacing the following line:

raw_volume=${raw_volume%% playlist%20repeat*} with raw_volume=${raw_volume%% *}

That will effectively strip out (or trim) all characters after the space following the word "volume" which in your example should now leave you with "30"

Let me know if that solves your problem. Should work for all players so will likely post that as an update in the near future. Ynot.

Bram1nat0r commented 5 years ago

Hi Ynot, Thanks for the quick reply. I changed the trim command as you said, and this solved the issue. No more errors in the log, and the sensor.raw_volume entity is nicely set to an integer.