### Install and Start Backend Source: https://github.com/frangoteam/fuxa/blob/master/CONTRIBUTING.md Navigate to the server directory, install dependencies, and start the backend server. ```bash cd server npm install npm start ``` -------------------------------- ### Install and Start Frontend Source: https://github.com/frangoteam/fuxa/blob/master/CONTRIBUTING.md Navigate to the client directory, install dependencies, and start the frontend development server. ```bash cd client npm install npm start ``` -------------------------------- ### Install and Run FUXA from Source Source: https://github.com/frangoteam/fuxa/blob/master/README.md Install FUXA from source by navigating to the server directory, installing dependencies using npm, and starting the application. Ensure Node.js 18 LTS is installed. ```bash cd ./server npm install npm start ``` -------------------------------- ### FUXA Get DAQ Node Usage and Examples Source: https://github.com/frangoteam/fuxa/blob/master/server/integrations/node-red/node-red-contrib-fuxa/nodes/fuxa-get-daq.html Explains how to use the 'get-daq' node and provides examples for setting dynamic timestamps via msg.from and msg.to. ```javascript // Get data for last 24 hours msg.from = Date.now() - 86400000; msg.to = Date.now(); ``` ```javascript // Get data for specific date range msg.from = "2025-01-01 00:00:00"; msg.to = "2025-01-01 23:59:59"; ``` -------------------------------- ### Debug FUXA Frontend Source: https://github.com/frangoteam/fuxa/blob/master/README.md Installs frontend dependencies and starts the development server for the FUXA client. This is useful for debugging the user interface in a browser. ```bash cd ./client npm install npm start ``` -------------------------------- ### Install Docker Source: https://github.com/frangoteam/fuxa/blob/master/docs/Installing-and-Running.md Installs Docker on the system using a convenience script. Ensure you have sudo privileges. ```bash curl -fsSL https://get.docker.com -o get-docker.sh sudo sh ./get-docker.sh ``` -------------------------------- ### Timestamp Examples Source: https://github.com/frangoteam/fuxa/blob/master/server/integrations/node-red/node-red-contrib-fuxa/nodes/fuxa-get-history-alarms.html Illustrates how to set dynamic start and end timestamps using message properties for fetching historical alarms. ```javascript // Get alarms for last week msg.start = Date.now() - 604800000; // 7 days ago msg.end = Date.now(); ``` ```javascript // Get alarms for specific date range msg.start = "2025-10-20T00:00:00.000Z"; msg.end = "2025-10-26T23:59:59.999Z"; ``` -------------------------------- ### Create Fuxa Electron Startup Script Source: https://github.com/frangoteam/fuxa/blob/master/docs/Installing-and-Running.md Create a bash script to navigate to the Fuxa Electron directory and start the application using npm start. ```bash #!/bin/bash cd /opt/electron/fuxa-electron npm start ``` -------------------------------- ### Install Electron Globally Source: https://github.com/frangoteam/fuxa/blob/master/docs/Installing-and-Running.md Installs the Electron runtime globally. The --unsafe-perm and --allow-root flags are necessary for global installation on some systems. ```bash sudo npm install -g electron --unsafe-perm=true --allow-root ``` -------------------------------- ### Install MkDocs Dependencies Source: https://github.com/frangoteam/fuxa/blob/master/CONTRIBUTING.md Install the necessary Python packages for running the documentation locally using MkDocs. ```bash pip install "mkdocs<2.0" pip install mkdocs-material ``` -------------------------------- ### Serve Documentation Locally Source: https://github.com/frangoteam/fuxa/blob/master/CONTRIBUTING.md Start the local MkDocs server to preview the documentation. Access it at the provided URL. ```bash mkdocs serve ``` -------------------------------- ### Install FUXA Globally via NPM Source: https://github.com/frangoteam/fuxa/blob/master/README.md Installs the FUXA package globally using npm. Ensure Node.js 18 LTS is installed. Use --unsafe-perm for Linux installations, especially with Node.js 18. After installation, run 'fuxa' to start the application. ```bash npm install -g --unsafe-perm @frangoteam/fuxa fuxa ``` -------------------------------- ### Full ODBC Example with Query Manager Source: https://github.com/frangoteam/fuxa/blob/master/docs/HowTo-ODBC.md A comprehensive server-side script example that includes a query manager for handling triggers, polling tags, and updating the FUXA UI. Restart FUXA if encountering issues after script modification. ```javascript // Query Manager, function to provide one shot based on trigger event async function createQueryManager(device) { let lastTriggerState = false; return async function(trigger, sqlQuery) { if (trigger && trigger !== lastTriggerState) { try { const result = await device.pool.query(sqlQuery); lastTriggerState = trigger; return result; } catch (error) { return 'Error executing query'; } } lastTriggerState = trigger; }; } // Initialize the device, sane nane as connection let myDevice = await $getDevice('postgreSQL', true); // Create query Manager for each query type, retains query data let executeInsertQuery = await createQueryManager(myDevice); // Instance Insert let executeSelectQuery = await createQueryManager(myDevice); // Instance Select // Global Variables to retain Data let selResult; // 100ms loop catch Tag Events let myLoop100ms = setInterval(loop100ms, 100); async function loop100ms() { let customerName = $getTag($getTagId('customerName')); let customerPhone = $getTag($getTagId('customerPhone')); let customerEmail = $getTag($getTagId('customerEmail')); let customerAge = $getTag($getTagId('customerAge')); let execSaveCustomer = $getTag($getTagId('execSaveCustomer')); ``` -------------------------------- ### Start Docker Compose Source: https://github.com/frangoteam/fuxa/blob/master/docs/Installing-and-Running.md Starts the FUXA service defined in the docker-compose.yml file in detached mode. ```bash sudo docker compose up -d ``` -------------------------------- ### Verify Node.js and NPM Installation Source: https://github.com/frangoteam/fuxa/blob/master/docs/Installing-and-Running.md Checks the installed versions of Node.js and npm to ensure they meet the requirements. ```bash node -v npm -v ``` -------------------------------- ### Install ODBC Drivers on Debian Source: https://github.com/frangoteam/fuxa/blob/master/docs/HowTo-ODBC.md Commands to update package lists, install unixODBC, and make scripts executable for setting up ODBC drivers. ```bash sudo apt-get update && sudo apt-get install -y unixodbc unixodbc-dev ``` ```bash sudo chmod +x install_odbc_drivers.sh sudo ./install_odbc_drivers.sh sudo cp odbcinst.ini /etc/odbcinst.ini ``` -------------------------------- ### Node-RED FUXA Contrib Nodes Usage Examples Source: https://context7.com/frangoteam/fuxa/llms.txt Examples demonstrating the output message structure for `get-tag-change` and how to set tag values using the `set-tag` node in Node-RED. ```javascript // get-tag-change output message structure: // { // payload: 25.3, // topic: "pressure", // tagId: "dev_opc.pressure", // tagName: "pressure", // timestamp: "2025-01-01T10:30:00.000Z", // previousValue: 24.8 // } // set-tag: inject msg.payload to write to the configured tag // In a Function node before set-tag: msg.payload = 1450; // RPM value to write to dev_modbus.pump_speed return msg; ``` -------------------------------- ### Get Full Project Definition Source: https://context7.com/frangoteam/fuxa/llms.txt Returns the entire FUXA project JSON. Read permission is enforced based on user groups. ```bash curl -s http://localhost:1881/api/project \ -H "x-access-token: $TOKEN" | jq '{hmi: .hmi | keys, devices: (.devices | keys)}' # { "hmi": ["view_main","view_pump"], "devices": ["plc_s7","mqtt_broker"] } ``` -------------------------------- ### Install Node.js and Dependencies for Electron Source: https://github.com/frangoteam/fuxa/blob/master/docs/Installing-and-Running.md Installs Node.js version 18 and updates package lists. This is a prerequisite for setting up FUXA with Electron. ```bash sudo apt-get update curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - sudo apt-get install -y nodejs ``` -------------------------------- ### Example Usage of 'set-tag' Node Source: https://github.com/frangoteam/fuxa/blob/master/server/integrations/node-red/node-red-contrib-fuxa/nodes/fuxa-set-tag.html This example demonstrates how to use the 'set-tag' node. By setting `msg.topic` to a tag identifier (e.g., "V2") and `msg.payload` to the desired value (e.g., `true`), the node will update the specified FUXA tag with the provided payload. ```javascript msg.topic = "V2"; msg.payload = true; ``` -------------------------------- ### Package the Electron Application Source: https://github.com/frangoteam/fuxa/blob/master/README.md Commands to install dependencies and package the FUXA Electron application after building the server and client. This is typically done within the './app' directory. ```bash cd ./app npm install npm run package ``` -------------------------------- ### Configure Fuxa Electron Systemd Service Source: https://github.com/frangoteam/fuxa/blob/master/docs/Installing-and-Running.md Set up a systemd user service to automatically start the Fuxa Electron application on boot. ```ini [Unit] Description=Start Fuxa Electron Script After=default.target [Service] ExecStart=/opt/fuxa-electron-startup.sh [Install] WantedBy=default.target ``` -------------------------------- ### Manage Plugins Source: https://context7.com/frangoteam/fuxa/llms.txt Endpoints for managing device driver plugins, including listing installed plugins, installing new ones, and uninstalling existing ones. Requires administrator privileges. ```APIDOC ## GET /api/plugins / POST /api/plugins / DELETE /api/plugins ### Description Lists installed plugins (e.g., Modbus, BACnet drivers), installs new ones from npm, or uninstalls existing ones. Requires admin permission. ### Method GET, POST, DELETE ### Endpoint /api/plugins ### Request Example (List Plugins) ```bash curl -s http://localhost:1881/api/plugins \ -H "x-access-token: $TOKEN" | jq . ``` ### Request Example (Install Plugin) ```bash curl -s -X POST http://localhost:1881/api/plugins \ -H "x-access-token: $TOKEN" \ -H 'Content-Type: application/json' \ -d '{ "params": { "name": "@frangoteam/fuxa-mod-bacnet" } }' ``` ### Request Example (Uninstall Plugin) ```bash curl -s -X DELETE "http://localhost:1881/api/plugins?param=@frangoteam/fuxa-mod-bacnet" \ -H "x-access-token: $TOKEN" ``` ### Response Example (List Plugins) ```json [{ "name": "@frangoteam/fuxa-mod-modbus", "version": "1.0.2", "type": "ModbusTCP" }] ``` ### Response Example (Install/Uninstall Plugin) HTTP 200 ``` -------------------------------- ### ODBC Connection Strings Source: https://github.com/frangoteam/fuxa/blob/master/docs/HowTo-ODBC.md Examples of connection strings for PostgreSQL and MySQL databases. Note the SSLMODE variations for MySQL. ```plaintext DRIVER=PostgreSQL;SERVER=Your_DB_IP;PORT=5432;DATABASE=testDB ``` ```plaintext DRIVER=MySQL;SERVER=Your_DB_IP;PORT=3306;DATABASE=testDB;SSLMODE=DISABLED ``` ```plaintext SSLMODE=ENABLE ``` ```plaintext SSLMODE=DISABLED ``` -------------------------------- ### GET /api/settings Source: https://context7.com/frangoteam/fuxa/llms.txt Fetches the current server configuration settings. Sensitive fields are omitted, and authentication is not required. ```APIDOC ## GET /api/settings ### Description Returns the current server configuration with sensitive fields (`secretCode`, SMTP password, DAQ credentials) stripped. Does not require authentication. ### Method GET ### Endpoint /api/settings ### Parameters #### (No parameters) ### Request Example ```bash curl -s http://localhost:1881/api/settings | jq '{secureEnabled, language, nodeRedEnabled, broadcastAll}' ``` ### Response #### Success Response (200) - **secureEnabled** (boolean) - Indicates if secure mode is enabled. - **language** (string) - The current language setting. - **nodeRedEnabled** (boolean) - Indicates if Node-RED is enabled. - **broadcastAll** (boolean) - Indicates if broadcasting to all is enabled. #### Response Example ```json { "secureEnabled": true, "language": "en", "nodeRedEnabled": false, "broadcastAll": false } ``` ``` -------------------------------- ### Example Output: Execute Script Source: https://github.com/frangoteam/fuxa/blob/master/docs/HowTo-Node-Red.md Shows the expected output format after executing a FUXA script. The payload includes a success status, script name, result message, and timestamp. ```json { "payload": { "success": true, "script": "myScript", "result": "Script completed successfully", "timestamp": "2025-01-01T10:45:00Z" } } ``` -------------------------------- ### Get Full Project Definition Source: https://context7.com/frangoteam/fuxa/llms.txt Returns the entire FUXA project JSON containing views, devices, tags, alarms, and scripts. Read permission is enforced based on user groups. ```APIDOC ## GET /api/project — Get full project definition ### Description Returns the entire FUXA project JSON containing views, devices, tags, alarms, and scripts. Read permission is enforced based on user groups. ### Method GET ### Endpoint /api/project ### Response #### Success Response (200) - **hmi** (object) - Contains keys of HMI views. - **devices** (object) - Contains keys of devices. ### Response Example ```json { "hmi": ["view_main","view_pump"], "devices": ["plc_s7","mqtt_broker"] } ``` ``` -------------------------------- ### Set up Electron Project Directory Source: https://github.com/frangoteam/fuxa/blob/master/docs/Installing-and-Running.md Creates the necessary directories and initializes a new Node.js project for the Electron application. ```bash cd /opt sudo mkdir electron cd electron sudo mkdir fuxa-electron cd fuxa-electron sudo npm init -y sudo npm install electron --save-dev ``` -------------------------------- ### Prepare for Custom Docker Image Build Source: https://github.com/frangoteam/fuxa/blob/master/docs/Installing-and-Running.md Sets up the directory structure and downloads the Dockerfile for building a custom FUXA Docker image from source. ```bash cd mkdir docker mkdir fuxa cd docker/fuxa mkdir fuxa-build cd fuxa-build wget https://raw.githubusercontent.com/frangoteam/FUXA/master/Dockerfile ``` -------------------------------- ### Dynamic Timestamp Overrides Source: https://github.com/frangoteam/fuxa/blob/master/node-red/node-red-contrib-fuxa/nodes/fuxa-get-history-alarms.html Examples demonstrating how to dynamically override the start and end timestamps for retrieving historical alarms using `msg.start` and `msg.end` properties. ```javascript // Get alarms for last week msg.start = Date.now() - 604800000; msg.end = Date.now(); ``` ```javascript // Get alarms for specific date range msg.start = "2025-01-01 00:00:00"; msg.end = "2025-01-07 23:59:59"; ``` -------------------------------- ### Example Output: Get DAQ Data Source: https://github.com/frangoteam/fuxa/blob/master/docs/HowTo-Node-Red.md Demonstrates the structure of Data Acquisition (DAQ) data for a single tag. The payload is an array of objects, each containing a timestamp, value, and quality status. ```json { "payload": [ {"timestamp": "2025-01-01T10:00:00Z", "value": 25.3, "quality": "good"}, {"timestamp": "2025-01-01T10:01:00Z", "value": 25.8, "quality": "good"} ] } ``` -------------------------------- ### Example Output: Get Active Alarms Source: https://github.com/frangoteam/fuxa/blob/master/docs/HowTo-Node-Red.md Illustrates the structure of the output when retrieving active alarms. The payload contains an array of alarm objects, each with details like ID, name, status, timestamp, and value. ```json { "payload": [ { "id": "alarm1", "name": "High Temperature", "status": "active", "timestamp": "2025-01-01T10:30:00Z", "value": 85.5 } ] } ``` -------------------------------- ### Get alarm history with time filters Source: https://context7.com/frangoteam/fuxa/llms.txt Retrieve historical alarm data using the /api/alarmsHistory endpoint. Filter by 'from' and 'to' timestamps. The example pipes the output to 'jq length' to count the number of historical alarms. ```bash curl -s "http://localhost:1881/api/alarmsHistory" \ -H "x-access-token: $TOKEN" \ -G --data-urlencode 'from=1711900000000' \ --data-urlencode 'to=1712000000000' | jq 'length' ``` -------------------------------- ### Build Server and Client for Electron App Source: https://github.com/frangoteam/fuxa/blob/master/README.md Steps to build the server and client components of the FUXA Electron application. Navigate to the respective directories and run npm install and npm run build for the client. ```bash cd ./server npm install cd ../client npm install npm run build ``` -------------------------------- ### Using Multiple ODBC Connections Source: https://github.com/frangoteam/fuxa/blob/master/docs/HowTo-ODBC.md Demonstrates how to initialize multiple ODBC device connections in FUXA. Each connection requires a unique name. ```javascript Script 1 let myDevice1 = await $getDevice('postgreSQL', true); Script 2 let myDevice2 = await $getDevice('postgreSQL', true); ``` -------------------------------- ### Build FUXA Frontend for Production Source: https://github.com/frangoteam/fuxa/blob/master/README.md Builds the FUXA frontend for production deployment. This command optimizes the client-side code for performance and size. ```bash cd ./client ng build --configuration=production ``` -------------------------------- ### Get Tag Node Description Source: https://github.com/frangoteam/fuxa/blob/master/node-red/node-red-contrib-fuxa/nodes/fuxa-get-tag.html Provides a brief explanation of the FUXA Get Tag node's purpose and how its output is handled. ```html
Get the value of a FUXA tag.
The tag value is set to msg.payload.