node-red-contrib-sfcored 1.0.0

Node-RED integration for SFCoRED Controller

npm install node-red-contrib-sfcored

Node-RED SFCoRED Integration

Node-RED integration for SFCoRED.

Features

  • ⚑ Event Triggers: Subscribe to SFC step events
  • πŸ“Š Variable Updates: Publish variable updates to SFC diagrams
  • πŸ” Secure Authentication: Support for user and project-based authentication

Installation

cd ~/.node-red
npm install node-red-contrib-sfcored

Or install directly from Node-RED:

  1. Menu β†’ Manage palette β†’ Install
  2. Search for node-red-contrib-sfcored

Nodes

1. SFC Controller Config

Configuration node for connecting to SFCoRED via MQTT.

Configuration:

  • Name: Optional descriptive name
  • Host: Server hostname (default: sfcored.com)
  • Protocol: HTTP/HTTPS (default: https)
  • MQTT Port: MQTT broker port (default: 9883)
  • Username: Authentication username (user email or sfc::{projectId})
  • Password: Authentication password
  • Timeout: API request timeout in milliseconds (default: 2000)

Authentication Methods:

  1. User Login:

  2. Project Login:

    • Username: sfc::{projectId} (e.g., sfc::gki5m22tn68ph8w)
    • Password: calculated value (project ID digits + 880210)

Connection Details:

  • HTTP API: {protocol}://{host}
  • MQTT Broker: mqtts://{host}:{mqttPort} (or mqtt:// for HTTP)

2. SFC Event Trigger

Receives SFC events via MQTT subscriptions.

Features:

  • Subscribe to specific event types
  • Filter by Chart (POU) and Step
  • Real-time event notifications

Output:

{
  "payload": {
    "type": "step_enter",
    "engine": "POU_Main",
    "step": "Step1",
    "timestamp": "2026-01-25T10:30:00Z",
    "variables": { "counter": 10 }
  },
  "topic": "sfc/[email protected]/events/step_enter",
  "_event": {
    "type": "step_enter",
    "engine": "POU_Main",
    "step": "Step1"
  }
}

3. SFC Variable Update

Updates SFC variables by publishing to MQTT topics.

Features:

  • Batch variable updates
  • Multiple value sources (msg, flow, global, static)
  • QoS 1 delivery guarantee

Example:

// Input msg
msg.payload = { temperature: 25.5, enabled: true };

// Variables configured:
// - name: "setpoint", type: "msg", value: "payload.temperature"
// - name: "enable", type: "msg", value: "payload.enabled"

// Publishes to: sfc/{username}/variables/set

MQTT Topics

Topics use the authenticated username as the identifier:

Event Topics (Subscribe)

sfc/{username}/events/step_enter    - Step activation
sfc/{username}/events/step_exit     - Step deactivation
sfc/{username}/events/transition    - Transition fired
sfc/{username}/events/variable      - Variable changed
sfc/{username}/events/error         - Error occurred

Control Topics (Publish)

sfc/{username}/variables/set        - Update variables
sfc/{username}/control/start        - Start execution
sfc/{username}/control/stop         - Stop execution
sfc/{username}/control/reset        - Reset state

Example Flow

[
  {
    "id": "mqtt-config",
    "type": "sfc-controller-config",
    "name": "My SFC Server",
    "host": "sfcored.com",
    "protocol": "https",
    "mqttPort": 9883,
    "username": "[email protected]"
  },
  {
    "id": "event-listener",
    "type": "sfc-event-trigger",
    "name": "Listen to Step1",
    "server": "mqtt-config",
    "pou": "POU_Main",
    "step": "Step1",
    "events": ["step_enter", "step_exit"]
  },
  {
    "id": "variable-update",
    "type": "sfc-variable-update",
    "name": "Update Setpoint",
    "server": "mqtt-config",
    "variables": [
      { "name": "setpoint", "type": "msg", "value": "payload" }
    ]
  }
]

Advantages over HTTP Webhook

βœ… No port forwarding required - Only outbound MQTT connection needed
βœ… Firewall friendly - Works behind NAT
βœ… Auto-reconnect - Built-in MQTT reconnection logic
βœ… QoS support - Guaranteed message delivery
βœ… Multi-client - Multiple Node-RED instances can connect
βœ… Real-time - Push-based event delivery

Requirements

  • Node.js >= 14
  • Node-RED >= 2.0

Internationalization

This module supports multiple languages:

  • English (en-US) - Default
  • Chinese (zh-CN) - δΈ­ζ–‡ζ”―ζŒ

The language is automatically detected from your browser settings.

License

MIT

Node Info

Version: 1.0.0
Updated 2 days ago
License: MIT
Rating: not yet rated

Categories

Actions

Rate:

Downloads

0 in the last week

Nodes

  • sfc-controller-config
  • sfc-event-trigger
  • sfc-variable-update

Keywords

  • node-red
  • sfc
  • sfcored
  • automation

Maintainers