Python CLI send message

So, the python library seems to do a good job of sending a message to the Hologram cloud.

Though in order to make it work, I must FIRST connect, then send the message like so:

from Hologram.HologramCloud import HologramCloud
hologram = HologramCloud(dict(), network=‘cellular’)
hologram.network.connect()
hologram.sendMessage(msg, topics=[topic])
hologram.network.disconnect()

Its not at all clear in the documentation that one must first run hologram.network.connect() BEFORE sendMessage. But, then again, perhaps something just isn’t working right my set up. Hopefully some one can clarify whether the expected behavior is to run connect first, or if it shouldnt be required.

But, the main problem I’m coming across is that the CLI is not usable for me. If I do this:

sudo hologram send --cloud --devicekey ‘-----’ ‘msg’ --topic ‘topic’

It hangs.

If I run sudo hologram network connect.

It connects successfully. But then I try to send a message AFTER connecting. But then of course I get the: ERROR: Unable to detect a usable serial port, because the port is already occupied by the connect.

It seems the CLI is stuck. Whats the method to actually send a message using the CLI?

On the CLI, you don’t need to connect first. If you run sudo hologram send "test" it will take care of connecting for you.

Can you run the command with -vv and paste the output? It sounds like you might be running into the Cat-M issue described here Open Network Issue With Cat-M - #18 by Reuben
Updating the firmware might fix that for you.

Seems that was the issue. I ran the Cat-M update for the R410 (even though I’ve wired the cellular module direct instead of using the Nova). The update ran successfully.

Now, running sudo hologram send “test” works! So, thanks for the suggestion.

1 Like