Author Topic: MQTT events  (Read 372 times)

Offline snething

  • Newbie
  • *
  • Join Date: Apr 2014
  • Location:
  • Posts: 12
  • Kudos: 1
MQTT events
« on: March 14, 2019, 10:09:47 AM »
I am setting up Openhab home automation. I have Openhab receiving topics from the FPP Pi through the MQTT server.  I am able to display the status and the playlist name on my OH user interface. What I am looking for is a list of events/commands that can be used to control FPP. I have looked at the advanced settings list but I think there are additional usable commands(payloads?). I would appreciate any help.  Thanks, Scot

Online CaptainMurdoch

  • Administrator
  • *****
  • Join Date: Sep 2013
  • Location: Washington
  • Posts: 9,836
  • Kudos: 214
Re: MQTT events
« Reply #1 on: March 14, 2019, 12:23:48 PM »
There aren't a lot of topics that FPP reacts to currently.  I think the list on the Advanced Settings page is correct.  The publish side was the side that received the most focus, then I wanted to start fleshing out more on the subscribe side to allow more control over MQTT.  This work will probably be done in parallel with adding control via the REST API which we are slowly working on enhancing.
-
Chris

Offline snething

  • Newbie
  • *
  • Join Date: Apr 2014
  • Location:
  • Posts: 12
  • Kudos: 1
Re: MQTT events
« Reply #2 on: March 14, 2019, 12:55:05 PM »
Thank you for the update.  Through some looking I did find the "status" and "playlist name" on the publish side and figured out how to stop a playlist on the receive side. Is "stop gracefully" or "shutdown" available?
« Last Edit: March 14, 2019, 01:15:40 PM by snething »

Online CaptainMurdoch

  • Administrator
  • *****
  • Join Date: Sep 2013
  • Location: Washington
  • Posts: 9,836
  • Kudos: 214
Re: MQTT events
« Reply #3 on: March 14, 2019, 01:29:52 PM »
I don't believe we can currently do those.  If you would like to propose some topics, we can discuss and should be able to get simple operations like that added pretty quickly.

Offline snething

  • Newbie
  • *
  • Join Date: Apr 2014
  • Location:
  • Posts: 12
  • Kudos: 1
Re: MQTT events
« Reply #4 on: March 14, 2019, 02:05:55 PM »
I will be using OH with FPP to control my indoor tree. My plan is to interface with "Alexa" to voice control.  At this point I have the necessary functionality with the current set of commands. Presently, I don't need any enhancements.  At  some point I would like to see "shutdown" added, when possible, with other development.

You and development team are doing a GREAT job. THANK YOU!!!

Offline ghormann

  • Newbie
  • *
  • Join Date: Oct 2016
  • Location:
  • Posts: 20
  • Kudos: 0
    • Christmas as the Hormanns
Re: MQTT events
« Reply #5 on: March 14, 2019, 05:38:49 PM »

Right now we have
* playlist/name/set
* playlist/repeat/set
* playlist/sectionPosition/set

I'd propose we add
* playlist/stopNow
* playlist/stopGraceful

Neither require arguments.  If @CaptainMurdoch is aligned, I'd love to try and implement. Looks like a simple change to Playlist::MQTTHandler() to me.
« Last Edit: March 14, 2019, 06:48:53 PM by ghormann »

Online CaptainMurdoch

  • Administrator
  • *****
  • Join Date: Sep 2013
  • Location: Washington
  • Posts: 9,836
  • Kudos: 214
MQTT events
« Reply #6 on: March 14, 2019, 07:53:52 PM »
I am trying to think ahead and wondering if we should have something like:

playlist/PLAYLISTNAME/ACTION

Where PLAYLISTNAME is the name of a playlist and ACTION is things like start, stop/now, stop/graceful, stop/afterloop, next, prev, restart, repeat, etc..

For now, FPP can only play one playlist at a time, but part of the reasoning for rewriting the playlist code was to allow multiple playlists to run at once.  I think that when we have that ability, we will want the playlist name in the MQTT topic.

We can also have higher level topics like the ones below that apply to all running playlists:

playlist/stop/now
playlist/stop/graceful
playlist/stop/afterloop

Or we make a fake placeholder playlist name like ALLPLAYLISTS so we have:

playlist/ALLPLAYLISTS/stop/now
etc.

Then, in the Playlist MQTT handler method, we just check to see if the playlist name in the topic is either ALLPLAYLISTS or the current playlist name.

Offline ghormann

  • Newbie
  • *
  • Join Date: Oct 2016
  • Location:
  • Posts: 20
  • Kudos: 0
    • Christmas as the Hormanns
Re: MQTT events
« Reply #7 on: March 15, 2019, 03:53:27 AM »

playlist/stop/now  could get confusing if someone crated a playlist name called "stop".   I'd vote for ALLPLAYLIST instead.

playlist/ALLPLAYLIST/stop/now
playlist/ALLPLAYLIST/stop/graceful
playlist/ALLPLAYLIST/stop/afterloop

Offline snething

  • Newbie
  • *
  • Join Date: Apr 2014
  • Location:
  • Posts: 12
  • Kudos: 1
Re: MQTT events
« Reply #8 on: March 15, 2019, 07:55:47 AM »

Additional events I have found:

.$p$prefix/falcon/player/$hostname/playlist/name/set with a command/payload of "stop" - works to stop the playing playlist


$prefix/falcon/player/$hostname/status - returns playing or idle






Online CaptainMurdoch

  • Administrator
  • *****
  • Join Date: Sep 2013
  • Location: Washington
  • Posts: 9,836
  • Kudos: 214
Re: MQTT events
« Reply #9 on: March 15, 2019, 09:22:06 AM »
.$p$prefix/falcon/player/$hostname/playlist/name/set with a command/payload of "stop" - works to stop the playing playlist

That's only because you don't have a playlist named 'stop'.  FPP stops the running playlist and tries to play the 'stop' playlist which doesn't exist so it doesn't do anything further.

playlist/stop/now  could get confusing if someone crated a playlist name called "stop".   I'd vote for ALLPLAYLIST instead.

That's what I'm thinking.   I created a new ticket to track the desired endpoints:  https://github.com/FalconChristmas/fpp/issues/505    Comments/patches welcome. :)

Offline ghormann

  • Newbie
  • *
  • Join Date: Oct 2016
  • Location:
  • Posts: 20
  • Kudos: 0
    • Christmas as the Hormanns
Re: MQTT events
« Reply #10 on: March 15, 2019, 05:31:49 PM »
That's what I'm thinking.   I created a new ticket to track the desired endpoints:  https://github.com/FalconChristmas/fpp/issues/505    Comments/patches welcome. :)


I'll work on a patch this weekend....

Offline jmb

  • Newbie
  • *
  • Join Date: Sep 2018
  • Location:
  • Posts: 7
  • Kudos: 0
Re: MQTT events
« Reply #11 on: March 26, 2019, 11:15:52 AM »
I am trying to think ahead and wondering if we should have something like:

playlist/PLAYLISTNAME/ACTION

Where PLAYLISTNAME is the name of a playlist and ACTION is things like start, stop/now, stop/graceful, stop/afterloop, next, prev, restart, repeat, etc..
Doesn't it already do this? I am able to start/stop individual playlists remotely via openHAB/MQTT.

Offline ghormann

  • Newbie
  • *
  • Join Date: Oct 2016
  • Location:
  • Posts: 20
  • Kudos: 0
    • Christmas as the Hormanns
Re: MQTT events
« Reply #12 on: March 28, 2019, 06:24:58 PM »
I am trying to think ahead and wondering if we should have something like:

playlist/PLAYLISTNAME/ACTION

Where PLAYLISTNAME is the name of a playlist and ACTION is things like start, stop/now, stop/graceful, stop/afterloop, next, prev, restart, repeat, etc..
Doesn't it already do this? I am able to start/stop individual playlists remotely via openHAB/MQTT.


There was no proper stop. (But is now).


Previously, you could stop if you sent an invalid playlist name.

Offline jmb

  • Newbie
  • *
  • Join Date: Sep 2018
  • Location:
  • Posts: 7
  • Kudos: 0
Re: MQTT events
« Reply #13 on: April 06, 2019, 11:39:56 PM »


I have switches like this in my items file.

Switch fpp_playlist_all { mqtt=">[broker:falcon/player/fpp/playlist/name/set:command:on:all]", autoupdate="false"}

There is an entry for each of the 5 playlists I control remotely. I have a short shutdown sequence that ends the show for the night. Calling that shutdown sequence is how I stop a running sequence. I did accidentally discover that stopping a non-existent sequence called "stop" would also stop whatever was running. I now understand why that worked.

 

Back to top