-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[smsmodem] Initial contribution #12250
[smsmodem] Initial contribution #12250
Conversation
There are other add-ons that include third party code. But because it's under a different license this needs to be added differently. You need to put the sources in a different map: The way you have added it now seems to me illegal as you have changed the license on the 3rd party source code. Which you only can do if you are the copyright owner of the source code. Regarding threads. It's ok to have an own thread. In fact if you have long running threads you must create them as only short running threads are allowed on the scheduled executor. See also #8216 about naming the thread and do |
Hello @Hilbrand, Thank you very much for these informations.
I also put a name and the daemon property on the always living thread polling the device. |
82f91c8
to
73714e7
Compare
195acac
to
89c5a03
Compare
@dalgwen It's been a long time you submitted your new addon. Are you still around to implement upcoming review feedback? |
Yes, I would be happy to do so. But I'm aware that it doesn't attract many people and is low on the priority list... so no problem if it takes time ! Thanks, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed the readme so far.
There are some checkstyle warnings left. You could take a look at target/code-analysis/report.html
after building it with mvn clean install
.
This binding connects to a USB serial GSM modem (or a network exposed one, a.k.a ser2net) and allows openHAB to send and receive SMS through it. Signed-off-by: Gwendal Roulleau <[email protected]>
Signed-off-by: Gwendal Roulleau <[email protected]>
Signed-off-by: Gwendal Roulleau <[email protected]>
And long running thread naming convention And treated some code warning Signed-off-by: Gwendal Roulleau <[email protected]>
Signed-off-by: Gwendal Roulleau <[email protected]>
update channel rename action to avoid colision with other binding and a too generic name Signed-off-by: Gwendal Roulleau <[email protected]>
Signed-off-by: Gwendal Roulleau <[email protected]>
Signed-off-by: Gwendal Roulleau <[email protected]>
For non latin character in SMS Signed-off-by: Gwendal Roulleau <[email protected]>
Signed-off-by: Gwendal Roulleau <[email protected]>
89c5a03
to
30482c7
Compare
Thank you @fwolter ! |
Looks good! Just give me a note if you want to change the modelling of the bridge or whether I shall continue reviewing. |
Thank you @fwolter |
Signed-off-by: Gwendal Roulleau <[email protected]>
As proposed, I split the bridge thing-type in two different bridge thing-types. |
} | ||
|
||
public static ThingUID getSMSConversationUID(ThingTypeUID thingTypeUID, String recipient, ThingUID bridgeUID) { | ||
return new ThingUID(thingTypeUID, recipient, bridgeUID.getId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you are derivating the ThingUID from the phone number, but the ThingUID should be configureable by the user. Is there any reason not letting the user set the ThingUID?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "getSMSConversationUID" method is called by the autodiscovery method, or from the createThing method if and only if the "thingUID" is null.
With this method, I want to give a default UID, IF NOT set by the user. If the user set the thing UID, it will use the user's one.
Your comment seems to mean that this approach is invalid, or do you mean it's badly implemented ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In SMSConversationDiscoveryService
you are calling getSMSConversationUID()
directly, when creating the discovered Thing (which is the right approach). So, the default-ThingUID-use-case is handled there.
If the user adds the Thing manually, the ThingUID can't be left empty/null (neither via UI nor text based configuration).
What use case do you intend to handle by this code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No particular use case here. I was just trying to implement the createThing method from the parent class and respecting the annotation : in this method, the parameter thingUID is nullable.
If you thing it is best, I can remove the call to the getSMSConversationUID in createThing, but the compiler will log a warning I guess ?
Or I could fail fast with an exception if thingUID is null.
What do you think ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for clarification, createThing()
doesn't need to be implemented by bindings. It's sufficient to implement createHandler()
. You could remove createThing()
entirely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh my ! I wouldn't have wasted your time if I knew that before... Sorry 😨
Deleted !
...msmodem/src/main/java/org/openhab/binding/smsmodem/internal/SMSModemBridgeConfiguration.java
Outdated
Show resolved
Hide resolved
...ng.smsmodem/src/main/java/org/openhab/binding/smsmodem/internal/actions/SMSModemActions.java
Outdated
Show resolved
Hide resolved
...odem/src/main/java/org/openhab/binding/smsmodem/internal/handler/SMSConversationHandler.java
Outdated
Show resolved
Hide resolved
private void setStatusByBridgeStatus() { | ||
SMSModemBridgeHandler bridgeHandlerFinal = bridgeHandler; | ||
if (bridgeHandlerFinal != null) { | ||
switch (bridgeHandlerFinal.getThing().getStatus()) { | ||
case INITIALIZING: | ||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE); | ||
break; | ||
case OFFLINE: | ||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE); | ||
break; | ||
case ONLINE: | ||
updateStatus(ThingStatus.ONLINE, ThingStatusDetail.NONE); | ||
break; | ||
case REMOVED: | ||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE); | ||
break; | ||
case REMOVING: | ||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE); | ||
break; | ||
case UNINITIALIZED: | ||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE); | ||
break; | ||
case UNKNOWN: | ||
updateStatus(ThingStatus.UNKNOWN, ThingStatusDetail.BRIDGE_OFFLINE); | ||
break; | ||
} | ||
} else { | ||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Thing status is set by the framework automatically according the bridge status, if you set the Thing status to UNKNOWN in initialize()
. Then, this could be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a test and if I set the child handler status to "UNKNOWN" and leave if for the Bridge to update (deleting setStatusByBridgeStatus() method), it stays "UNKNOWN", even if the bridge status switch to "online".
Or maybe I didn't understand your proposition ?
By reading code, the bridgeStatusChanged() method of BaseThingHandler effectively change the child handler status to "ONLINE" when the bridge get online, but only if the last status details was BRIDGE_OFFLINE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You still need to set the child Thing ONLINE, if you think it is online. In your case this might be always the case, if the bridge is online. So, you can set it ONLINE in initialize()
directly. Then, it will be online if the bridge is online and offline if the bridge is offline.
You only need to set it to UNKNOWN (and later to ONLINE) if you don't know the state in initialize()
, yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I get it now !
Indeed, I can set it to ONLINE directly.
Done, thanks
By the way, there is one drawback : the bridge start as "unknown" because it has to establish connection. But the smsconversation thing is immediately online at this time (and the status doesn't reflect the reality : it is not fully functionnal because of the bridge).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested your code and a reason why it doesn't work as expected is that you don't set the ThingStatus in the bridge's initialize()
to UNKNOWN. It works for me if I do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tested it again and you're right, as long as the bridge is in UNKNOWN state, the child Things are ONLINE. Only if the bridge is set to OFFLINE, the child Things are set to OFFLINE, too. Normally you wouldn't notice, because the bridge stays in UNKNOWN state only for very short time. In this case the timeout is quite long.
I would expect the SMS modem to respond within subseconds and would chose a shorter timeout, anyway. But maybe there are things I didn't consider.
I merge it for now. If you want to improve the behavior, you could file a follow-up PR.
...modem/src/main/java/org/openhab/binding/smsmodem/internal/handler/SMSModemBridgeHandler.java
Outdated
Show resolved
Hide resolved
...modem/src/main/java/org/openhab/binding/smsmodem/internal/handler/SMSModemBridgeHandler.java
Outdated
Show resolved
Hide resolved
...modem/src/main/java/org/openhab/binding/smsmodem/internal/handler/SMSModemBridgeHandler.java
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.smsmodem/src/main/resources/OH-INF/binding/binding.xml
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.smsmodem/src/main/resources/OH-INF/thing/smsmodem.xml
Outdated
Show resolved
Hide resolved
Signed-off-by: Gwendal Roulleau <[email protected]>
Signed-off-by: Gwendal Roulleau <[email protected]>
} | ||
|
||
public static ThingUID getSMSConversationUID(ThingTypeUID thingTypeUID, String recipient, ThingUID bridgeUID) { | ||
return new ThingUID(thingTypeUID, recipient, bridgeUID.getId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for clarification, createThing()
doesn't need to be implemented by bindings. It's sufficient to implement createHandler()
. You could remove createThing()
entirely.
bundles/org.openhab.binding.smsmodem/src/main/resources/OH-INF/thing/smsmodem.xml
Outdated
Show resolved
Hide resolved
} catch (ModemConfigurationException e) { | ||
String message = e.getMessage(); | ||
logger.error(message, e); | ||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private void setStatusByBridgeStatus() { | ||
SMSModemBridgeHandler bridgeHandlerFinal = bridgeHandler; | ||
if (bridgeHandlerFinal != null) { | ||
switch (bridgeHandlerFinal.getThing().getStatus()) { | ||
case INITIALIZING: | ||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE); | ||
break; | ||
case OFFLINE: | ||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE); | ||
break; | ||
case ONLINE: | ||
updateStatus(ThingStatus.ONLINE, ThingStatusDetail.NONE); | ||
break; | ||
case REMOVED: | ||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE); | ||
break; | ||
case REMOVING: | ||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE); | ||
break; | ||
case UNINITIALIZED: | ||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE); | ||
break; | ||
case UNKNOWN: | ||
updateStatus(ThingStatus.UNKNOWN, ThingStatusDetail.BRIDGE_OFFLINE); | ||
break; | ||
} | ||
} else { | ||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested your code and a reason why it doesn't work as expected is that you don't set the ThingStatus in the bridge's initialize()
to UNKNOWN. It works for me if I do that.
|
||
@Override | ||
public void initialize() { | ||
shouldRun = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is necessary to make the thing status automatism work.
shouldRun = true; | |
updateStatus(ThingStatus.UNKNOWN); | |
shouldRun = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done !
Thank you (again)
Signed-off-by: Gwendal Roulleau <[email protected]>
8b2414c
to
015cd7f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Now, you could add your binding's logo to the openHAB website. See https://www.openhab.org/docs/developer/bindings/#add-your-binding-s-logo-to-the-openhab-website
Great, thank you again for your time ! |
As the French translations were included on the PR, they have to be uploaded manually in Crowdin. |
@dalgwen : you forgot adding an entry in CODEOWNERS file, can you please submit a small PR for that? |
First time in crowdin for me. I think I did what you suggest. With some fixes after viewing warnings from crowdin.
Oops, sorry. Done here. |
I have validated with few changes. |
* [smsmodem] Initial contribution This binding connects to a USB serial GSM modem (or a network exposed one, a.k.a ser2net) and allows openHAB to send and receive SMS through it. Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] README fix Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] build/spotless fix Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] compliance with 3rd party license And long running thread naming convention And treated some code warning Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] i18n Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Small fixes update channel rename action to avoid colision with other binding and a too generic name Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Use of standard Thing properties Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Fix sender identifier error with special character Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Add encoding parameter For non latin character in SMS Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Apply review Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Split local and remote modem in two thing-types Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Apply review Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Apply review Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Apply code review (removing unnecessary method) Signed-off-by: Gwendal Roulleau <[email protected]> Signed-off-by: Gwendal Roulleau <[email protected]> Co-authored-by: Gwendal Roulleau <[email protected]> Signed-off-by: Ben Rosenblum <[email protected]>
* [smsmodem] Initial contribution This binding connects to a USB serial GSM modem (or a network exposed one, a.k.a ser2net) and allows openHAB to send and receive SMS through it. Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] README fix Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] build/spotless fix Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] compliance with 3rd party license And long running thread naming convention And treated some code warning Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] i18n Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Small fixes update channel rename action to avoid colision with other binding and a too generic name Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Use of standard Thing properties Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Fix sender identifier error with special character Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Add encoding parameter For non latin character in SMS Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Apply review Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Split local and remote modem in two thing-types Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Apply review Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Apply review Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Apply code review (removing unnecessary method) Signed-off-by: Gwendal Roulleau <[email protected]> Signed-off-by: Gwendal Roulleau <[email protected]> Co-authored-by: Gwendal Roulleau <[email protected]> Signed-off-by: Andras Uhrin <[email protected]>
* [smsmodem] Initial contribution This binding connects to a USB serial GSM modem (or a network exposed one, a.k.a ser2net) and allows openHAB to send and receive SMS through it. Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] README fix Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] build/spotless fix Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] compliance with 3rd party license And long running thread naming convention And treated some code warning Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] i18n Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Small fixes update channel rename action to avoid colision with other binding and a too generic name Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Use of standard Thing properties Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Fix sender identifier error with special character Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Add encoding parameter For non latin character in SMS Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Apply review Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Split local and remote modem in two thing-types Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Apply review Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Apply review Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Apply code review (removing unnecessary method) Signed-off-by: Gwendal Roulleau <[email protected]> Signed-off-by: Gwendal Roulleau <[email protected]> Co-authored-by: Gwendal Roulleau <[email protected]>
* [smsmodem] Initial contribution This binding connects to a USB serial GSM modem (or a network exposed one, a.k.a ser2net) and allows openHAB to send and receive SMS through it. Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] README fix Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] build/spotless fix Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] compliance with 3rd party license And long running thread naming convention And treated some code warning Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] i18n Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Small fixes update channel rename action to avoid colision with other binding and a too generic name Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Use of standard Thing properties Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Fix sender identifier error with special character Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Add encoding parameter For non latin character in SMS Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Apply review Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Split local and remote modem in two thing-types Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Apply review Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Apply review Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Apply code review (removing unnecessary method) Signed-off-by: Gwendal Roulleau <[email protected]> Signed-off-by: Gwendal Roulleau <[email protected]> Co-authored-by: Gwendal Roulleau <[email protected]>
* [smsmodem] Initial contribution This binding connects to a USB serial GSM modem (or a network exposed one, a.k.a ser2net) and allows openHAB to send and receive SMS through it. Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] README fix Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] build/spotless fix Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] compliance with 3rd party license And long running thread naming convention And treated some code warning Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] i18n Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Small fixes update channel rename action to avoid colision with other binding and a too generic name Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Use of standard Thing properties Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Fix sender identifier error with special character Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Add encoding parameter For non latin character in SMS Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Apply review Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Split local and remote modem in two thing-types Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Apply review Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Apply review Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Apply code review (removing unnecessary method) Signed-off-by: Gwendal Roulleau <[email protected]> Signed-off-by: Gwendal Roulleau <[email protected]> Co-authored-by: Gwendal Roulleau <[email protected]>
* [smsmodem] Initial contribution This binding connects to a USB serial GSM modem (or a network exposed one, a.k.a ser2net) and allows openHAB to send and receive SMS through it. Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] README fix Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] build/spotless fix Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] compliance with 3rd party license And long running thread naming convention And treated some code warning Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] i18n Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Small fixes update channel rename action to avoid colision with other binding and a too generic name Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Use of standard Thing properties Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Fix sender identifier error with special character Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Add encoding parameter For non latin character in SMS Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Apply review Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Split local and remote modem in two thing-types Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Apply review Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Apply review Signed-off-by: Gwendal Roulleau <[email protected]> * [smsmodem] Apply code review (removing unnecessary method) Signed-off-by: Gwendal Roulleau <[email protected]> Signed-off-by: Gwendal Roulleau <[email protected]> Co-authored-by: Gwendal Roulleau <[email protected]> Signed-off-by: Andras Uhrin <[email protected]>
This binding connects to a USB serial GSM modem (or a network exposed one, a.k.a ser2net) and allows openHAB to send and receive SMS through it.
With this binding, there is no need for complex configuration with external tools, such as gammu.
Here is the community discussion, where you can find a binary snapshot.
This binding uses smslibv4, directly included (org.openhab.binding.smsmodem.internal.smslib packages and sub packages) and heavily refactored to pass openHAB code standard. I asked on the forum if it was OK and decided to go on with the inclusion. Hope this is OK. Honestly, I don't understand everything in this library : SMS is a complex standard and I didn't take the time to grab it as the smslibv4 was here for me to hide the complexity.
The code still has a "deviation" from the openHAB standard : in the internal smslib, it uses a manually created Thread to continuously read from the serial port (the PollReader class). As the thread is continuously running, I thought it could be a valid use case (to not take forever a thread from the openHAB pool). If you don't think so, please tell me and I will refactor it.