Skip to content

"Config Player" Config Reference

For more, see the Config Player Info page.

Config Players are used to perform actions in response to events happening.

The name of the config player represents the kind of action that will be performed. For example, a show_player will manage shows in response to events. The lights_player will manage lights in response to events. And the random_event_player will play a random event from a given list in response to a trigger event.

Usage

Config players may be used inside machine and mode files in order to perform actions in response to events, but the may also be used within shows to perform actions when the show executes a step.

In machine and mode files, the section name used in the YAML is the name of the config player type, with the suffix "_player" attached. In show files, the suffix is dropped and replaced with "s".

For example, light_player in a mode file looks like:

#config_version=6

light_player:
  some_event:
    my_light: red
  another_event:
    my_light: blue

while in a show file, a flashing red and blue light might look like:

#show_version=6
- duration: 500ms
  lights:
    my_light: red
- duration: 500ms
  lights:
    my_light: blue

Config Players each have a structure with the same top and second level (the name of the config player type, and then the name of the event to listen for):

<thing>_player:
  <some_event>:
    ...

That's where the similarities end -- each config player type uses its own syntax and special semantics to manage their devices. Some config players support multiple different syntaxes, depending on the complexity of the action you wish to perform.

Combination in Shows

When writing config players in machine and mode files, you have to define them in their own top-level sections (like event_player:). which means you cannot combine multiple types of player in a single event listener. In shows, on the other hand, you can combine as many config players in a single step as you like, and they will all execute together.

For example, a show that plays a sound and flashes a light at the same time could look like:

#show_version=6

- duration: 500ms
  lights:
    my_light_2: on
  sounds:
    bird_chirp: play
- duration: 500ms
    my_light_2: off

Index

MPF-MC Config Players

MPF-MC included a few more player types, but these are deprecated with MPF version 0.80 onward.


Something missing or wrong? You can fix it!

This website is edited by people like you! Is something wrong or missing? Is something out of date, or can you explain it better?

Please help us! You can fix it yourself and be an official "open source" contributor!

It's easy! See our Beginner's guide to editing the docs.

Page navigation via the keyboard: < >

You can navigate this site via the keyboard. There are two modes:

General navigation, when search is not focused:

  • F , S , / : open search dialog
  • P , , : go to previous page
  • N , . : go to next page

While using the search function:

  • Down , Up : select next / previous result
  • Esc , Tab : close search
  • Enter : go to highlighted page in the results