Hardware Monitor API
About 1251 wordsAbout 4 min
2021-05-27
Here is the API documentation for the hardware monitoring software. The communication protocols supported are the MQTT
protocol and the Websocket
protocol.
For the Websocket
protocol, please refer to the Power-On Card API: Power-On Card API.
Preparation
Name | Required | Description | How to Obtain |
---|---|---|---|
token | Yes | Device token | Device you want to control -> Gear icon in the top right -> Network Info -> TOKEN |
key | Yes | User key | My -> About -> Development -> Key |
secret | Yes | User TOKEN | My -> About -> Development -> Secret |
The above parameters can also be obtained from the config.json
file in the hardware monitoring software directory.
{
...
"Device": {
"UserToken": "xxxx...",
"DeviceType": "pcHealth1",//Device type
"DeviceToken": "7f68d81a6f1d********cb7487860e212c",//Device token
"AuthKey": "d82ebc98453ded********d8c73149dda745ed0b2",// user key
"AuthSecret": "69e6328bcc805********884347561e50de40311e" // user secret
},
...
}
Connect to the server
Name | Required | Description |
---|---|---|
host | broker.iot.sumsg.com | Server address |
port | 1315 | Port |
client ID | Client ID | win_Custom string |
Username | Username | key mentioned in preparation |
Password | Password | secret mentioned in preparation |
ssl | true | Use SSL, must be true |
MQTT Version | 3.1.1 | Supported MQTT version |
Clean Session | true | |
Last will Topic | Topic | Same as [Subscribe to topic](#Subscribe to topic) |
Last will Payload | Last words |
Connection diagram using MQTTX client:
Subscribe to the diagram using the MQTTX client:
Subscribe to topics
Format: /su/device type/device token/server
QoS: 0
If the device type bound in the boot card is pcSw3
, the device type directly bound is pcHealth1
Example:
su/pcSw3/7f68d81a6f1d********cb7487860e212c/server
su/pcHealth1/7f68d81a6f1d********cb7487860e212c/server
After the subscription is successful, the home page data will be sent by default:
Reference: [Get APP home page data](#Get APP home page data)
Publish topic
Same as [Subscribe to topic](#Subscribe to topic)
Device verification field
Generated format: md5(token + productName + "M2PC")
md5("7f68d81a6f1d********cb7487860e212cpcHealth1M2PC");
Get the specified data
Tips
This command is executed once, and the data will be returned according to this command in the future. There is no need to repeat it.
{
"t": "M2PC", // Command
"s": "start", // Data start
"type": "all", // Reference: Command type
"tk": "Refer to [Device verification field] calculation method" // Device verification field
}
Instruction type
type | Description |
---|---|
home | [Get APP homepage data](#Get APP homepage data) |
all | [Get all data](#Get all data) |
cpu | [Get CPU data](#Get CPU data) |
gpu | [Get GPU data](#Get GPU data) |
hdd | [Get hard disk data](#Get hard disk data) |
mbd | [Get motherboard data](#Get motherboard data) |
net | [Get network data](#Get network data) |
ram | [Get memory data](#Get memory data) |
batt | [Get battery data](#Get battery data) |
os | [Get operating system data](#Get operating system data) |
Get APP homepage data
Send data:
{"t":"M", "tk":"Device verification field"}
Receive data:
{
"t": "M",//Data type
"ps": 1,//Power on status 0 is off, 1 is on
"cpu": 19.1,//CPU usage (0-100)%
"ram": 51,//Memory usage (0-100)%
"hdd": [
83.25,//Hard disk usage (0-100)%
2365087,//Total hard disk size
0//Hard disk temperature (default first disk)
]
}
Get all data
Send data:
{"t":"M2PC", "s":"start", "type":"all", "tk":"Device verification field"}
Receive data:
{
"t": "PC2M", //Data type
"v": "1.0.2.8", //PC client version number
"pf": "windows", //System platform (macos, windows, linux)
"CPU": [
36.33, //CPU usage (0-100)%
68 //CPU temperature in degrees Celsius
],
"GPU": [
1, //GPU usage (0-100)%
52 //GPU temperature in degrees Celsius
],
"RAM": [
51, // Memory usage (0-100)%
24, // Total memory size Unit G
12 // Remaining memory size Unit G
],
"HDD": [
83.24, // Hard disk usage (0-100)%
2365087, // Total hard disk size Unit MB
396300, // Remaining hard disk size Unit MB
0, // Hard disk read and write speed Unit MB/s
0 // Hard disk read and write time Unit ms
],
"Network": [
19196123648, /// Number of bytes received by the network
23611559936 // Number of bytes sent by the network
],
"MBD": [
56 // Motherboard temperature
],
"Uptime": [
796752, // Run time in seconds
0, // 5-minute load
0, // 10-minute load
0, // 15-minute load
"Microsoft Windows NT 10.0.22000.0", // Operating system version
"6.0.36" // Operating system version number
]
}
###Get CPU data
Send data:
{"t":"M2PC", "s":"start", "type":"cpu", "tk":"Device verification field"}
Receive data:
{
"t": "PC2M", // Command
"v": "1.0.2.8", // Version
"pf": "windows", // Operating system
"CPU": [
{
"Name": "Intel Core i7-4790K", // CPU name
"CoreNum": 0, // CPU core number
"Kernel": "64", // CPU architecture
"Temp": 60, // CPU temperature
"Power": 35.24, // CPU power consumption in W
"Load": 14.47 // CPU load
}
]
}
Get GPU data
Send data:
{"t":"M2PC", "s":"start", "type":"gpu", "tk":"Device verification field"}
Receive data:
{
"t": "PC2M", // Type
"v": "1.0.2.8", // Version
"pf": "windows", // Operating system
"GPU": [
{
"Name": "NVIDIA GeForce RTX 2070 SUPER", // gpu name
"Temp": 52, // gpu temperature
"Power": 0, // gpu power consumption in W
"Load": 1, // gpu load
"Memory": {
"Total": 8192, // Total memory
"Free": 7470, // Available memory
"Used": 721 // Used memory
}
}
]
}
Get hard disk data
Send data:
{"t":"M2PC", "s":"start", "type":"hdd", "tk":"Device verification field"}
Receive data:
{
"t": "PC2M",
"v": "1.0.2.8",
"pf": "windows",
"HDD": [
{
"Letter": "C", // Drive letter
"Label": "windows11", // Drive letter label
"Format": "NTFS", // Drive letter format
"Health": "good", // Hard disk health status
"Total": 457360, // Hard disk total size
"Free": 216710, // Hard disk available size
"Name": "/", // Hard disk name
"Temp": -99, // Temperature -99 means not supported
"PHO": -99 // Hard disk usage time -99 means not supported
},
...
]
}
Get motherboard data
Send data:
{"t":"M2PC", "s":"start", "type":"mbd", "tk":"Device verification field"}
Receive data:
{
"t": "PC2M",
"v": "1.0.2.8",
"pf": "windows",
"MBD": [
{
"Name": "ASUS Z97-K R2.0", // Motherboard name
"Temp": 55, // Motherboard temperature
"Fan": [
1715, // Fan speed 1
895, // Fan speed 2
959, // Fan speed 3
0, // Fan speed 4
0, // Fan speed 5
0 // Fan speed 6
]
}
]
}
Get network data
Send data:
{"t":"M2PC", "s":"start", "type":"net", "tk":"Device verification field"}
Receive data:
{
"t": "PC2M",
"v": "1.0.2.8",
"pf": "windows",
"Network": [
{
"Name": "Ethernet 3",
"Upload": 1634204160, // Upload speed in bytes/second
"Download": 9632109568 // Download speed in bytes/second
},
{
"Name": "Ethernet 4",
"Upload": 0,
"Download": 0
}
]
}
Get memory data
Send data:
{"t":"M2PC", "s":"start", "type":"ram", "tk":"Device verification field"}
Receive data:
{
"t": "PC2M",
"v": "1.0.2.8",
"pf": "windows",
"RAM": [
52, // Memory usage in %
24, // Total memory size in GB
12 // Available memory size in GB
]
}
Get battery data
Send data:
{"t":"M2PC", "s":"start", "type":"batt", "tk":"Device verification field"}
Receive data:
{
"t": "PC2M",
"v": "1.0.2.8",
"pf": "windows",
"Network": [
{
"isCharging": true, // Is it charging?
"per": 12, // Battery percentage
"fullyCharged": false , // Is it fully charged?
"health": 99, // Battery health
"cycleCount": 300, // Battery charge count
"acConnected": true, // Is it connected to a power source?
"acWatts": 30, // Power wattage
},
...
]
}
Unbind device
Execute this command, the device will be unbound
{
"t": "M2PC", // Command
"s": "unbind", // Command type
"tk": "Refer to [Device verification field] calculation method" // Device verification field
}
Copyright
License under:Attribution 4.0 International (CC-BY-4.0)