Skip to content

Commit

Permalink
[smsmodem] Apply review
Browse files Browse the repository at this point in the history
Signed-off-by: Gwendal Roulleau <[email protected]>
  • Loading branch information
dalgwen committed Jul 11, 2022
1 parent 0a9c704 commit 30482c7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 24 deletions.
53 changes: 30 additions & 23 deletions bundles/org.openhab.binding.smsmodem/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

This binding connects to a USB serial GSM modem (or a network exposed one, see ser2net) and allows openHAB to send and receive SMS through it.

Serial modem should all use the same communication protocol (AT message) and therefore this binding _should_ be compatible with every dongle. However, there is a gap between theory and reality and success may vary. The protocol stack is based on the no longer supported smslib project (more precisely a v4 fork), and all modems supported by this library should be OK. The following devices have been reported functional :
Serial modem should all use the same communication protocol (AT message) and therefore this binding _should_ be compatible with every dongle.
However, there is a gap between theory and reality and success may vary.
The protocol stack is based on the no longer supported smslib project (more precisely a v4 fork), and all modems supported by this library should be OK.

The following devices have been reported functional :

- Huawei E180

Expand All @@ -23,35 +27,28 @@ A *smsconversation* thing will be discovered and added to the inbox everytime th
The *smsmodembridge* thing requires at least two parameters to work properly (serialPortOrIP, baudOrNetworkPort).
Depending on the nature of the connection (direct serial modem, or serial over network), this two fields will be used differently :

| field | direct serial modem | serial over network |
|-------|--------------------------|-----------------------------------|
|serialPortOrIP| The serial port to access (eg. /dev/tty/USBx) | IP address of the computer hosting the ser2net service|
|baudOrNetworkPort| Baud rate | The network port of the ser2net service |
| Parameter Name | type | direct serial modem | serial over network |
|----------------|-------|----------------------|----------------------|
|serialPortOrIP| text | The serial port to access (eg. /dev/tty/USBx) | IP address of the computer hosting the ser2net service|
|baudOrNetworkPort| integer | Baud rate | The network port of the ser2net service |

The other parameters are optional :

| field | description |
|-------|--------------------------------------|
|simPin |If your sim card is protected, fill this field with the PIN code|
|pollingInterval| Delay between two checks for new message|
|delayBetweenSend|Delay to wait between two messages post (could be necessary for slow modem)|

```
Bridge smsmodem:smsmodembridge:adonglename [ serialPortOrIP="/dev/ttyUSB0", baudOrNetworkPort="19200", enableAutoDiscovery="true" ]
```
| Parameter Name | type | description |
|-----------------|------|---------------------|
|simPin | text | If your sim card is protected, fill this field with the PIN code|
|pollingInterval| integer | Delay between two checks for new message (in seconds)|
|delayBetweenSend| integer | Delay to wait between two messages post (in milliseconds, could be necessary for slow modem)|

The *smsconversation* thing is just a shortcut to address/receive messages with a specific msisdn. It is not mandatory to use the binding, as you can use action and trigger channel to send/receive a message once the smsmodem bridge is configured.

| field | description |
|-------|--------------------------|
| recipient | The msisdn of the phone you want to discuss with.|
| deliveryReport | If enabled, ask the network for a delivery report (default false)|
| encoding | The encoding to use when sending the message (either Enc7, Enc8, EncUcs2, EncCustom, default is Enc7). EncUcs2 is good for non latin character, but SMS character size limit is then reduced|
| Parameter Name | type | description |
|------------|----------|----------|
| recipient | text | The msisdn of the phone you want to discuss with.|
| deliveryReport | boolean | If enabled, ask the network for a delivery report (default false)|
| encoding | text | The encoding to use when sending the message (either Enc7, Enc8, EncUcs2, EncCustom, default is Enc7). EncUcs2 is good for non latin character, but SMS character size limit is then reduced|


```
Thing smsmodem:smsconversation:aconversationname [ recipient="XXXXXXXXXXX", deliveryReport="true" ]
```

## Channels

Expand Down Expand Up @@ -100,9 +97,19 @@ smsAction.sendSMS("1234567890", "Hello world!", "EncUcs2")

## Full Example

### Thing configuration

things/smsmodem.things:

```
Bridge smsmodem:smsmodembridge:adonglename "USB 3G Dongle " [ serialPortOrIP="/dev/ttyUSB0", baudOrNetworkPort="19200", enableAutoDiscovery="true" ] {
Thing smsconversation aconversationname [ recipient="XXXXXXXXXXX", deliveryReport="true" ]
}
```

### Send SMS

`sms.rules` for DSL :
`sms.rules` for DSL:

```java
rule "Alarm by SMS"
Expand Down
2 changes: 1 addition & 1 deletion bundles/org.openhab.binding.smsmodem/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>3.4.0-SNAPSHOT</version>
</parent>

<artifactId>org.openhab.binding.smsmodem</artifactId>
Expand Down

0 comments on commit 30482c7

Please sign in to comment.