xref: /openbmc/entity-manager/schemas/modbus.json (revision c7618dda532cfc40c2f5851f52df0d2380134938)
1{
2    "$schema1": "http://json-schema.org/draft-07/schema#",
3    "$defs": {
4        "ModbusRTUDetect": {
5            "additionalProperties": false,
6            "description": "The definition for the modbus device.",
7            "type": "object",
8            "properties": {
9                "Type": {
10                    "description": "The type of configuration object.",
11                    "const": "ModbusRTUDetect"
12                },
13                "Name": {
14                    "description": "The name of the modbus device.",
15                    "type": "string"
16                },
17                "Address": {
18                    "description": "The address ranges for the modbus device.",
19                    "type": "array",
20                    "items": {
21                        "type": "object",
22                        "additionalProperties": false,
23                        "properties": {
24                            "RangeStart": {
25                                "description": "The start address for the address range of the modbus device.",
26                                "type": "number"
27                            },
28                            "RangeEnd": {
29                                "description": "The end address for the address range of the modbus device.",
30                                "type": "number"
31                            },
32                            "SerialPort": {
33                                "description": "The name of the serial port from SerialPort definition.",
34                                "type": "string"
35                            }
36                        },
37                        "required": ["RangeStart", "RangeEnd", "SerialPort"]
38                    }
39                },
40                "Registers": {
41                    "description": "The Modbus register definition.",
42                    "type": "array",
43                    "items": {
44                        "type": "object",
45                        "additionalProperties": false,
46                        "properties": {
47                            "Name": {
48                                "description": "The name of the register.",
49                                "enum": [
50                                    "PartNumber",
51                                    "SparePartNumber",
52                                    "SerialNumber",
53                                    "BuildDate",
54                                    "Model",
55                                    "Manufacturer"
56                                ]
57                            },
58                            "Address": {
59                                "description": "The address of the register.",
60                                "type": "number"
61                            },
62                            "Size": {
63                                "description": "The size of the register in bytes.",
64                                "type": "number"
65                            }
66                        },
67                        "required": ["Name", "Address", "Size"]
68                    }
69                },
70                "DataParity": {
71                    "description": "The parity to use for data transmission.",
72                    "enum": ["Odd", "Even", "None"]
73                },
74                "BaudRate": {
75                    "description": "The baudrate of the communication channel.",
76                    "enum": [9600, 19200, 57600, 115200]
77                }
78            },
79            "required": [
80                "Name",
81                "Type",
82                "Address",
83                "Registers",
84                "DataParity",
85                "BaudRate"
86            ]
87        },
88        "ModbusRTUDevice": {
89            "description": "The definition for the modbus device.",
90            "type": "object",
91            "additionalProperties": false,
92            "properties": {
93                "Type": {
94                    "description": "The type of configuration object",
95                    "enum": [
96                        "ModbusRDF040DSS5193E0ReservoirPumpUnit",
97                        "ModbusRDF040DSS5193E0HeatExchanger"
98                    ]
99                },
100                "Name": {
101                    "description": "The name of the modbus device.",
102                    "type": "string"
103                },
104                "Address": {
105                    "description": "The address of the modbus device.",
106                    "type": "string"
107                },
108                "SerialPort": {
109                    "description": "The name of the serial port from the port configuration where the device is discovered.",
110                    "type": "string"
111                },
112                "DataParity": {
113                    "description": "The parity to use for data transmission.",
114                    "enum": ["Odd", "Even", "None"]
115                },
116                "BaudRate": {
117                    "description": "The baudrate of the communication channel.",
118                    "enum": [9600, 19200, 57600, 115200]
119                },
120                "SensorRegisters": {
121                    "description": "The sensor registers for the modbus device.",
122                    "type": "array",
123                    "items": {
124                        "description": "The Modbus register definition.",
125                        "type": "object",
126                        "additionalProperties": false,
127                        "properties": {
128                            "Name": {
129                                "description": "The name of the register.",
130                                "type": "string"
131                            },
132                            "RegisterType": {
133                                "description": "The type of information which the registers holds.",
134                                "enum": [
135                                    "FanTach",
136                                    "LiquidLevel",
137                                    "LiquidFlow",
138                                    "Power",
139                                    "Pressure",
140                                    "Temperature"
141                                ]
142                            },
143                            "Address": {
144                                "description": "The address of the register.",
145                                "type": "number"
146                            },
147                            "Size": {
148                                "description": "The size of the register in bytes.",
149                                "type": "number"
150                            },
151                            "Precision": {
152                                "description": "The number of bits used to represent the fractional part.",
153                                "type": "integer",
154                                "minimum": 0,
155                                "maximum": 31
156                            },
157                            "Scale": {
158                                "description": "The constant number to multiply register value to change the magnitude.",
159                                "type": "number"
160                            },
161                            "Shift": {
162                                "description": "The constant number to add to register value to change the magnitude.",
163                                "type": "number"
164                            },
165                            "Signed": {
166                                "description": "This indicates whether the register contains a signed or an unsigned number",
167                                "type": "boolean"
168                            },
169                            "Format": {
170                                "description": "The format for interpreting the contents of a register.",
171                                "enum": ["Integer", "Float"]
172                            }
173                        },
174                        "required": [
175                            "Name",
176                            "RegisterType",
177                            "Address",
178                            "Size",
179                            "Precision",
180                            "Scale",
181                            "Shift",
182                            "Signed",
183                            "Format"
184                        ]
185                    }
186                },
187                "StatusBits": {
188                    "description": "The status bits for the modbus device.",
189                    "type": "array",
190                    "items": {
191                        "type": "object",
192                        "additionalProperties": false,
193                        "properties": {
194                            "Name": {
195                                "description": "The name of the status bit.",
196                                "type": "string"
197                            },
198                            "StatusType": {
199                                "description": "The type of status bit",
200                                "enum": [
201                                    "SensorReadingCritical",
202                                    "SensorReadingWarning",
203                                    "SensorFailure",
204                                    "ControllerFailure",
205                                    "PumpFailure",
206                                    "FilterFailure",
207                                    "PowerFault"
208                                ]
209                            },
210                            "Address": {
211                                "description": "The address for the status bit",
212                                "type": "number"
213                            },
214                            "BitPosition": {
215                                "description": "The position of the bit in the register representing this status.",
216                                "type": "number"
217                            },
218                            "Value": {
219                                "description": "A true or false value that indicates whether this status is active.",
220                                "type": "boolean"
221                            }
222                        },
223                        "required": [
224                            "Name",
225                            "StatusType",
226                            "Address",
227                            "BitPosition",
228                            "Value"
229                        ]
230                    }
231                },
232                "FirmwareRegisters": {
233                    "description": "The modbus device firmware related registers.",
234                    "type": "array",
235                    "items": {
236                        "type": "object",
237                        "additionalProperties": false,
238                        "properties": {
239                            "Name": {
240                                "description": "The name of the status bit.",
241                                "type": "string"
242                            },
243                            "RegisterType": {
244                                "description": "The type of register for firmware.",
245                                "enum": ["Version", "Update"]
246                            },
247                            "Address": {
248                                "description": "The address of the register.",
249                                "type": "number"
250                            },
251                            "Size": {
252                                "description": "The size of the register in bytes.",
253                                "type": "number"
254                            }
255                        },
256                        "required": ["Name", "RegisterType", "Address", "Size"]
257                    }
258                }
259            },
260            "required": [
261                "Name",
262                "Type",
263                "Address",
264                "SerialPort",
265                "DataParity",
266                "BaudRate",
267                "SensorRegisters",
268                "StatusBits",
269                "FirmwareRegisters"
270            ]
271        }
272    }
273}
274