@sieumayman/node-red-contrib-miza 1.0.0

Easy-to-use connect s7 node to influxdb node

npm install @sieumayman/node-red-contrib-miza

# node-red-contrib-miza

Custom Node-RED nodes for industrial IoT / Smart Factory applications.  
Package này được xây dựng để tích hợp dữ liệu sản xuất từ PLC, xử lý metadata thiết bị, gom nhóm tín hiệu và ghi dữ liệu vào InfluxDB phục vụ Dashboard / OEE / Analytics.

---

# 📦 Tính năng chính

- Kết nối và xử lý dữ liệu thời gian thực từ PLC
- Tạo metadata chuẩn nhà máy:
  - Factory
  - System
  - Subsystem
  - Section
  - Line
  - Machine
  - Label
- Node gom nhóm tín hiệu theo template
- Node insert dữ liệu chuẩn hóa vào InfluxDB
- Hỗ trợ mở rộng cho OEE / Mass Balance / Energy / SPC

---

# 📁 Cấu trúc node

Package hiện tại gồm các custom nodes:

- `miza-config`
- `miza-group-template`
- `miza-s7-group`
- `miza-insert`

---

# ⚙️ Yêu cầu môi trường

- Node.js >= 20 (khuyến nghị 22)
- Node-RED >= 3.x
- npm >= 10
- Docker (nếu chạy container)

---

# 🚀 How to install (Development Setup)

## 1. Khởi tạo project

```bash
npm init -y
git init
touch .gitignore
git add -A
git commit -m "chore(init): initialize project"

2. Cài TypeScript

npm i -D [email protected]
touch tsconfig.json

3. Cài Commitlint

npm i -D @commitlint/[email protected] @commitlint/[email protected]
touch commitlint.config.ts

commitlint.config.ts

export default {
  extends: ['@commitlint/config-conventional']
}

4. Cài Husky

npm i -D [email protected]
npx husky init

Tạo hook commit-msg

echo 'npx --no --commitlint --edit ${1}' > .husky/commit-msg
chmod +x .husky/commit-msg

5. Commit cấu hình

git add -A
git commit -m "chore(commitlint): install conventional commit tools"

6. Cài ESLint

npm install -D eslint
npx eslint --init
git add -A
git commit -m "chore(eslint): initialize eslint"

7. Cài NVM + Node.js 22

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
source ~/.zshrc
nvm --version
nvm install 22
nvm use 22
nvm alias default 22

Kiểm tra:

node -v
npm -v

8. Cài lại dependencies

rm -rf node_modules package-lock.json
npm install

▶️ How to run

Local Development

npm install
npm run build

🐳 Local Testing of Unpublished Package (Docker + Node-RED)

Nếu package chưa publish npm, dùng npm link

Link package vào Node-RED container

sudo docker exec -it hands-on-iot-node-red-1 sh -c '
cd /workspace/node-red-contrib-miza && 
npm install && 
npm link && 
cd /data && 
npm link node-red-contrib-miza
'

Restart container

sudo docker restart hands-on-iot-node-red-1

📂 Mount volume khuyến nghị cho Node-RED

services:
  node-red:
    image: nodered/node-red
    ports:
      - "1880:1880"
    volumes:
      - ./data:/data
      - ./workspace:/workspace

🧪 Publish package locally

npm pack

hoặc:

npm publish

📝 Conventional Commit Rules

Ví dụ commit hợp lệ:

feat(node): add miza insert node
fix(s7): reconnect after timeout
docs(readme): update install guide
refactor(config): simplify schema
chore(deps): update eslint

📊 Use Cases

Package phù hợp cho:

  • OEE Dashboard
  • Mass Balance
  • Energy Monitoring
  • Production Tracking
  • Alarm Monitoring
  • SPC Dashboard
  • Paper Mill / Pulping / Water Treatment

🔧 Troubleshooting

Restart Node-RED bị mất nodes

Đảm bảo mount volume /data

-v ./data:/data

Package link xong không thấy node

Trong container chạy:

cd /data
npm list

Nếu chưa có:

npm link node-red-contrib-miza

Permission denied

sudo chown -R 1000:1000 ./data

📌 TODO

  • TypeScript migration
  • Unit test
  • Auto publish CI/CD
  • Dynamic schema generator
  • UI editor validation
  • Better error logging

👨‍💻 Author

MIZA Automation Team


📄 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

  • miza-config
  • miza-group-template
  • miza-s7-group
  • miza-insert

Keywords

  • node-red
  • chanelcolgate

Maintainers