Skip to content
No description, website, or topics provided.
JavaScript Python HTML CSS C++
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode Add UPS doc Oct 1, 2018
DL303 Add DL303 demo Dec 20, 2018
Delta_UPS Add UPS doc #1 Oct 1, 2018
Demo Debug #2 May 25, 2018
ET7044 Debug html tag & socket connect Oct 10, 2018
PM3133
doc Add database doc Oct 1, 2018
heroku Update text Jun 11, 2019
icinga2
lib-license Add library license #1 Mar 9, 2019
lib Update mongoDB.js module.exports function to class Jun 16, 2019
picture Add DL303 Sep 29, 2018
power-meter Fix arduino doc bug Feb 27, 2019
public
queryDB
test Debug yesterdayStart and yesterdayEnd value in aggregateYesterdayAvgP… Sep 7, 2018
.env-sample 重組 .env 設定檔 Mar 6, 2019
.gitignore 重組 .env 設定檔 Mar 6, 2019
LICENSE Add License Mar 7, 2019
README.md Add library license Mar 9, 2019
app.js Update setInterval Jun 18, 2019
build.json Add DL303 in build.json Dec 20, 2018
mongoDB.js Add DL303 demo Dec 20, 2018
package.json Add query UPS logs export file May 24, 2019

README.md

Smart-data-center

作品展示

1.mobile demo:https://www.youtube.com/watch?v=frStPQSN2lY

2.linebot demo:https://www.youtube.com/watch?v=kMMYxFdER4M

3.raspberry pi3 touch panel demo:https://www.youtube.com/watch?v=LIEXDQloP2w

版本更新

Version1:Power-Meter

Version2:Factory

Version3:Smart-Data-Center

自製LINE-BOT模組

自製LINE-BOT模組

3/2開源軟硬體機房環控建置經驗分享PPT

開源軟硬體機房環控建置經驗分享PPT

第三方Library license

Library license

實作環境

nodeJS執行環境

npm v5.6+ node v8+

python3執行環境

Python v3.7.0+

Database環境需求

mongoDB v3.6+

MQTT Protocol broker

mosquitto

架構圖

終端監控設備控制程式

1. 自製電源及環境監測裝置(安裝教學

MQTT Topic Description Message
current 溫度、濕度、電流 {
"Humidity":26,
"Temperature":36,
"currents":12
}

2.工業級數位訊號輸入控制器ET7044(範例程式

MQTT Topic Description Message
ET7044/DOstatus ET7044 D0~D7 status [false, false, false, false, false, false, false, false]
ET7044/write Control D0~D7 status [false, false, false, false, false, false, false, false]

3.工業級環境監控設備DL303(測試程式)

內建MQTT功能可將資料直接推送到指定Broker

MQTT Topic Description Message
DL303/CO2 CO2測量 0 to 9999 ppm (NDIR)
DL303/RH 相對溼度測量 0 to 100% RH
DL303/TC 溫度測量 -10 to +50°C
DL303/DC 露點溫度 由溫度與相對溼度計算而得

4.工業級電源監控設備PM3133(範例程式

MQTT Topic Description Message
PM3133/A 比流器1 10 (A)
PM3133/B 比流器2 10 (A)
PM3133/C 比流器3 10 (A)

5.UPS 監控程式(範例程式

MQTT Topic Description Message
UPS_Monitor UPS監測 example

6.web service & socket.io service(範例程式

(1)web service

Method API Description
GET / web dashboard
POST /ET7044 ET7044 control

(2)socket.io

current data structure:https://github.com/TitanLi/smart-data-center/blob/master/doc/MQTT/current.json

UPS_Monitor data structure:https://github.com/TitanLi/smart-data-center/blob/master/doc/MQTT/UPS_Monitor.json

ET7044/DOstatus data structure:https://github.com/TitanLi/smart-data-center/blob/master/doc/MQTT/ET7044-DOstatus.js

Event Source JSON KEY
humidity MQTT topic current Humidity
temperature MQTT topic current Temperature
current MQTT topic current currents
inputVolt_A MQTT topic UPS_Monitor input_A.inputVolt_A
inputFreq_A MQTT topic UPS_Monitor input_A.inputFreq_A
outputVolt_A MQTT topic UPS_Monitor output_A.outputVolt_A
outputFreq_A MQTT topic UPS_Monitor output_A.outputFreq_A
outputAmp_A MQTT topic UPS_Monitor output_A.outputAmp_A
outputWatt_A MQTT topic UPS_Monitor output_A.outputWatt_A
systemMode_A MQTT topic UPS_Monitor output_A.systemMode_A
outputPercent_A MQTT topic UPS_Monitor output_A.outputPercent_A
batteryHealth_A MQTT topic UPS_Monitor battery_A.status.batteryHealth_A
batteryCharge_Mode_A MQTT topic UPS_Monitor battery_A.status.batteryCharge_Mode_A
batteryTemp_A MQTT topic UPS_Monitor battery_A.status.batteryTemp_A
batteryRemain_A MQTT topic UPS_Monitor battery_A.status.batteryRemain_Min_A
battery_A.status.batteryRemain_Sec_A
batteryRemain_Percent_A MQTT topic UPS_Monitor battery_A.status.batteryRemain_Percent_A
inputVolt_B MQTT topic UPS_Monitor input_B.inputVolt_B
inputFreq_B MQTT topic UPS_Monitor input_B.inputFreq_B
outputVolt_B MQTT topic UPS_Monitor output_B.outputVolt_B
outputFreq_B MQTT topic UPS_Monitor output_B.outputFreq_B
outputAmp_B MQTT topic UPS_Monitor output_B.outputAmp_B
outputWatt_B MQTT topic UPS_Monitor output_B.outputWatt_B
systemMode_B MQTT topic UPS_Monitor output_B.systemMode_B
outputPercent_B MQTT topic UPS_Monitor output_B.outputPercent_B
batteryHealth_B MQTT topic UPS_Monitor battery_B.status.batteryHealth_B
batteryCharge_Mode_B MQTT topic UPS_Monitor battery_B.status.batteryCharge_Mode_B
batteryTemp_B MQTT topic UPS_Monitor battery_B.status.batteryTemp_B
batteryRemain_B MQTT topic UPS_Monitor battery_B.status.batteryRemain_Min_B
battery_B.status.batteryRemain_Sec_B
batteryRemain_Percent_B MQTT topic UPS_Monitor battery_B.status.batteryRemain_Percent_B
D0 MQTT topic ET7044/DOstatus Array[0]
D1 MQTT topic ET7044/DOstatus Array[1]
D2 MQTT topic ET7044/DOstatus Array[2]

7.database(範例程式

(1)Localhost MongoDB Database

Database name smart-data-center

Database Collection Description Data example
smart-data-center powerMeter power-meter logs example
smart-data-center powerMeterPower power-meter watt logs example
smart-data-center ups delta ups logs example
smart-data-center upsPower_A delta ups watt logs example
smart-data-center upsPower_B delta ups watt logs example

(2)Public Cloud MongoDB Database(mLab)

mLab for linebot use

Database name smart-data-center

Database Collection Description Data example
smart-data-center powerMeter Latest power-meter information example
smart-data-center ups_A Latest delta ups(A) information example
smart-data-center ups_B Latest delta ups(B) information example
smart-data-center control Latest ET7044 control information example

7.linebot service on HEROKU(範例程式

Service for linebot use

Method API Description Body Example
GET / test heroku service
GET /test test connect mLab
POST /webhooks for linebot use
POST /post/push notify power consumption {
powerMeterPower: 123,
upsPower_A: 456,
upsPower_B: 789
}
POST /post/control/message ET7044 control {
message: "進風風扇:開啟"
}
POST /message icinga2 alert notification {
message: "需要維修"
}

部署

(1)Git clone project

$ git clone https://github.com/TitanLi/smart-data-center.git

(2) Switch directory

$ cd smart-data-center

(3)Install modules

$ npm install

(4)Install pm2 project management tool

$ npm install pm2 -g

(5)Edit build.json 留下需要的服務

{
  "apps": [
    {
      "name": "smart-data-center",
      "script": "./app.js"
    },
    {
      "name": "smart-data-center-mongodb",
      "script": "./mongoDB.js"
    },
    {
      "name": "smart-data-center-icinga2",
      "script": "./icinga2/icinga2.js"
    },
    {
      "name": "smart-data-center-ET7044",
      "script": "./ET7044/ET7044_finish.js"
    }
  ]
}

(6)建立 .env 檔案

cp .env-sample .env

(7)更新.env參數

PORT = 3006
ICINGA2_PORT = 3001
MQTT = 'mqtt://127.0.0.1:1883'
MONGO_URL = 'mongodb://USER-NAME:PASSWORD@PROJECT-ID.mlab.com:37922/smart-data-center'
MONGODB = 'mongodb://127.0.0.1:27017/'

(8)run service

$ npm start

臺中科技大學資工系IMAC團隊開發維護建置於資訊與流通學院智慧聯網尖端實驗室開源雲端機房

You can’t perform that action at this time.