Updated external content (Jenkins build 1235)
parent
fa1099df0c
commit
55301c8510
File diff suppressed because one or more lines are too long
|
@ -65,6 +65,8 @@ You could customize the discovery process through the binding options.
|
|||
| refreshTime | int | Seconds between device status refreshes (default: 30) |
|
||||
| timeout | int | Command timeout in seconds (default: 5) |
|
||||
| recordDuration | int | Record input duration in seconds |
|
||||
| deviceMaxVolume | int | Assumed max volume for devices with android versions that do not expose this value. |
|
||||
| volumeSettingKey | String | Settings key for android versions where volume is gather using settings command (>=android 11). |
|
||||
| mediaStateJSONConfig | String | Expects a JSON array. Allow to configure the media state detection method per app. Described in the following section |
|
||||
|
||||
## Media State Detection
|
||||
|
|
|
@ -0,0 +1,160 @@
|
|||
---
|
||||
id: smsmodem
|
||||
label: SMSModem
|
||||
title: SMSModem - Bindings
|
||||
type: binding
|
||||
description: "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."
|
||||
since: 3x
|
||||
install: manual
|
||||
---
|
||||
|
||||
<!-- Attention authors: Do not edit directly. Please add your changes to the appropriate source repository -->
|
||||
|
||||
{% include base.html %}
|
||||
|
||||
# SMSModem Binding
|
||||
|
||||
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 :
|
||||
|
||||
- Huawei E180
|
||||
|
||||
## Supported Things
|
||||
|
||||
Two things are supported by this binding :
|
||||
|
||||
- A *smsmodembridge*, representing the dongle connected on the local computer
|
||||
- A *smsmodemremotebridge*, representing the dongle exposed over the network (with ser2net or other similar software)
|
||||
- A *smsconversation*, representing a conversation between one distant msisdn and the msisdn on the sim card in the dongle.
|
||||
|
||||
## Discovery
|
||||
|
||||
There is no discovery process for *smsmodembridge* or *smsmodemremotebridge* thing.
|
||||
A *smsconversation* thing will be discovered and added to the inbox everytime the modem should receive a SMS by a new sender.
|
||||
|
||||
## Thing Configuration
|
||||
|
||||
The *smsmodembridge* or *smsmodemremotebridge* things requires at least two parameters to work properly.
|
||||
|
||||
For local *smsmodembridge*:
|
||||
|
||||
| Parameter Name | type | direct serial modem |
|
||||
|----------------|-------|----------------------|
|
||||
|serialPort| text | The serial port to access (eg. /dev/tty/USBx) |
|
||||
|baud| integer | Baud rate |
|
||||
|
||||
For remote *smsmodemremotebridge*:
|
||||
|
||||
| Parameter Name | type | serial over network |
|
||||
|----------------|-------|----------------------|
|
||||
|ip| text | IP address of the computer hosting the ser2net service|
|
||||
|networkPort| integer | The network port of the ser2net service |
|
||||
|
||||
|
||||
The other parameters are optional :
|
||||
|
||||
| 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.
|
||||
|
||||
| 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|
|
||||
|
||||
|
||||
|
||||
## Channels
|
||||
|
||||
The *smsconversation* supports the following channels :
|
||||
| channel | type | description |
|
||||
|----------|--------|------------------------------|
|
||||
| receive | String| The last message received |
|
||||
| send | String| A message to send |
|
||||
|deliverystatus| String| Delivery status (either UNKNOWN, QUEUED, SENT, PENDING, DELIVERED, EXPIRED, or FAILED). Several status are only possible if the delivery report parameter is enabled|
|
||||
|
||||
## Trigger channels
|
||||
|
||||
The *smsmodembridge* and *smsmodemremotebridge* has the following trigger channel :
|
||||
| Channel ID | event |
|
||||
|---------------------|----------------------------|
|
||||
|receivetrigger| The msisdn and message received (concatened with the '\|' character as a separator)|
|
||||
|
||||
|
||||
## Rule action
|
||||
|
||||
This binding includes a rule action to send SMS.
|
||||
|
||||
```
|
||||
(Rule DSL)
|
||||
val smsAction = getActions("smsmodem","smsmodem:smsmodembridge:<uid>")
|
||||
```
|
||||
|
||||
```
|
||||
(javascript JSR)
|
||||
var smsAction = actions.get("smsmodem","smsmodem:smsmodembridge:<uid>");
|
||||
```
|
||||
|
||||
Where uid is the Bridge UID of the *smsmodembridge* thing.
|
||||
|
||||
Once this action instance is retrieved, you can invoke the 'send' method on it:
|
||||
|
||||
```
|
||||
smsAction.sendSMS("1234567890", "Hello world!")
|
||||
```
|
||||
|
||||
Or with a special encoding:
|
||||
|
||||
```
|
||||
smsAction.sendSMS("1234567890", "Hello world!", "EncUcs2")
|
||||
```
|
||||
|
||||
## Full Example
|
||||
|
||||
### Thing configuration
|
||||
|
||||
things/smsmodem.things:
|
||||
|
||||
```
|
||||
Bridge smsmodem:smsmodembridge:adonglename "USB 3G Dongle " [ serialPort="/dev/ttyUSB0", baud="19200" ] {
|
||||
Thing smsconversation aconversationname [ recipient="XXXXXXXXXXX", deliveryReport="true" ]
|
||||
}
|
||||
```
|
||||
|
||||
### Send SMS
|
||||
|
||||
`sms.rules` for DSL:
|
||||
|
||||
```java
|
||||
rule "Alarm by SMS"
|
||||
when
|
||||
Item Alarm changed
|
||||
then
|
||||
val smsAction = getActions("smsmodem","smsmodem:smsmodembridge:dongleuid")
|
||||
smsAction.sendSMS("33123456789", "Alert !")
|
||||
end
|
||||
```
|
||||
|
||||
### Receive and forward SMS
|
||||
|
||||
`sms.py` with the python helper library :
|
||||
|
||||
```python
|
||||
@rule("smscommand.receive", description="Receive SMS and resend it")
|
||||
@when("Channel smsmodem:smsmodembridge:dongleuid:receivetrigger triggered")
|
||||
def smscommand(event):
|
||||
sender_and_message = event.event.split("|")
|
||||
sender = sender_and_message[0]
|
||||
content = sender_and_message[1]
|
||||
actions.get("smsmodem", "smsmodem:smsmodembridge:dongleuid").send("336123456789", sender + " just send the following message: " + content)
|
||||
```
|
|
@ -176,7 +176,7 @@ The `wirelessClient` information that is retrieved is available as these channel
|
|||
| ap | String | Access point (AP) the client is connected to | Read |
|
||||
| essid | String | Network name (ESSID) the client is connected to | Read |
|
||||
| rssi | Number | Received signal strength indicator (RSSI) of the client | Read |
|
||||
| uptime | Number | Uptime of the client (in seconds) | Read |
|
||||
| uptime | Number:Time | Uptime of the client (in seconds) | Read |
|
||||
| lastSeen | DateTime | Date and Time the client was last seen | Read |
|
||||
| experience | Number:Dimensionless | Overall health indication of the client (in percentage) | Read |
|
||||
| blocked | Switch | Blocked status of the client | Read, Write |
|
||||
|
@ -196,7 +196,7 @@ The `wiredClient` information that is retrieved is available as these channels:
|
|||
| site | String | Site name (from the controller web UI) the client is associated with | Read |
|
||||
| macAddress | String | MAC address of the client | Read |
|
||||
| ipAddress | String | IP address of the client | Read |
|
||||
| uptime | Number | Uptime of the client (in seconds) | Read |
|
||||
| uptime | Number:Time | Uptime of the client (in seconds) | Read |
|
||||
| lastSeen | DateTime | Date and Time the client was last seen | Read |
|
||||
| experience | Number:Dimensionless | Overall health indication of the client (in percentage) | Read |
|
||||
| blocked | Switch | Blocked status of the client | Read, Write |
|
||||
|
@ -244,17 +244,17 @@ Replace `$user`, `$password` and `$cid` accordingly.
|
|||
items/unifi.items
|
||||
|
||||
```
|
||||
Switch MatthewsPhone "Matthew's iPhone [MAP(unifi.map):%s]" { channel="unifi:wirelessClient:home:matthewsPhone:online" }
|
||||
String MatthewsPhoneSite "Matthew's iPhone: Site [%s]" { channel="unifi:wirelessClient:home:matthewsPhone:site" }
|
||||
String MatthewsPhoneMAC "Matthew's iPhone: MAC [%s]" { channel="unifi:wirelessClient:home:matthewsPhone:macAddress" }
|
||||
String MatthewsPhoneIP "Matthew's iPhone: IP [%s]" { channel="unifi:wirelessClient:home:matthewsPhone:ipAddress" }
|
||||
String MatthewsPhoneAP "Matthew's iPhone: AP [%s]" { channel="unifi:wirelessClient:home:matthewsPhone:ap" }
|
||||
String MatthewsPhoneESSID "Matthew's iPhone: ESSID [%s]" { channel="unifi:wirelessClient:home:matthewsPhone:essid" }
|
||||
Number MatthewsPhoneRSSI "Matthew's iPhone: RSSI [%d]" { channel="unifi:wirelessClient:home:matthewsPhone:rssi" }
|
||||
Number MatthewsPhoneUptime "Matthew's iPhone: Uptime [%d]" { channel="unifi:wirelessClient:home:matthewsPhone:uptime" }
|
||||
DateTime MatthewsPhoneLastSeen "Matthew's iPhone: Last Seen [%1$tH:%1$tM:%1$tS]" { channel="unifi:wirelessClient:home:matthewsPhone:lastSeen" }
|
||||
Switch MatthewsPhoneBlocked "Matthew's iPhone: Blocked" { channel="unifi:wirelessClient:home:matthewsPhone:blocked" }
|
||||
Switch MatthewsPhoneReconnect "Matthew's iPhone: Reconnect" { channel="unifi:wirelessClient:home:matthewsPhone:reconnect" }
|
||||
Switch MatthewsPhone "Matthew's iPhone [MAP(unifi.map):%s]" { channel="unifi:wirelessClient:home:matthewsPhone:online" }
|
||||
String MatthewsPhoneSite "Matthew's iPhone: Site [%s]" { channel="unifi:wirelessClient:home:matthewsPhone:site" }
|
||||
String MatthewsPhoneMAC "Matthew's iPhone: MAC [%s]" { channel="unifi:wirelessClient:home:matthewsPhone:macAddress" }
|
||||
String MatthewsPhoneIP "Matthew's iPhone: IP [%s]" { channel="unifi:wirelessClient:home:matthewsPhone:ipAddress" }
|
||||
String MatthewsPhoneAP "Matthew's iPhone: AP [%s]" { channel="unifi:wirelessClient:home:matthewsPhone:ap" }
|
||||
String MatthewsPhoneESSID "Matthew's iPhone: ESSID [%s]" { channel="unifi:wirelessClient:home:matthewsPhone:essid" }
|
||||
Number MatthewsPhoneRSSI "Matthew's iPhone: RSSI [%d]" { channel="unifi:wirelessClient:home:matthewsPhone:rssi" }
|
||||
Number:Time MatthewsPhoneUptime "Matthew's iPhone: Uptime [%1$tR]" { channel="unifi:wirelessClient:home:matthewsPhone:uptime" }
|
||||
DateTime MatthewsPhoneLastSeen "Matthew's iPhone: Last Seen [%1$tH:%1$tM:%1$tS]" { channel="unifi:wirelessClient:home:matthewsPhone:lastSeen" }
|
||||
Switch MatthewsPhoneBlocked "Matthew's iPhone: Blocked" { channel="unifi:wirelessClient:home:matthewsPhone:blocked" }
|
||||
Switch MatthewsPhoneReconnect "Matthew's iPhone: Reconnect" { channel="unifi:wirelessClient:home:matthewsPhone:reconnect" }
|
||||
```
|
||||
|
||||
transform/unifi.map
|
||||
|
|
|
@ -58,6 +58,29 @@
|
|||
<description>JSON config that allows to modify the media state detection strategy for each app. Refer to the binding
|
||||
documentation.</description>
|
||||
</parameter>
|
||||
<parameter name="volumeSettingKey" type="text">
|
||||
<label>Volume Setting Key</label>
|
||||
<description>Settings key for android versions where the volume level is gathered using the 'settings' cli
|
||||
(>=android 11).</description>
|
||||
<default>volume_music_hdmi</default>
|
||||
<options>
|
||||
<option value="volume_bluetooth_sco">volume bluetooth sco</option>
|
||||
<option value="volume_music">volume music</option>
|
||||
<option value="volume_music_bt_a2dp">volume music bt a2dp</option>
|
||||
<option value="volume_music_hdmi">volume music hdmi</option>
|
||||
<option value="volume_music_headphone">volume music headphone</option>
|
||||
<option value="volume_music_headset">volume music headset</option>
|
||||
<option value="volume_music_usb_headset">volume music usb headset</option>
|
||||
<option value="volume_system">volume system</option>
|
||||
</options>
|
||||
<advanced>true</advanced>
|
||||
</parameter>
|
||||
<parameter name="deviceMaxVolume" type="integer" min="1" max="100">
|
||||
<label>Device Max Volume</label>
|
||||
<description>Assumed max volume for devices with android versions that do not expose this value (>=android 11).</description>
|
||||
<default>25</default>
|
||||
<advanced>true</advanced>
|
||||
</parameter>
|
||||
</config-description>
|
||||
</thing-type>
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@
|
|||
</thing-type>
|
||||
|
||||
<channel-type id="weektime">
|
||||
<item-type>DateTime</item-type>
|
||||
<item-type>String</item-type>
|
||||
<label>Time</label>
|
||||
<description>Time and day of week.</description>
|
||||
<category>Time</category>
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="smsmodem"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="smsconversation">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="smsmodembridge"/>
|
||||
<bridge-type-ref id="smsmodemremotebridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>SMS Conversation</label>
|
||||
<description>Represents a conversation with a SMS recipient.</description>
|
||||
|
||||
<channels>
|
||||
<channel id="send" typeId="send"/>
|
||||
<channel id="receive" typeId="receive"/>
|
||||
<channel id="deliverystatus" typeId="deliverystatus"/>
|
||||
</channels>
|
||||
|
||||
<representation-property>recipient</representation-property>
|
||||
|
||||
<config-description>
|
||||
<parameter name="recipient" type="text" required="true">
|
||||
<label>Recipient Number</label>
|
||||
<description>The SMS number of the recipient.</description>
|
||||
</parameter>
|
||||
<parameter name="deliveryReport" type="boolean" required="false">
|
||||
<label>Delivery Report</label>
|
||||
<description>Ask network for delivery report.</description>
|
||||
<default>false</default>
|
||||
</parameter>
|
||||
<parameter name="encoding" type="text" required="false">
|
||||
<label>Encoding</label>
|
||||
<options>
|
||||
<option value="Enc7">Enc7</option>
|
||||
<option value="Enc8">Enc8</option>
|
||||
<option value="EncUcs2">EncUcs2</option>
|
||||
<option value="EncCustom">EncCustom</option>
|
||||
</options>
|
||||
<description>Encoding for the message to send. Default Enc7</description>
|
||||
<default>Enc7</default>
|
||||
</parameter>
|
||||
</config-description>
|
||||
</thing-type>
|
||||
|
||||
<channel-type id="send">
|
||||
<item-type>String</item-type>
|
||||
<label>Send Message</label>
|
||||
<description>Message to send to the recipient.</description>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="receive">
|
||||
<item-type>String</item-type>
|
||||
<label>Message Received</label>
|
||||
<description>Last message received</description>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="deliverystatus">
|
||||
<item-type>String</item-type>
|
||||
<label>Delivery Status</label>
|
||||
<description>Last message delivery status (either UNKNOWN, QUEUED, SENT, PENDING, DELIVERED, EXPIRED, or FAILED)</description>
|
||||
</channel-type>
|
||||
</thing:thing-descriptions>
|
|
@ -0,0 +1,90 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="smsmodem"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<bridge-type id="smsmodembridge">
|
||||
<label>SMSModem Bridge</label>
|
||||
<description>This bridge represents a modem.</description>
|
||||
|
||||
<channels>
|
||||
<channel id="receivetrigger" typeId="smsmodemreceivetrigger"/>
|
||||
</channels>
|
||||
|
||||
<config-description>
|
||||
<parameter name="serialPort" type="text" required="true">
|
||||
<label>Serial Port</label>
|
||||
<description>Serial port of the modem (usually /dev/ttyUSB0).</description>
|
||||
<context>serial-port</context>
|
||||
<default></default>
|
||||
</parameter>
|
||||
<parameter name="baud" type="integer" required="true">
|
||||
<label>Baud</label>
|
||||
<description>Baud rate.</description>
|
||||
<default>19200</default>
|
||||
</parameter>
|
||||
<parameter name="simPin" type="text" required="false">
|
||||
<label>Pin Code</label>
|
||||
<description>The pin (if set) for the sim card.</description>
|
||||
<default></default>
|
||||
</parameter>
|
||||
<parameter name="pollingInterval" type="integer">
|
||||
<advanced>true</advanced>
|
||||
<default>15</default>
|
||||
<description>Delay between polling for new messages (in seconds).</description>
|
||||
</parameter>
|
||||
<parameter name="delayBetweenSend" type="integer">
|
||||
<advanced>true</advanced>
|
||||
<default>100</default>
|
||||
<description>Delay between two messages (in milliseconds). Useful for slow modem.</description>
|
||||
</parameter>
|
||||
</config-description>
|
||||
</bridge-type>
|
||||
|
||||
<bridge-type id="smsmodemremotebridge">
|
||||
<label>SMSModem Remote Bridge</label>
|
||||
<description>This bridge represents a modem on a network controlled computer.</description>
|
||||
|
||||
<channels>
|
||||
<channel id="receivetrigger" typeId="smsmodemreceivetrigger"/>
|
||||
</channels>
|
||||
|
||||
<config-description>
|
||||
<parameter name="ip" type="text" required="true">
|
||||
<label>IP Address</label>
|
||||
<description>IP address of the remote computer.</description>
|
||||
<default></default>
|
||||
<context>network-address</context>
|
||||
</parameter>
|
||||
<parameter name="networkPort" type="integer" required="true">
|
||||
<label>Network Port</label>
|
||||
<description>Network port to join the remote service (a.k.a. ser2net).</description>
|
||||
<default>2000</default>
|
||||
</parameter>
|
||||
<parameter name="simPin" type="text" required="false">
|
||||
<label>Pin Code</label>
|
||||
<description>The pin (if set) for the sim card.</description>
|
||||
<default></default>
|
||||
</parameter>
|
||||
<parameter name="pollingInterval" type="integer">
|
||||
<advanced>true</advanced>
|
||||
<default>15</default>
|
||||
<description>Delay between polling for new messages (in seconds).</description>
|
||||
</parameter>
|
||||
<parameter name="delayBetweenSend" type="integer">
|
||||
<advanced>true</advanced>
|
||||
<default>100</default>
|
||||
<description>Delay between two messages (in milliseconds). Useful for slow modem.</description>
|
||||
</parameter>
|
||||
</config-description>
|
||||
</bridge-type>
|
||||
|
||||
<channel-type id="smsmodemreceivetrigger">
|
||||
<kind>trigger</kind>
|
||||
<label>Message Received</label>
|
||||
<description>Triggered when a message is received, in the form "<msisdn_sender>|<text>"</description>
|
||||
<event/>
|
||||
</channel-type>
|
||||
|
||||
</thing:thing-descriptions>
|
|
@ -249,16 +249,18 @@
|
|||
</channel-type>
|
||||
|
||||
<channel-type id="uptime">
|
||||
<item-type>Number</item-type>
|
||||
<item-type>Number:Time</item-type>
|
||||
<label>Uptime</label>
|
||||
<description>Uptime of the client (in seconds)</description>
|
||||
<state readOnly="true"></state>
|
||||
<category>Time</category>
|
||||
<state pattern="%.0f %unit%" readOnly="true"></state>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="lastSeen">
|
||||
<item-type>DateTime</item-type>
|
||||
<label>Last Seen</label>
|
||||
<description>Timestamp of when the client was last seen</description>
|
||||
<category>Time</category>
|
||||
<state readOnly="true"></state>
|
||||
</channel-type>
|
||||
|
||||
|
|
Loading…
Reference in New Issue