aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2021-03-23 04:25:23 +0300
committerEvgeny Zinoviev <me@ch1p.io>2021-03-23 04:25:23 +0300
commit94f02f64d5dc2091d21037815a8f946446235596 (patch)
treeb24a5c955685d695774826bfd30b88c0773780c5
parent6e00f7027269b0e6af8b1005a444b399f7931b6f (diff)
update sms commands
-rw-r--r--main.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/main.py b/main.py
index 30fccea..86dd972 100644
--- a/main.py
+++ b/main.py
@@ -12,15 +12,15 @@ trusted_phone = ''
def sms_handler(sms: SMS, api: WebAPI):
global trusted_phone
- print(f'from: {sms.phone}')
- print(f'text: {sms.text}')
+ # print(f'from: {sms.phone}')
+ # print(f'text: {sms.text}')
if sms.phone == trusted_phone:
text = sms.text.lower().strip()
- if text == 'you shall reboot':
+ if text == 'you shall reboot!':
api.reboot()
- elif text == 'show me some status':
+ elif text == 'yo, get me some status':
info = api.device_information()
signal = api.device_signal()
buf = []
@@ -37,6 +37,12 @@ def sms_handler(sms: SMS, api: WebAPI):
if buf != '':
api.send_sms(phone=trusted_phone, content=buf)
+ elif text == 'switch it off':
+ api.dataswitch(False)
+
+ elif text == 'switch it on':
+ api.dataswitch(True)
+
def main():
global trusted_phone