Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-21 Thread Marsupial


Paul Webster wrote: 
> I presume the simplest thing to do is to create one automation for each
> destination state ... but I expect that there is a clever way to do it
> all in one.

Tested, and it works.

I got rid of node-red, as I wasn't using it otherwise.

Thanks.





Marsupial's Profile: http://forums.slimdevices.com/member.php?userid=59182
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-21 Thread Marsupial


goharbourview123 wrote: 
> Not 100% sure I've understood what you wanted to do, but if you want to
> treat your Squeezebox and your amp as a single controllable entity in
> Home Assistant, you can do this through the Universal Media Player:
> 
> https://www.home-assistant.io/integrations/universal/I didn't know about this 
> one, and will definitely look into it.

I have multiple instances (most of them in fact) where joining multiple
entities would just make sense.

Amplifier power and volume control quickly comes to mind.

Thanks for bringing this to my attention.





Marsupial's Profile: http://forums.slimdevices.com/member.php?userid=59182
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-21 Thread goharbourview123


Not 100% sure I've understood what you wanted to do, but if you want to
treat your Squeezebox and your amp as a single controllable entity in
Home Assistant, you can do this through the Universal Media Player:

https://www.home-assistant.io/integrations/universal/



goharbourview123's Profile: 
http://forums.slimdevices.com/member.php?userid=23031
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-20 Thread Marsupial


Now that I think of it...

When I originally tested this, I was trying to power the switch with
"on" as a state. Which doesn't exist. Which is why I thought it didn't
work... 

Turning power on during idle or playing state, and off during
unavailable and off state. Should work.

Thanks Paul





Marsupial's Profile: http://forums.slimdevices.com/member.php?userid=59182
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-20 Thread Paul Webster


Would need more experimentation but it is on state change.
So I would not expect anything to change when skipping since the player
state remains as "playing".

I presume the simplest thing to do is to create one automation for each
destination state ... but I expect that there is a clever way to do it
all in one.



Paul Webster
http://dabdig.blogspot.com
author of \"now playing\" plugins covering radio france (fip etc), kcrw,
supla finland, abc australia, cbc/radio-canada and rte ireland

Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-20 Thread Marsupial


Paul Webster wrote: 
> This can be done in HASS without NodeRed etc.
> 
> I just set up a simple one ...
> 
> 
> Developer Tools/Automation/Add
> Trigger: State
> Entity: media_player.whicheveroneitis
> To: playing
> 
> Action:
> Turn on switch (etc)
> 
> The light now comes on whenever I hit play.Thanks Paul. I had a feeling there 
> should be a way for it to be accessed
trough hass without additions but just couldn't get it to work... 

Does it turn off when you change songs, etc?

Can it be "off when the player is off or unavailable, on otherwise"?





Marsupial's Profile: http://forums.slimdevices.com/member.php?userid=59182
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-20 Thread Paul Webster


This can be done in HASS without NodeRed etc.

I just set up a simple one ...


Developer Tools/Automation/Add
Trigger: State
Entity: media_player.whicheveroneitis
To: playing

Action:
Turn on switch (etc)

The light now comes on whenever I hit play.



Paul Webster
http://dabdig.blogspot.com
author of \"now playing\" plugins covering radio france (fip etc), kcrw,
supla finland, abc australia, cbc/radio-canada and rte ireland

Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-20 Thread Marsupial


Home assistant has a squeezebox integration and already could display
the status of the various players, or serve as a basic remote for them.
It just couldn't trigger an action on state change (unless I missed how
this can be achieved)


So, node-red poll on the status as seen in home assistant and use that
as a trigger for controlling the power state of the plug that's used for
the amp.

If you have multiple smart things, you may want to look into home
assistant to control all of them under a common ecosystem that includes
squeezebox.





Marsupial's Profile: http://forums.slimdevices.com/member.php?userid=59182
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-20 Thread bpa


Marsupial wrote: 
> From there, I trigger an action (poll state) on a state change of the
> piCorePlayer - the resulting state is text-based and can be "off",
> "idle", etc.  
> There doesn't seem to be power-on state... so I enabled the condition on
> whether or not the state is "off".

Just to complete the picture. 

What did you use to detect & notify player change state  - the
squeezelite "-S", the LMS EventTrigger plugin, something else



bpa's Profile: http://forums.slimdevices.com/member.php?userid=1806
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-19 Thread Marsupial


doing some debugging I realized that at boot time, there's a period
where the player isn't ON yet, but is not OFF either. it is
"unavailable"

So I'll find a way to prevent these unwanted power-on



Marsupial's Profile: http://forums.slimdevices.com/member.php?userid=59182
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-19 Thread Marsupial


I think I got something working.
And it is not super difficult to achieve.


caveat:
I am using Home Assistant to manage my "things"


How?
Within Home Assistant I installed Node-Red. It is a flow programming
tool that can be embedded within Home Assistant and pull information
from it.

>From there, I trigger an action (poll state) on a state change of the
piCorePlayer - the resulting state is text-based and can be "off",
"idle", etc.  
There doesn't seem to be power-on state... so I enabled the condition on
whether or not the state is "off".


the outgoing result (2 triggers) are sent to a "service call" that turns
on or off the power socket.



I have not debugged yet, but this seems to do the trick nicely.


+---+
|Filename: switch.png   |
|Download: http://forums.slimdevices.com/attachment.php?attachmentid=32581|
+---+


Marsupial's Profile: http://forums.slimdevices.com/member.php?userid=59182
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-19 Thread bpa


Marsupial wrote: 
> Is the remote control responding to lms events, or just menu entries?
> 
> I'd want the power to be automated with the on/off state of the
> player...
For LMS based solutions.
RemoteControl Plugin is drive by the menus. 
LMS event can be used to trigger scripts using the Event Trigger plugin.
https://forums.slimdevices.com/showthread.php?110344-Announce-Event-Trigger-execute-commands-triggered-by-LMS-server-events=936363=1#post936363

I think you want a Squeezelite based solutions
To automate with power on off with state of player use the squeezelite
"-S" option with a shell script.  The $1 param will indicate power on /
off. 
Example in
https://forums.slimdevices.com/showthread.php?112748-piCorePlayer-Switch-off-HDMI-output-when-turning-off-player=985039=1#post985039

Use something like wget or curl instead of vgencmd



bpa's Profile: http://forums.slimdevices.com/member.php?userid=1806
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-19 Thread Marsupial


bpa wrote: 
> If they're very simple http - it may not even need a plugin - possibly
> just an edited Favorite entry. Depends on the response from device

Is the remote control responding to lms events, or just menu entries?

I'd want the power to be automated with the on/off state of the
player...





Marsupial's Profile: http://forums.slimdevices.com/member.php?userid=59182
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-19 Thread bpa


Marsupial wrote: 
> Is this plugin available somewhere?
> 
> I'd be willing to give it a try.
> 
> The Tasmota devices are easy used trough http commands that can even be
> hand typed in browser. This would in theory be easy.

If they're very simple http - it may not even need a plugin - possibly
just an edited Favorite entry. Depends on the response from device

Earlier I gave a link to the post & instructions with the URL for the
repository

http://downloads.sourceforge.net/project/bpaplugins/RemoteControl-v101.ZIP

I think V1.0 might be easier to modify but without examples, I'm only
guessing.



bpa's Profile: http://forums.slimdevices.com/member.php?userid=1806
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-19 Thread Marsupial


bpa wrote: 
> Must have badly expressed myself. 
> 
> The plugin just sends a HTTP message and reads a response.
> The plugin doesn't really care about the contents of message or response
> except it is nice if a response happens (and can be parsed) to confirm
> the success of command.
> 
> For Tasmota it would be a case of changing the message body from JSON to
> something else and similarly if there is a response.
> 
> Examples of the message / response would enable an edit to be doneIs this 
> plugin available somewhere?

I'd be willing to give it a try.

The Tasmota devices are easy used trough http commands that can even be
hand typed in browser. This would in theory be easy.





Marsupial's Profile: http://forums.slimdevices.com/member.php?userid=59182
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-19 Thread bpa


Marsupial wrote: 
> Would your remote control plugin be able to send http commands to
> Tasmota? That would be perfect...
Must have badly expressed myself. 

The plugin just sends a HTTP message and reads a response.
The plugin doesn't really care about the contents of message or response
except it is nice if a response happens (and can be parsed) to confirm
the success of command.

For Tasmota it would be a case of changing the message body from JSON to
something else and similarly if there is a response.

Examples of the message / response would enable an edit to be done



bpa's Profile: http://forums.slimdevices.com/member.php?userid=1806
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-19 Thread bpa


LMS has AnyEvent at it's heart although the version is a bit old. For
simplicity, the RemoteControl plugin uses AnyEvent to send a http
message and didn't use a LMS http routine 

There is an AnyEvent::MQTT module but not sure if it requires an newer
AnyEvent than LMS version.

IIRC - one of the LMS Google Home or Amazon Alexa plugin/helpers - uses
MQTT in some way.



bpa's Profile: http://forums.slimdevices.com/member.php?userid=1806
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-19 Thread Marsupial


bpa wrote: 
> Possibly - it was done a few years ago and IIRC it was the
> backdoor/debug interface.
> The plugin was mainly an example for another user of using LMS and not
> squeezelite.  
> 
> The smart Plugs I got I intend to reflash to Tasmota but LMS was not
> going to be the "controller".Would your remote control plugin be able to send 
> http commands to
Tasmota? That would be perfect...





Marsupial's Profile: http://forums.slimdevices.com/member.php?userid=59182
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-19 Thread bpa


Marsupial wrote: 
> Didn't tplink change this in a firmware update?
Possibly - it was done a few years ago and IIRC it was the
backdoor/debug interface.
The plugin was mainly an example for another user of using LMS and not
squeezelite.  

The smart Plugs I got I intend to reflash to Tasmota but LMS was not
going to be the "controller".



bpa's Profile: http://forums.slimdevices.com/member.php?userid=1806
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-19 Thread Marsupial


lostboy wrote: 
>   I've always thought it would be a useful exercise to take the xPL
> plugin and refactor it to use MQTT, so creating a native LMS MQTT
> plugin.  
> Chris

The idea of having MQTT native LMS plugin has lots of merit and may end
up opening more and more possibilities...





Marsupial's Profile: http://forums.slimdevices.com/member.php?userid=59182
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-19 Thread Marsupial

paul- wrote: 
> You can easily do that.  While squeezelite can fire a script based on
> power on/off.   Due to the web call, I would do this with a polling
> script.
> 
> The script would poll LMS for the power status of the player, then The
> web call can be done with wget using a post call.
> 
> There are several examples floating around the forums. if you need
> further help, ask.  I can do a bit more when I’m not on my ipad.So, I could 
> add a script that reside on the lms host, that polls LMS for
the specific player's power state, and send the http command for the
power outlet to toggle accordingly.


I am uncertain how to implement a polling script in Linux.

Also, where do I get documentation on how to ask lms for the
information?

Thanks a lot.





Marsupial's Profile: http://forums.slimdevices.com/member.php?userid=59182
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-19 Thread bpa


paul- wrote: 
> I completely forgot about that plugin.

The TPlink used messages which were JSON formatted so even though it is
simple exchange, there is way too much code for the OP request.  
I think the V1.0 may be better basis.

If OP gives example of ON and OFF message and any responses that can be
prcoessed, I could probably mod the plugin quickly.



bpa's Profile: http://forums.slimdevices.com/member.php?userid=1806
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-19 Thread paul-


I completely forgot about that plugin.



piCorePlayer a small player for the Raspberry Pi in RAM. 
Homepage: https://www.picoreplayer.org

Please 'donate'
(https://www.paypal.com/cgi-bin/webscr?cmd=_donations=U7JHY5WYHCNRU=GB_code=USD=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted)
if you like the piCorePlayer

paul-'s Profile: http://forums.slimdevices.com/member.php?userid=58858
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-19 Thread bpa


A few years ago, I created an LMS plugin called RemoteControl.  So this
solution is LMS based and not squeezelite based.

The plugin controls a TP-link smart plugin by sending a HTTP cmd  on or
off .  The commands appears as menus under the LMS main menu for the
plugin.

I think it could be adapted to yoru smart plugin.

https://forums.slimdevices.com/showthread.php?109642-Turning-on-stereo-from-piCorePlayer=924283=1#post924283



bpa's Profile: http://forums.slimdevices.com/member.php?userid=1806
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-19 Thread lostboy


The only protocol I've got to work on the LMS side that actively sends
out messages on player power state (rather than requiring polling) is
the, now ancient, xPL plugin.  I still use this, but run a small python
2.7 bridge app that converts the xPL power states to MQTT.  I've always
thought it would be a useful exercise to take the xPL plugin and
refactor it to use MQTT, so creating a native LMS MQTT plugin. 
Unfortunately I've never felt confident enough with Perl to start. The
python app is MQTT-xPL-bridge from Steve Rodger's github repository
hwstar. This has worked reliably for me for some years now, except that
power off state is not sent when a player powers off automatically
following the expiry of an alarm-clock event.

I'll accept that this route is both convoluted and niche, but if you do
want to try it feel free to ping me for assistance - I still have some
notes somewhere on the basic install process.

Cheers

Chris



lostboy's Profile: http://forums.slimdevices.com/member.php?userid=125
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-19 Thread paul-

You can easily do that.  While squeezelite can fire a script based on
power on/off.   Due to the web call, I would do this with a polling
script.

The script would poll LMS for the power status of the player, then The
web call can be done with wget using a post call.

There are several examples floating around the forums. if you need
further help, ask.  I can do a bit more when I’m not on my ipad.



piCorePlayer a small player for the Raspberry Pi in RAM. 
Homepage: https://www.picoreplayer.org

Please 'donate'
(https://www.paypal.com/cgi-bin/webscr?cmd=_donations=U7JHY5WYHCNRU=GB_code=USD=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted)
if you like the piCorePlayer

paul-'s Profile: http://forums.slimdevices.com/member.php?userid=58858
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


[SlimDevices: Plugins] Squeezelite/piCorePlayer power to Tasmota/MQTT/HA

2020-12-19 Thread Marsupial


I am trying to control a smart power outlet so that a squeezeplayer
state controls it.
The idea is to power the amp when the player is in use, but not
otherwise.

I thought it would be easy but can't seem to find how... 




I have Home Assistant and LMS integration. I can tell a player to turn
on or off from HA.
But what I need is for HA to do an action when the player goes on or
off, and it doesn't seem to have this option.


My power outlet runs Tasmota. Therefore, I can change its power state
with MQTT or directly by http like so

http://192.168.x.x/cm?cmnd=Power%20Off

The plug is also using MQTT trough a browser, but I don't think the
player will be MQTT compatible. 

I thought about just running a script from the player on state change,
but what's available on piCorePlayer is a script execution trigerred by
gpio... Which won't do the same. 

Anyone knows of a working path? Am I not seeing something that would
make this work?

Any ideas of what next to try?

Thanks a lot.





Marsupial's Profile: http://forums.slimdevices.com/member.php?userid=59182
View this thread: http://forums.slimdevices.com/showthread.php?t=113459

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins