rytilahti/python-songpal

songpal command in the console

Theiamania opened this issue · 8 comments

I need to subscribe to notifications in my Hassio (Docker), but I cant use 'songpal' command in the console (because is Docker?). It answer me "command not found".

How can I use 'songpal' command in console or in any other way?

You need to access the container where the integrations are installed (and potentially activate the virtualenv, if hassio is using it?).

May I ask why you want to access the notifications?

Do you know where are installed, by default, the integrations in Hassio. Sorry, I'm very newbie with HA.

I want use notifications to get info about the input media, and select the sound mode according this info. A.F.D. is not enough for me.

Unfortunately I'm not familiar with hassio, sorry. Anyway, here's how the source change notification is handled by homeassistant: https://github.com/home-assistant/core/blob/dev/homeassistant/components/songpal/media_player.py#L164 and here's all available properties for the notification (varies between devices): https://github.com/rytilahti/python-songpal/blob/master/songpal/notification.py#L160 which can be helpful if you are going to modify the code.

I may be wrong, but by reviewing the Sony API it seems like the only way to get the information I need is using notifyPlayingContentInfo.

In python-songpal I suppose that i must use songpal notifications --listen-all avContent to get this info. So I want to use the console, since I would not know how to modify your code and adapt it to my needs.

Yes, that's for the console tool to listen for events. The link I gave to homeassistant's code base is where it is being used. But as a word of warning, modifying hassio instances (nor containers) is a simple task, it is much easier to work outside containers, at least for development purposes.

edit: to add, you could simply install songpal locally and start experimenting with it until you get a feeling how it works. To see all notifications you have to use the --debug flag like this: songpal --debug notifications --listen-all

Thank you! I'll try it

Did you get it working? Can this be closed now?

Yes, it can be closed. I have finally chosen to use node-red to solve it. But I still use your addon in HA. Thank you so much for everything