Files
OpenMQTT-Gateway/docs/use/rs232.md
T
2020-10-19 13:48:58 -05:00

24 lines
1.1 KiB
Markdown

# RS232 gateway
## Sending an RS232 message
Simply publish the message you wish to transmit, minus the prefix and postfix. For example, to send the "Turn On" signal for a Mitsubishi XD221U projector, the code is simply '!' so you would use the command
`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoRS232 -m '{"value": "!"}'`
It will automatically add the prefix and postfix you set in [config_RS232.h](https://github.com/1technophile/OpenMQTTGateway/blob/master/main/config_RS232.h).
## Receiving an RS232 message
To receive a message, subscribe to all with `mosquitto_sub -t +/# -v`
and perform an action that should get a response from the device. For example, If I were to send the "Turn On" signal from earlier, I would receive back
```json
home/OpenMQTTGateway/RS232toMQTT {"value":"1"}
```
Because this projector echoes back a received command to acknowledge. Some devices will send a NACK, or Negative Acknowledge, to confirm that they received your message but could not comply. That would look like
```json
home/OpenMQTTGateway/RStoMQTT {"value":"!:N"}
```