summaryrefslogtreecommitdiff
path: root/include/py/homekit/modem
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2024-02-20 00:56:00 +0300
committerEvgeny Zinoviev <me@ch1p.io>2024-02-20 00:56:00 +0300
commit95ac1f0d6786d6f4331cfc8387ef816c1db24618 (patch)
tree67e9c963ae7686eb46c75699b31ccd5385bacf77 /include/py/homekit/modem
parent952e41d59412f5aad5898d0bccb3af800d104f24 (diff)
comletely delete old lws, rewrite vk_sms_checker on python
Diffstat (limited to 'include/py/homekit/modem')
-rw-r--r--include/py/homekit/modem/e3372.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/include/py/homekit/modem/e3372.py b/include/py/homekit/modem/e3372.py
index f68db5a..8164b88 100644
--- a/include/py/homekit/modem/e3372.py
+++ b/include/py/homekit/modem/e3372.py
@@ -1,6 +1,7 @@
import requests
import xml.etree.ElementTree as ElementTree
+from datetime import datetime
from ..util import Addr
from enum import Enum
from ..http import HTTPMethod
@@ -21,14 +22,14 @@ class Error(Enum):
ERROR_WRONG_TOKEN = 125001
ERROR_WRONG_SESSION = 125002
ERROR_WRONG_SESSION_TOKEN = 125003
-
-
+
+
class WifiStatus(Enum):
WIFI_CONNECTING = '900'
WIFI_CONNECTED = '901'
WIFI_DISCONNECTED = '902'
WIFI_DISCONNECTING = '903'
-
+
class Cradle(Enum):
CRADLE_CONNECTING = '900'
@@ -38,8 +39,8 @@ class Cradle(Enum):
CRADLE_CONNECTFAILED = '904'
CRADLE_CONNECTSTATUSNULL = '905'
CRANDLE_CONNECTSTATUSERRO = '906'
-
-
+
+
class MacroEVDOLevel(Enum):
MACRO_EVDO_LEVEL_ZERO = '0'
MACRO_EVDO_LEVEL_ONE = '1'
@@ -47,8 +48,8 @@ class MacroEVDOLevel(Enum):
MACRO_EVDO_LEVEL_THREE = '3'
MACRO_EVDO_LEVEL_FOUR = '4'
MACRO_EVDO_LEVEL_FIVE = '5'
-
-
+
+
class MacroNetWorkType(Enum):
MACRO_NET_WORK_TYPE_NOSERVICE = 0
MACRO_NET_WORK_TYPE_GSM = 1
@@ -127,7 +128,7 @@ class E3372:
_get_raw_data: bool
_headers: dict[str, str]
_authorized: bool
-
+
def __init__(self,
addr: Addr,
need_auth: bool = True,
@@ -174,7 +175,7 @@ class E3372:
def sms_count(self):
self.auth()
return self.request('sms/sms-count')
-
+
def sms_send(self, phone: str, text: str):
self.auth()
return self.request('sms/send-sms', HTTPMethod.POST, {
@@ -204,6 +205,7 @@ class E3372:
messages = []
for message_elem in root.find('Messages').findall('Message'):
message_dict = {child.tag: child.text for child in message_elem}
+ message_dict['UnixTime'] = int(datetime.strptime(message_dict['Date'], '%Y-%m-%d %H:%M:%S').timestamp())
messages.append(message_dict)
return messages