FalconChristmas / fpp

Falcon Player
http://FalconChristmas.com
Other
564 stars 195 forks source link

Add aditional MQTT topics to control player OS/FPP with LWT support #1136

Closed Marx1 closed 2 years ago

Marx1 commented 2 years ago

Is your feature request related to a problem? Please describe. I use home assistant via MQTT to automate power for my lightshow boxes. Currently I'm using the Idle vs playing status. My issue is I can easily start FPP instances, however shutting them down is a lot is problematic. Automating via MQTT would solve this

Describe the solution you'd like Add MQTT topics for FPPD restart, FPPD Stop (Depends on if MQTT runs all the time or not), System restart and shutdown. For the /status topic, add fppdtopped, fppdrestarting, systemrestart, systemshutdown messages. In the event The system restart and shutdown should have the retain=True flag set. The connect message should have the LWT (Last Will and Testament) set to /status

Describe alternatives you've considered Some of this could be done with an external ESP8266 and a gpio, or a completely seperate script, however leveraging MQTT this could be used by other systems besides homeassistant.

Additional context With the large number of Kulp or FPP-on BBB based controllers if you don't want to leave the controller on 24/7 (those of us in California with $.30+ kw/h power don't!) It's very rough on the file system for abrupt shutdowns, forcing FSCKs and possible corruption. It would be one thing if FPP ran from memory, but it doesn't for obvious reasons... I'm looking at you 1gb ram... :(

ghormann commented 2 years ago

MQTT required fppd running and has no concept of system status. I think some of what you request is possible. 1) A publish topic that allows you to restart or stop FPPD 2) a publish topic that allows you to restart or shutdown the whole system

Regarding status topics 1) The FPP Version is published on fppd restart, doesn't that give you when the system started? 2) I don't easily see a way to add notifications on system restart or ssytem shutdown because FPP doesn't know that (the shutdown -h happens outside of fppd control.)

Marx1 commented 2 years ago

Ok, this helps some -

The publish topics would be great. I didn't know FPP published version on start, so that could be used for a system start.

For the shutdown/restart, that does pose some issues. I guess the only real way is to call a script to publish the topic, then shutdown, but that's a bit clunky. It was mainly to have a positive feedback that shutdown was started - but It's not really required.