A nodejs script which is designed to provide a websocket connection to gain information from ProPresenter, ProVideoPlayer, Elvanto, and Fluro
This module supports running a required script in your own code or can be run directly.
- First install nodejs and npm on your machine
- Type
npm install -g church-clocks --unsafe_perm=trueto install the module When installing the installer should ask if you want to set the settings for each module
This module includes a standalone script which exposes a websocket and/or a webserver for accessing the clocks
In order to run as a standalone webserver you must install the module above and run the installer script to configure the configuration files which will be at <userdirectory>/.church-clocks. This script will be ran when installing church-clocks or can be ran again by running generateSettings.js
- Find the location where npm installed the module typically in
/usr/local/lib/nodeor/usr/local/lib/node_modulesfor linux machines and%USERPROFILE%\AppData\Roaming\npm\node_modulesfor windows - Navigate to the .church-clocks directory
cd /usr/local/lib/node_modules/church-clocks - Run
node run.jsto run it ornode install.jsto generate the settings file
In order to run on boot you need to find the command that is required to run the module above. This will typically be in /usr/local/lib/node_modules/church-clocks
- First install pm2
npm install pm2 -g - Type
pm2 start /usr/local/lib/node_modules/church-clocks/pm2Service.json - Type
pm2 saveto save the changes - Type
pm2 startupto make it launch on boot - Check the logs with
pm2 logs church-clocks
The WebSocket can be at <YOUR_IP>:9955 and when connected should output all supported events which can be seen below in the API reference.
In general the command format can be seen in the API reference, however the WebSocket is formatted differently.
The following is the format that is expected to come from the WebSocket to your script
{
"event": "The event that is being outputted",
"value": "The value of that event
}
So as an example a supported function would come in as follows:
{
"event": "functionEvent",
"value": {
"function": "functionName",
"command": "command",
"value": "value"
}
}
The following is the format that is expected to be sent to the WebSocket from your script
{
"password": "if the password is required by the function",
"function": "function name",
"command": "the command to be processed,
"value": "the value of tht command
}
So as an example setting the Elvanto service would be as follows:
{
"password": "password if set in the general settings file",
"function": "elvanto",
"command": "setService",
"value": "The elvanto live url for the wanted service"
}
This commands can be found below in function commands
This module also provides a web server that allows things like ProPresenter to use for it's stage display functionality
This server if enabled can be accessed at <host>:<configured port>/index.html?type=<type> and will display a webpage based on the passed parameter type
By default the configured port is 80
typeThe type of clock to be displayedbackgroundcolorThe background color to be set if required (Note use * instead of # so #0C056D would be *0C056D)colorThe text color to be set if required (Note use * instead of # so #0C056D would be *0C056D)scaleThe scale of the page. Setting the scale parameter sets the font-size of all textfontThe font to display
For example http://localhost/?type=elvanto_countdown_clock&backgroundcolor=*4C146D&scale=20em&font=arial
current_timeThis will display the current system timeelvanto_countdown_clockThis will display the elvanto countdown clock (Current time left for current item)fluro_countdown_clockThis will display the fluro countdown clock (Current time left for current item)elvanto_itemsThis will display the current item followed by the next itemelvanto_currentitemThis will display the current item nameelvanto_nextitemThis will display the next item name *pvp_video_clockThis will display the video countdown clock for ProVideoPlayer. `pvp-transportidmust be set to the id of the transport you wish to get the time from *pp_video_clock``` This will display a video countdown clock for ProPresenter.pvpandpp_video_clockThis will display a clock depending on ProPresenter or ProVideoPlayers clock. If the main clock is not active the other clock if active will display the value. Setting parametermain_clock=pvp/ppwill set what clock takes importance with the pvp clock being default.pvp_transportidmust be set to the id of the transport you wish to get the time frompp_lyric_nextThis will display the next lyric in ProPresenterpp_lyric_currentThis will display the current lyric in ProPresenterdebugWill show all the incoming data. Useful if you're developing your own solution
- Include the module using
const churchClocks = require("church-clocks");. - Then create the object using
new churchClocks(webSocketEnabled, webSocketPassword, webSocketPort, webServerEnabled, webServerPort, filePath)WherewebSocketEnabled will enable/disable the websocket,websocketPasswordwill set the password that is required to pass in the WebSocket password to perform commands,webSocketPortwill change the port used to access the websocket,webServerEnabledwill enable/disable the inbuilt webserver,filePathis where the settings files are stored default is%USERPROFILE%/.church-clocks/for windows and~/.church-clocks/for linux.
Events can be accessed by using object.on(<eventName>, function(){})
In general all functions will output information as events which can be seen below
connectionStatusis the emitter for updating on connection state changes
{
function: "the function name",
state: "status"
}
erroris the emitter for errors
{
function: "the function name",
errorType: "critical/warning",
error: "The error"
}
functionEventevents from the functions. This is usually where status comes from
{
"function": "the function name",
"type": "the type of command being sent",
"value": "the value"
}
informationinformation events
{
"function": "the function name",
"type": "the type of command being sent",
"value": "the value"
}
The configuration files can be edited using the admin control panel found at admin.html the password is by default an empty string (just hit login without entering anything)
The configuration files can be found at the location listed when running node run.js this should be in your user directory (for Windows C:/users/<user>/.church-clocks for Linux /home/<user>/.church-clocks)
In the .church-clocks directory there will be a file called applicationSettings.txt this is the settings for the application.
webSocketEnabledShould the websocket be enabled? Default truewebSocketPasswordWhat should the password be for the websocket? This is also used in admin configuration pages. Default ""webSocketPortShould the websocket be enabled? Default 9955. This will be forced to port 9955 if the web server is enabled!webServerEnabledShould the web server be enabled? Default truewebServerPortWhat port should the web server be on? Default 80
In the .church-clocks\functionSettings directory there will be several files for each function below.
The Fluro module is setup to dynamically grab the next service depending on the settings provided.
- enabled Should the function be enabled?
- apiKey: An API Key from Fluro
- realm: The ID of a realm the event(s) are stored in
- track: The ID of an event track that the event(s) are stored in
- date: Specify a date to get events for (useful for testing) // Should be in
YYYY-MM-DDformat - eventID: Specify a specific event ID (the first plan will be fetched)*
- planID: Grab a specific plan
- roomIDs: Used by the setFluroClock.html page to search for events. Can be separated by a
,. - timezone Change the timezone used. Default Melbourne/Australia
- serviceChangeRedirectURL What URL should the setFluroClock.html page send the user to on successful plan update.
<planId>will populate the plan id,<eventId>will populate the eventId that was chosen.
- enabled Should the function be enabled?
- username Your Elvanto bot username
- password Your Elvnato bot password
- puppeteerExecutablePath Change the puppeteerExecutablePath if required
- enabled Should the function be enabled?
- host The host ip address
- port The host port
- password The password found in the settings
- enabled Should the function be enabled?
- host The host ip address
- api The api location. Default /api/0/
- authToken The auth token found in settings
Below are commands that are supported to send to functions
{
"password": "if the password is required by the function",
"function": "function name",
"command": "the command to be processed,
"value": "the value of tht command
}
Commands may also respond using the following sent directly to the current web socket connection
{
"event": "response",
"value": {
"function": "functionName",
"command": "command",
"value": "value"
}
}
//Note if there is an error this will return false or a description of the error in the value
Will update the service
{
"password": "is required",
"function": "elvanto"
"command": "setService"
"value": "?id=joijio6-hiuht-uhi6-hiuhiu65-hiuhiu5&time_id=wifuwehfiweiufh-hi7-hi65-iuhiuhiuhiu65"
}
Will clear the current clock
{
"password": "is required",
"function": "elvanto"
"command": "clearService"
"value": ""
}
Will get a list of events within the set configuration and a range of 3 days from the current date
//Request
{
"password": "is required",
"function": "fluro"
"command": "getEvents"
"value": ""
}
//Response
{
"event": "response",
"value": {
"function": "fluro",
"command": "getEvents",
"value": {
"events": An array of events,
"serviceChangeRedirectURL": The url set in the configuration file
}
}
}
Will clear the current clock. Note if you have set an event/plan etc in the settings it will return back to that
//Request
{
"password": "is required",
"function": "fluro"
"command": "clearClock"
"value": ""
}
//Response
{
"event": "response",
"value": {
"function": "fluro",
"command": "clearClock",
"value": true
}
}
Will set an event
//Request
{
"password": "is required",
"function": "fluro"
"command": "setEvent"
"value": "<eventId>"
}
//Response
{
"event": "response",
"value": {
"function": "fluro",
"command": "setEvent",
"value": true
}
}
Will set an event
//Request
{
"password": "is required",
"function": "fluro"
"command": "setURL"
"value": "A fluro live URL (This is expected to use live.fluro.io)"
}
//Response
{
"event": "response",
"value": {
"function": "fluro",
"command": "setURL",
"value": true
}
}
This is probably due to puppeteer. Try a few things below to see if it solves your issue
- Try setting the last parameter in the elvanto settings file to
/usr/bin/chromium-browserfor linux machines - Try setting the last parameter in the elvanto settings file to the location of the chromium browser
- Try installing chromimum