Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/class/sms.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static function deamon_start() {
$cmd .= ' --apikey ' . jeedom::getApiKey('sms');
$cmd .= ' --pid ' . jeedom::getTmpFolder('sms') . '/deamon.pid';
log::add('sms', 'info', 'Lancement démon sms : ' . $cmd);
$result = exec($cmd . ' >> ' . log::getPathToLog('sms') . ' 2>&1 &');
$result = exec($cmd . ' >> ' . log::getPathToLog('smsd') . ' 2>&1 &');
$i = 0;
while ($i < 30) {
$deamon_info = self::deamon_info();
Expand Down
4 changes: 4 additions & 0 deletions docs/de_DE/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
>
>Zur Erinnerung: Wenn keine Informationen zum Update vorhanden sind, bedeutet dies, dass es sich nur um die Aktualisierung von Dokumentation, Übersetzung oder Text handelt

## 08.09.2024

- Problem beim Empfang von SMS behoben

## 31.08.2024

- Debian 12-Kompatibilität
Expand Down
4 changes: 4 additions & 0 deletions docs/en_US/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
>
>As a reminder if there is no information on the update, it means that it only concerns the updating of documentation, translation or text

## 08/09/2024

- Fix on receiving SMS

## 08/31/2024

- Debian 12 Compatibility
Expand Down
4 changes: 4 additions & 0 deletions docs/es_ES/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
>
>Como recordatorio si no hay información sobre la actualización, significa que solo se refiere a la actualización de documentación, traducción o texto

## 08/09/2024

- Corrección al recibir SMS

## 31/08/2024

- Compatibilidad con Debian 12
Expand Down
4 changes: 4 additions & 0 deletions docs/fr_FR/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
>
>Pour rappel s'il n'y a pas d'information sur la mise à jour, c'est que celle-ci concerne uniquement de la mise à jour de documentation, de traduction ou de texte

## 08/09/2024

- Fix sur la réception des SMS

## 31/08/2024

- Compatibilité Debian 12
Expand Down
2 changes: 2 additions & 0 deletions docs/i18n/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"changelog.md": {
"Changelog SMS": "Changelog SMS",
"Pour rappel s'il n'y a pas d'information sur la mise à jour, c'est que celle-ci concerne uniquement de la mise à jour de documentation, de traduction ou de texte": "Zur Erinnerung: Wenn keine Informationen zum Update vorhanden sind, bedeutet dies, dass es sich nur um die Aktualisierung von Dokumentation, Übersetzung oder Text handelt",
"08\/09\/2024": "08.09.2024",
"Fix sur la réception des SMS": "Problem beim Empfang von SMS behoben",
"31\/08\/2024": "31.08.2024",
"Compatibilité Debian 12": "Debian 12-Kompatibilität",
"Version minimum jeedom requise": "Mindestversion von Jeedom erforderlich",
Expand Down
2 changes: 2 additions & 0 deletions docs/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"changelog.md": {
"Changelog SMS": "Changelog SMS",
"Pour rappel s'il n'y a pas d'information sur la mise à jour, c'est que celle-ci concerne uniquement de la mise à jour de documentation, de traduction ou de texte": "As a reminder if there is no information on the update, it means that it only concerns the updating of documentation, translation or text",
"08\/09\/2024": "08\/09\/2024",
"Fix sur la réception des SMS": "Fix on receiving SMS",
"31\/08\/2024": "08\/31\/2024",
"Compatibilité Debian 12": "Debian 12 Compatibility",
"Version minimum jeedom requise": "Minimum jeedom version required",
Expand Down
2 changes: 2 additions & 0 deletions docs/i18n/es_ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"changelog.md": {
"Changelog SMS": "Changelog SMS",
"Pour rappel s'il n'y a pas d'information sur la mise à jour, c'est que celle-ci concerne uniquement de la mise à jour de documentation, de traduction ou de texte": "Como recordatorio si no hay información sobre la actualización, significa que solo se refiere a la actualización de documentación, traducción o texto",
"08\/09\/2024": "08\/09\/2024",
"Fix sur la réception des SMS": "Corrección al recibir SMS",
"31\/08\/2024": "31\/08\/2024",
"Compatibilité Debian 12": "Compatibilidad con Debian 12",
"Version minimum jeedom requise": "Se requiere una versión mínima de jeedom",
Expand Down
2 changes: 2 additions & 0 deletions docs/i18n/fr_FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"Changelog SMS": "Changelog SMS",
"IMPORTANT": "IMPORTANT",
"Pour rappel s'il n'y a pas d'information sur la mise à jour, c'est que celle-ci concerne uniquement de la mise à jour de documentation, de traduction ou de texte": "Pour rappel s'il n'y a pas d'information sur la mise à jour, c'est que celle-ci concerne uniquement de la mise à jour de documentation, de traduction ou de texte",
"08\/09\/2024": "08\/09\/2024",
"Fix sur la réception des SMS": "Fix sur la réception des SMS",
"31\/08\/2024": "31\/08\/2024",
"Compatibilité Debian 12": "Compatibilité Debian 12",
"Version minimum jeedom requise": "Version minimum jeedom requise",
Expand Down
2 changes: 2 additions & 0 deletions docs/i18n/pt_PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"changelog.md": {
"Changelog SMS": "Changelog SMS",
"Pour rappel s'il n'y a pas d'information sur la mise à jour, c'est que celle-ci concerne uniquement de la mise à jour de documentation, de traduction ou de texte": "Como lembrete, se não houver informações sobre a atualização, isso significa que se trata apenas da atualização da documentação, tradução ou texto",
"08\/09\/2024": "08\/09\/2024",
"Fix sur la réception des SMS": "Correção no recebimento de SMS",
"31\/08\/2024": "31\/08\/2024",
"Compatibilité Debian 12": "Compatibilidade com Debian 12",
"Version minimum jeedom requise": "Versão mínima do jeedom necessária",
Expand Down
4 changes: 4 additions & 0 deletions docs/pt_PT/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
>
>Como lembrete, se não houver informações sobre a atualização, isso significa que se trata apenas da atualização da documentação, tradução ou texto

## 08/09/2024

- Correção no recebimento de SMS

## 31/08/2024

- Compatibilidade com Debian 12
Expand Down
6 changes: 3 additions & 3 deletions resources/smsd/gsmmodem/modem.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,13 +817,13 @@ def ownNumber(self):
response = self.write('AT+CPBS?')
selected_phonebook = response[0][6:].split('"')[1] # first line, remove the +CSCS: prefix, split, first parameter

if selected_phonebook is not "ON":
if selected_phonebook != "ON":
self.write('AT+CPBS="ON"')

response = self.write("AT+CPBR=1")
self.write('AT+CPBS="{0}"'.format(selected_phonebook))

if response is "OK": # command is supported, but no number is set
if response == "OK": # command is supported, but no number is set
return None
elif len(response) == 2: # OK and phone number. Actual number is in the first line, second parameter, and is placed inside quotation marks
cnumLine = response[0]
Expand All @@ -843,7 +843,7 @@ def ownNumber(self):
@ownNumber.setter
def ownNumber(self, phone_number):
actual_phonebook = self.write('AT+CPBS?')
if actual_phonebook is not "ON":
if actual_phonebook != "ON":
self.write('AT+CPBS="ON"')
self.write('AT+CPBW=1,"' + phone_number + '"')

Expand Down
6 changes: 3 additions & 3 deletions resources/smsd/jeedom/jeedom.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import threading
import requests
import datetime
import collections
from collections.abc import Mapping
import serial
import os
from queue import Queue
Expand Down Expand Up @@ -120,8 +120,8 @@ def get_change(self):
def merge_dict(self, d1, d2):
for k, v2 in d2.items():
v1 = d1.get(k) # returns None if v1 has no value for this key
if (isinstance(v1, collections.Mapping) and
isinstance(v2, collections.Mapping)):
if (isinstance(v1, Mapping) and
isinstance(v2, Mapping)):
self.merge_dict(v1, v2)
else:
d1[k] = v2
Expand Down
46 changes: 23 additions & 23 deletions resources/smsd/smsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@


def handleSms(sms):
logging.debug("Got SMS message : "+str(sms))
logging.debug("Got SMS message : %s", sms)
if not sms.text:
logging.debug("No text so nothing to do")
return
Expand All @@ -57,12 +57,12 @@ def listen():
logging.debug("Text mode false")
gsm.smsTextMode = False
if _pin != 'None':
logging.debug("Enter pin code : "+_pin)
logging.debug("Enter pin code : %s ", _pin)
gsm.connect(_pin, 1)
else:
gsm.connect(None, 1)
if _smsc != 'None':
logging.debug("Configure smsc : "+_smsc)
logging.debug("Configure smsc : %s", _smsc)
gsm.write('AT+CSCA="{0}"'.format(_smsc))
logging.debug("Waiting for network...")
gsm.waitForNetworkCoverage()
Expand All @@ -80,15 +80,15 @@ def listen():
except Exception as e:
if str(e).find('object has no attribute') != -1:
pass
logging.error("Exception on 'ME': %s" % str(e))
logging.error("Exception on 'ME': %s", e)

try:
gsm.write('AT+CPMS="SM","SM","SM"')
gsm.write('AT+CMGD=1,4')
except Exception as e:
if str(e).find('object has no attribute') != -1:
pass
logging.error("Exception on 'SM': %s" % str(e))
logging.error("Exception on 'SM': %s", e)
except Exception as e:
if str(e).find('object has no attribute') != -1:
pass
Expand All @@ -109,14 +109,14 @@ def listen():
signal_strength_store = gsm.signalStrength
jeedom_com.send_change_immediate({'number': 'signal_strength', 'message': str(gsm.signalStrength)})
except Exception as e:
logging.error("Exception on GSM : %s" % str(e))
logging.error("Exception on GSM : %s", e)
if str(e) == 'Attempting to use a port that is not open' or str(e) == 'Timeout' or str(e) == 'Device not searching for network operator':
logging.error("Exit 1 because this exeption is fatal")
shutdown()
try:
read_socket()
except Exception as e:
logging.error("Exception on socket : %s" % str(e))
logging.error("Exception on socket : %s", e)
except KeyboardInterrupt:
shutdown()

Expand All @@ -128,7 +128,7 @@ def read_socket():
logging.debug("Message received in socket JEEDOM_SOCKET_MESSAGE")
message = json.loads(JEEDOM_SOCKET_MESSAGE.get().decode("utf-8"))
if message['apikey'] != _apikey:
logging.error("Invalid apikey from socket : " + str(message))
logging.error("Invalid apikey from socket : ", message)
return
gsm.waitForNetworkCoverage()
logging.info("Envoi d'un message à %s: %s", message['number'], message['message'])
Expand All @@ -138,13 +138,13 @@ def read_socket():


def handler(signum=None, frame=None):
logging.debug("Signal %i caught, exiting..." % int(signum))
logging.debug("Signal %i caught, exiting...", signum)
shutdown()


def shutdown():
logging.debug("Shutdown")
logging.debug("Removing PID file " + str(_pidfile))
logging.debug("Removing PID file %s", _pidfile)
try:
os.remove(_pidfile)
except:
Expand Down Expand Up @@ -217,17 +217,17 @@ def shutdown():
jeedom_utils.set_log_level(_log_level)

logging.info('Start smsd')
logging.info('Log level : '+str(_log_level))
logging.info('Socket port : '+str(_socket_port))
logging.info('Socket host : '+str(_socket_host))
logging.info('PID file : '+str(_pidfile))
logging.info('Device : '+str(_device))
logging.info('Callback : '+str(_callback))
logging.info('Cycle : '+str(_cycle))
logging.info('Serial rate : '+str(_serial_rate))
logging.info('Pin : '+str(_pin))
logging.info('Text mode : '+str(_text_mode))
logging.info('SMSC : '+str(_smsc))
logging.info('Log level : %s', _log_level)
logging.info('Socket port : %s', _socket_port)
logging.info('Socket host : %s', _socket_host)
logging.info('PID file : %s', _pidfile)
logging.info('Device : %s', _device)
logging.info('Callback : %s', _callback)
logging.info('Cycle : %s', _cycle)
logging.info('Serial rate : %s', _serial_rate)
logging.info('Pin : %s', _pin)
logging.info('Text mode : %s', _text_mode)
logging.info('SMSC : %s', _smsc)


if _device == 'auto':
Expand All @@ -238,7 +238,7 @@ def shutdown():
for stick in know_sticks:
_device = jeedom_utils.find_tty_usb(stick['idVendor'], stick['idProduct'], stick['name'])
if _device is not None:
logging.info('Find device : '+str(_device))
logging.info('Find device : %s', _device)
break


Expand All @@ -258,6 +258,6 @@ def shutdown():
jeedom_socket = jeedom_socket(port=_socket_port, address=_socket_host)
listen()
except Exception as e:
logging.error('Fatal error : '+str(e))
logging.error('Fatal error : %s', e)
logging.debug(traceback.format_exc())
shutdown()