-
Notifications
You must be signed in to change notification settings - Fork 6
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
Integration with SMS? #14
Comments
I'm pretty sure that it is, though I'm not sure if there are any relevant limitations with the SIM cards. The downside is that it would currently involve raw AT commands and I believe you have to set up an additional command channel so that normal commands can still work while in PPP mode. I haven't explored this yet. |
Thanks! I've been playing with this for a bit and using some resources (documenting here if anyone wants to try!)
...but I can't seem to get the anything but a timeout in response to the Maybe is a limitation of the 'data only' SIM that came with the clipper? Here's some very rough code / lines I've been testing with but I can't seem to get past that. Again, for posterity: # switch to text mode?
print("switching to text mode")
#con._send_at_command("AT+CMGF=1", 1, 10)
# read text mode values?
#con._send_at_command(b"AT+CSMP?", 1, 10)
#AT+CSMP=17,167,0,16
#print("Sending message")
#con._send_at_command('AT+CMGS="[REDACTED]"', 1, 3)
recipient = "[REDACTED]"
message = "Hello, World!"
#con._send_at_command(b'ATZ',1 , 10)
con._send_at_command(b'AT+CMGF=1',1)
con._send_at_command(b'AT+CMGS="' + recipient.encode() + b'"',1, 20)
con._send_at_command(message.encode() + b"")
con._send_at_command(bytes([26])) |
I think the problem is that It also needs a small delay (it would seem) between CMGS and the actual message body, so we can't send it in one transaction. Try:
|
Or, to slap that into a function (which I'll add to the lte module I think): def send_text_message(recipient, body, timeout=5.0):
con._uart.write("AT+CMGS=\"")
con._uart.write(recipient.encode("ascii"))
con._uart.write(b"\"\r")
time.sleep(0.5)
con._uart.write(body.encode("ascii"))
con._uart.write(b"\x1a\r")
con._uart.flush()
status, data = con._read_result(1, timeout=timeout)
if status == "TIMEOUT":
raise CellularError(f"cellular module timed out for SMS command")
if status not in ["OK"]:
raise CellularError(f"non 'OK' result for SMS command") (Edit: don't need to multiply the timeout by 1000, oof) |
Also a quick cleanup of the lte module code.
Hrm, this still isn't working for me :-/
|
Then just hack around on the repl until something works (in Thonny, at least, the context of an executed Python script is kept and you can use those loaded functions/setup connections etc in the repl). |
okay thanks! My setup is pretty similar. I'll keep you posted :-) And thanks for much for the help on this -- happy I was able to nerd snipe you :-) |
It is, indeed, a limitation of the sims we sell- they're data-only! |
AHA! Okay. Cool. I think I've got another one somewhere for exactly this kind of emergency 👀 |
Sounds like a job for an SMS -> MQTT gateway. Something like https://www.instructables.com/Two-way-MQTT-SMS-Bridge-Linkit-One/ Would be an interesting project for the LTE Pi HAT 😆 |
Hello,
Is it possible to use the new wireless firmware + the clipper LTE module to not only get a pico online but also receive / send SMS?
The text was updated successfully, but these errors were encountered: