Thorium-Sim / luminave-thorium

Create a connection between luminave and the Thorium Simulator using GraphQL.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

luminave-thorium

Create a connection between luminave and the Thorium Simulator using GraphQL.

Build Status

Table of Contents


Setup

  • Clone this repository
  • Install the dev dependencies by executing npm install inside the luminave-thorium folder

Config

If you want to change the host & port of luminave-thorium, you have to create a .env file inside the luminave-thorium folder.

Example .env

# Host of the luminave-server
HOST_LUMINAVE_SERVER=localhost

# Port of the luminave-server
PORT_LUMINAVE_SERVER=4000

# Host of Thorium
# Leave it undefined if you want to have it auto detected with bonjour
#HOST_THORIUM=undefined
# Port of Thorium
# leave it undefined if you want to have it auto detected with bonjour
#PORT_THORIUM=undefined

# ID of the Thorium client that is used by the Thorium Server to
# identify this client as the one that can control the lighting
# Note: As of now this will only work if the letters 'ECS' are part of the clientId
# Note: Only change if you know what you are doing
#THORIUM_CLIENTID='ECS'

# ID that will be used in luminave to identify the animation that will be used to 
# dynamically update it's keyframes
# Note: Only change if you know what you are doing
#LUMINAVE_ANIMATIONID=luminave-thorium-dynamic-animation-1337

Use with luminave & Thorium

  • Start with npm start
  • Start Thorium server with npm start
  • Create a flight in Thorium at http://localhost:3000
  • Add the luminave-thorium as a client with the name ECS-luminave-thorium to the created flight

That's it, luminave-thorium is now ready to receive data from Thorium to send it over to luminave-server.

General Workflow

  • The app tries to find the Thorium Server running in the local network
  • When it finds it it tries to setup a connection to it and registers itself as a client called "ECS"
  • When this was successful, it subscribes to new messages on the simulator and the lighting changes (thorium-lighting)
  • Those updates are send via a mutation to the luminave-server

GraphQL


Troubleshooting

No data received from Thorium

  • Check if the client IP changed, if that happened you have to restart Thorium & luminave-thorium so it registers itself with the new IP of your computer

One action in Thorium is triggering more than 1 changes in luminave e.g. the same scene multiple times

  • Restart thorium-client and refresh Thorium in the browser

API Documentation

Can be found on API documentation.


Data provided by Thorium

Detailed explanation on how this data could be interpreted.

query Simulators($simulatorId: String) {
  simulators(id: $simulatorId) {
    id
    lighting {
      intensity # [0 - 1] How bright the lights should be
      action # One of 'normal', 'fade', 'shake', 'strobe', 'oscillate'
      actionStrength # [0 - 1] How intense the action is. How quickly it shakes, or how fast it strobes or oscillates
      transitionDuration # How long a 'fade' action should last in milliseconds
      color # A suggested color for the lights
    }
  }
}

About

Create a connection between luminave and the Thorium Simulator using GraphQL.

License:MIT License


Languages

Language:JavaScript 100.0%