https://github.com/fritzandfriends/streamdeckemulator
A simple emulator for the Stream Deck Application to allow plugin developers to test their plugins
https://github.com/fritzandfriends/streamdeckemulator
javascript nodejs streamdeck
Last synced: 11 months ago
JSON representation
A simple emulator for the Stream Deck Application to allow plugin developers to test their plugins
- Host: GitHub
- URL: https://github.com/fritzandfriends/streamdeckemulator
- Owner: FritzAndFriends
- License: mit
- Created: 2019-01-21T00:13:21.000Z (about 7 years ago)
- Default Branch: dev
- Last Pushed: 2022-04-10T01:17:34.000Z (almost 4 years ago)
- Last Synced: 2025-04-07T05:11:11.162Z (about 1 year ago)
- Topics: javascript, nodejs, streamdeck
- Language: JavaScript
- Size: 68.4 KB
- Stars: 53
- Watchers: 5
- Forks: 4
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# StreamDeckEmulator
A simple emulator for the Stream Deck Application to allow plugin developers to develop, test, and debug their plugins without requiring a physical [Stream Deck][] device.
## Pre-requisites
In order to be able to run this emulator, you will need to have [Node.js][] installed. The most recent LTS is suggested.
## Setup
```bash
npm i -g streamdeckemulator
```
## Usage
### Run the Emulator on a Specific Plugin
```bash
sde -p /path/to/built/streamdeck/plugin -e nameofplugin
```
### Using the Emulator
## Local Development
### Runing local to the cloned repository
#### Getting Started
1. Clone the repository using git: `git clone https://github.com/FritzAndFriends/StreamDeckEmulator.git`.
2. Change directory to the repository: `cd StreamDeckEmulator`.
3. Run `npm install`.
4. Create a copy of the .env_sample file: `cp .env_sample .env`.
5. Update `.env` file to set your environment specific values.
1. Update the value of `BUILD_PATH` to be the build output path of your plugin's executable.
*Note*: Make sure you use the correct path syntax for your operating system.
2. Update the value of `WINEXE_NAME` (if you're on Windows) or `OSXEXE_NAME` (if you're on macOS) to be the filename of the your plugin's executable.
6. Run `npm start` to launch the emulator.
#### Starting and Stopping the Emulator
1. Open a command prompt/terminal/shell and navigate to the current directory.
2. Start the emulator with the command `npm start`
3. When you are done, use the `q` option to shut down the emulator.
### Running as a global tool
1. Clone the repository using git: `git clone https://github.com/FritzAndFriends/StreamDeckEmulator.git`.
2. Change directory to the repository: `cd StreamDeckEmulator`.
3. Run `npm install`.
4. Run `npm link`
### Using the Emulator
#### Simulating events
At this time, the following are the events supported by the emulator, and their associated keyboard commands.
* `keyDown` (kd)
* `keyUp` (ku)
* `willAppear` (wa)
* `willDisappear` (wd)
* `deviceDidConnect` (dc)
* `deviceDidDisconnect` (dd)
#### Caveats, Limitations, and Known Issues
**Caveat**: The emulator will only send events to the first action defined in the `manifest.json` (manifest) file.
**Workaround**: To test a different action, move its definition to the top of the `actions` array in the manifest.
**Issue**: If, for any reason, when sending a command to the plugin, the websocket connection is closed or otherwise broken, no further messages can be sent.
**Workaround**: Quit the emulator (using the q command) and restart it.
**Issue**: If the emulator is force quit (using Ctrl+C), the WebSocket connection *may* not be closed, and the configured port *could* remain in use.
**Workaround**: Find if there is an instance of `node` running for the `index.js` script, and end it. This varies per operating system.
You should now have the CLI command `sde` installed globally as if it were installed via NPM.
[Stream Deck]: https://www.elgato.com/gaming/stream-deck/ "Elgato's Stream Deck product page"
[Node.js]: https://nodejs.org/ "Learn about and get Node.js"