|
| 1 | +--- |
| 2 | +title: '"Config Player" Config Reference' |
| 3 | +--- |
| 4 | + |
| 5 | +# "Config Player" Config Reference |
| 6 | + |
| 7 | +For more, see the [Config Player Info page](../../config_players/index.md). |
| 8 | + |
| 9 | +Config Players are used to perform actions in response to events happening. |
| 10 | + |
| 11 | +The name of the config player represents the kind of action that will be performed. |
| 12 | +For example, a `show_player` will manage shows in response to events. The `lights_player` |
| 13 | +will manage lights in response to events. And the `random_event_player` will play a random |
| 14 | +event from a given list in response to a trigger event. |
| 15 | + |
| 16 | +## Usage |
| 17 | + |
| 18 | +Config players may be used inside machine and mode files in order to perform actions in |
| 19 | +response to events, but the may also be used within shows to perform actions when the |
| 20 | +show executes a step. |
| 21 | + |
| 22 | +In machine and mode files, the section name used in the YAML is the name of the config |
| 23 | +player type, with the suffix "\_player" attached. In show files, the suffix is dropped and replaced with "s". |
| 24 | + |
| 25 | +For example, light_player in a mode file looks like: |
| 26 | + |
| 27 | +``` yaml |
| 28 | +#config_version=6 |
| 29 | + |
| 30 | +light_player: |
| 31 | + some_event: |
| 32 | + my_light: red |
| 33 | + another_event: |
| 34 | + my_light: blue |
| 35 | +``` |
| 36 | +
|
| 37 | +while in a show file, a flashing red and blue light might look like: |
| 38 | +
|
| 39 | +``` yaml |
| 40 | +#show_version=6 |
| 41 | +- duration: 500ms |
| 42 | + lights: |
| 43 | + my_light: red |
| 44 | +- duration: 500ms |
| 45 | + lights: |
| 46 | + my_light: blue |
| 47 | +``` |
| 48 | +
|
| 49 | +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): |
| 50 | +
|
| 51 | +``` yaml |
| 52 | +<thing>_player: |
| 53 | + <some_event>: |
| 54 | + ... |
| 55 | +``` |
| 56 | +
|
| 57 | +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 |
| 58 | +different syntaxes, depending on the complexity of the action you wish to perform. |
| 59 | +
|
| 60 | +## Combination in Shows |
| 61 | +
|
| 62 | +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 |
| 63 | +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 |
| 64 | +all execute together. |
| 65 | + |
| 66 | +For example, a show that plays a sound and flashes a light at the same time could look like: |
| 67 | + |
| 68 | +``` yaml |
| 69 | +#show_version=6 |
| 70 | +
|
| 71 | +- duration: 500ms |
| 72 | + lights: |
| 73 | + my_light_2: on |
| 74 | + sounds: |
| 75 | + bird_chirp: play |
| 76 | +- duration: 500ms |
| 77 | + my_light_2: off |
| 78 | +``` |
| 79 | + |
| 80 | + |
| 81 | +## Index |
| 82 | + |
| 83 | +* [blinkenlight_player:](../blinkenlight_player.md) |
| 84 | +* [coil_player:](../coil_player.md) |
| 85 | +* [display_light_player:](../display_light_player.md) |
| 86 | +* [event_player:](../event_player.md) |
| 87 | +* [flasher_player:](../flasher_player.md) |
| 88 | +* [light_player:](../light_player.md) |
| 89 | +* [queue_event_player:](../queue_event_player.md) |
| 90 | +* [queue_relay_player:](../queue_relay_player.md) |
| 91 | +* [random_event_player:](../random_event_player.md) |
| 92 | +* [score_queue_player:](../score_queue_player.md) |
| 93 | +* [segment_display_player:](../segment_display_player.md) |
| 94 | +* [show_player:](../show_player.md) |
| 95 | +* [slide_player:](../slide_player.md) |
| 96 | +* [sound_player:](../sound_player.md) |
| 97 | +* [variable_player:](../variable_player.md) |
| 98 | +* [widget_player:](../widget_player.md) |
| 99 | + |
| 100 | +## MPF-MC Config Players |
| 101 | + |
| 102 | +MPF-MC included a few more player types, but these are deprecated with MPF version 0.80 onward. |
| 103 | + |
| 104 | +* [playlist_player:](../playlist_player.md) |
| 105 | +* [sound_loop_player:](../sound_loop_player.md) |
| 106 | +* [track_player:](../track_player.md) |
0 commit comments