diff --git a/doc/openapi/components/schemas/config/node_obj.yaml b/doc/openapi/components/schemas/config/node_obj.yaml index 43729e15b..dfe8cd92e 100644 --- a/doc/openapi/components/schemas/config/node_obj.yaml +++ b/doc/openapi/components/schemas/config/node_obj.yaml @@ -34,6 +34,7 @@ discriminator: influxdb: nodes/_influxdb.yaml kafka: nodes/_kafka.yaml loopback: nodes/_loopback.yaml + modbus: nodes/_modbus.yaml mqtt: nodes/_mqtt.yaml nanomsg: nodes/_nanomsg.yaml ngsi: nodes/_ngsi.yaml diff --git a/doc/openapi/components/schemas/config/nodes/_modbus.yaml b/doc/openapi/components/schemas/config/nodes/_modbus.yaml new file mode 100644 index 000000000..2ecbc813d --- /dev/null +++ b/doc/openapi/components/schemas/config/nodes/_modbus.yaml @@ -0,0 +1,3 @@ +allOf: +- $ref: ../node_obj.yaml +- $ref: modbus.yaml diff --git a/doc/openapi/components/schemas/config/nodes/modbus.yaml b/doc/openapi/components/schemas/config/nodes/modbus.yaml new file mode 100644 index 000000000..4c1a8efc9 --- /dev/null +++ b/doc/openapi/components/schemas/config/nodes/modbus.yaml @@ -0,0 +1,108 @@ +# yaml-language-server: $schema=http://json-schema.org/draft-07/schema +--- + +allOf: +- type: object + anyOf: + - required: [transport, remote] + properties: + + transport: + type: string + enum: + - tcp + + remote: + type: string + description: The hostname or IP of the modbus TCP device. + example: example.com + + port: + type: integer + description: The port number of the modbus TCP device. + default: 1883 + + unit: + type: integer + description: The addressed unit used for serial communication. This is optional for TCP. + minimum: 0 + maximum: 65535 + example: 1 + + - required: [transport, device, baudrate, parity, data_bits, stop_bits, unit] + properties: + + transport: + type: string + enum: + - rtu + + device: + type: string + description: Path to the serial device file. + example: /dev/ttyS0 + + baudrate: + type: integer + description: The baudrate used for serial communication. + example: 9600 + + parity: + type: string + enum: + - none + - even + - odd + description: The parity used for serial communication. + example: none + + data_bits: + type: integer + description: The data bits used for serial communication. + minimum: 5 + maximum: 8 + example: 5 + + stop_bits: + type: integer + description: The stop bits used for serial communication. + minimum: 1 + maximum: 2 + example: 5 + + unit: + type: integer + description: The addressed unit used for serial communication. This is optional for TCP. + minimum: 0 + maximum: 65535 + example: 1 + + properties: + + response_timeout: + type: number + description: The timeout in seconds when waiting for responses from a modbus server. + example: 1.0 + + rate: + type: number + description: The rate at which modbus device registers are queried for changes. + example: 1.0 + + in: + type: object + properties: + signals: + type: array + items: + $ref: ./signals/modbus_signal.yaml + + out: + type: object + properties: + signals: + type: array + items: + $ref: ./signals/modbus_signal.yaml + +- $ref: ../node.yaml diff --git a/doc/openapi/components/schemas/config/nodes/signals/modbus_signal.yaml b/doc/openapi/components/schemas/config/nodes/signals/modbus_signal.yaml new file mode 100644 index 000000000..ae1861603 --- /dev/null +++ b/doc/openapi/components/schemas/config/nodes/signals/modbus_signal.yaml @@ -0,0 +1,45 @@ +# yaml-language-server: $schema=http://json-schema.org/draft-07/schema +--- + +allOf: +- type: object + required: [type, address] + properties: + + address: + type: integer + description: The modbus register address. + + word_endianess: + type: string + enum: + - big + - little + description: The ordering of two modbus registers joined together to form a larger number. + default: "big" + + byte_endianess: + type: string + enum: + - big + - little + description: The ordering of the bytes within a modbus register. + default: "big" + + scale: + type: number + description: The scale of the register's value. + default: 1.0 + + offset: + type: number + description: The offset of the register's value. + default: 0.0 + + bit: + type: integer + description: The bit index within a register. + minimum: 0 + maximum: 15 + +- $ref: ../../signal.yaml