update sms commands

This commit is contained in:
Evgeny Zinoviev 2021-03-23 04:25:23 +03:00
parent 6e00f70272
commit 94f02f64d5

14
main.py
View File

@ -12,15 +12,15 @@ trusted_phone = ''
def sms_handler(sms: SMS, api: WebAPI): def sms_handler(sms: SMS, api: WebAPI):
global trusted_phone global trusted_phone
print(f'from: {sms.phone}') # print(f'from: {sms.phone}')
print(f'text: {sms.text}') # print(f'text: {sms.text}')
if sms.phone == trusted_phone: if sms.phone == trusted_phone:
text = sms.text.lower().strip() text = sms.text.lower().strip()
if text == 'you shall reboot': if text == 'you shall reboot!':
api.reboot() api.reboot()
elif text == 'show me some status': elif text == 'yo, get me some status':
info = api.device_information() info = api.device_information()
signal = api.device_signal() signal = api.device_signal()
buf = [] buf = []
@ -37,6 +37,12 @@ def sms_handler(sms: SMS, api: WebAPI):
if buf != '': if buf != '':
api.send_sms(phone=trusted_phone, content=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(): def main():
global trusted_phone global trusted_phone