BartVdP
(Bart Van De Peer)
December 11, 2020, 11:42pm
1
Hi,
Have OH3 M5 running on a Ubuntu server. And have a SMS modem on /dev/ttyUSB2 port.
Installed the serial Binding and sending and receiving from the modem works well. But i do not know how to send the ctrl+Z command wich is needed to close the AT+CMG command (send sms).
Have tried:
Item.sendCommand(“AT+CMGS="phone number"\rMessage\u001A”)
Item.sendCommand(“AT+CMGS="phone number"\rMessage\x1A”)
But the binding could not parse the \u nore the \x…
Could someone help me with this issue.
@gitMiguel
Many Thanks
MikeJMajor
(Mike Major)
December 12, 2020, 8:36am
2
What do you mean the binding could not parse the \x, do you mean the binding is sending the string \x1A rather than the byte value 26?
How are you trying to send those item commands, is it a rule configured through the UI? If so are you able to look at the rule in the JSONDB and see how many \ characters are before the x
This could be this issue:
opened 12:40PM - 31 Oct 20 UTC
closed 06:20PM - 27 Apr 22 UTC
Not sure if this is core, UI or user error issue.
While developing a serial b… inding I spotted that I wasn't sending new line characters over the serial interface.
With the following thing defined in configuration it works as I expect, if I send an UP command to the 'serialRollo' channel it sends 'Rollo_UP' followed by a LF to the serial port
```
Thing serialDevice rollershutter [patternMatch=".*"] {
Channels:
Type rollershutter : serialRollo [transform="REGEX(Position:([0-9.]*))", up="Rollo_UP\n", down="Rollo_DOWN\n", stop="Rollo_STOP\n"]
Type switch : roloAt100 [transform="REGEX(s/Position:100/ON/)"]
}
```
If I configure the thing in the UI and set the channel config parameter 'up' to 'Rollo_UP\n' it sends 'Rollo_UP\n' with no LF.
I'm guessing that its being JSON escaped when sent from the UI and again JSON escaped when stored in the JSON db.
BartVdP
(Bart Van De Peer)
December 12, 2020, 9:44am
3
Hi Mike,
The serial thing is configured as:
Bridge serial:serialBridge:modem [serialPort=“/dev/ttyUSB2”, baudRate=9600] {
Thing serialDevice myModem [patternMatch=“.*”] {
Channels:
Type string : control [commandFormat=“COMMAND=%s;”]
}
}
The item is configured as:
String sSendSerialMsg “Send Serial communication [%s]” {channel=“serial:serialDevice:modem:myModem:control”}
I make use of a Rule (GSM.rules) to send the AT commands to the modem.
the openhab.log gives the error
Configuration model ‘GSM.rules’ has errors, therefore ignoring it: [168,45]: Invalid escape sequence (valid ones are \b \t \n \f \r " ' \ )
The question is how to parse the CTRL+Z command and put it in the string sSendSerialMsg to send it to the serial port?