Spacebridge and listening for SMS listening incompatible?


#1

First intent is for a Pi to listen continuously for inbound SMS commands. Works great with the API.

hologram = HologramCloud(credentials, network=‘cellular’,authentication_type=‘csrpsk’)
sms_obj = hologram.popReceivedSMS()

Second intent is for that Pi to accept SSH over Spacebridge. Works great, but only if I issue the command

sudo hologram spacebridge &

The problem is doing both. If the Pi listens for Spacebridge then I cannot listen for inbound SMS.
Or vice-versa.

So how do get remote SSH control for a device already listening to SMS? I have tested while connected to WiFi (possible route problem) and off WiFi (seems to require sudo hologram spacebridge command not matter what).

Thank you


#2

Hey @Mixie,

You should be able to do both on a U201 Nova (2G/3G) if you run sudo hologram modem connect followed by
sudo hologram receive --sms. The first command will allow you to Spacebridge into your Nova.

Outside of that you can create an SMS command that starts Spacebridge and build a process that re-starts the SMS listener when Spacebridge is closed.

Best,
Maiky


#3

My Python SMS code is
hologram = HologramCloud(credentials, network=‘cellular’,authentication_type=‘csrpsk’)

hologram.enableSMS()

sms_obj = hologram.popReceivedSMS()

constantly looping in the background.
When this code runs, I can receive an SMS, no problem. But I cannot connect with Spacebridge.
If I try to connect with SpaceBridge nothing happens. Putty just sits there, cursor upper left corner, until after a few minutes it says “Server unexpectedly closed network connection”.

If I try to run “sudo hologram modem receive” on the device I get an error (already connected).
If I stop my SMS code and run sudo hologram receive, no problem, I can SpaceBridge in.

So close, I can smell it… any thoughts?
Thank you!


#4

I had to do something like this

import os

while True: #start the loop
recv = hologram.popReceivedSMS() #makes the recv variable equal an incoming message
if recv is not None: #run the following code when a message comes in
cmd = recv.message #makes the cmd variable the payload of the message.
if cmd == ‘sb’:
os.system(“sudo hologram spacebridge &”)

then send a text with “sb” to start the spacebridge
my python runs on boot so I just end my session with a sudo reboot and that’s it


#5

Brilliant! Problem solved. Thank you!


#6

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.