Secondary channels, android app, and the associated mess

I’ve been playing with my three meshtastic devices (two tbeams and one tlora) trying to see if there’s anyone out there on a public channel within range, while maintaining a private secondary channel otherwise in hopes of actually getting some use out of it.

This proved rather problematic: Android app cannot communicate over a secondary channel at all. So I have attempted this gambit:

  1. Set up two channels (public primary, private secondary) at the tlora device, which is meant to be stationary. Confine communicating over the public channel to the python api, while using the android app for private communications.
  2. Set up only one channel – the private secondary one – as primary, on the tbeam devices, which are meant to go out and about and stay connected to android devices.

This way I would be able to actually use the things while still keeping an eye on the public channel. But this plan didn’t work:

  • I can’t directly set a channel psk through the python CLI to a known value received from the same CLI, because it only accepts constant values of a psk – preprogrammed psks and “make a random one”.
  • I can’t encode the secondary channel into an URL separately either. Hacking around with the python API, which involved copy-pasting getUrl and hacking it to ignore the primary channel (because there’s no way to get a per-channel URL normally) produces an URL that results in wrong modem settings.

The python API docs are down, so I have only a limited understanding of what I’m doing. I also don’t know enough about protobuf to understand the data structures and just jam the values from one channnel into the other properly.

Any ideas how to solve this?

P.S. This is how far I got:

#!/usr/bin/env python

import base64
import meshtastic
from meshtastic import apponly_pb2, channel_pb2
import meshtastic.tcp_interface

interface = meshtastic.tcp_interface.TCPInterface(hostname="192.168.xxx.xxx")

def getSpecificChannelUrl(node, name):
    channelSet = apponly_pb2.ChannelSet()
    if node.channels:
        for c in node.channels:
            if c.settings.name == name:
                c.settings.modem_config = node.channels[0].settings.modem_config
                c.role = channel_pb2.Channel.Role.PRIMARY
                channelSet.settings.append(c.settings)
        some_bytes = channelSet.SerializeToString()
        s = base64.urlsafe_b64encode(some_bytes).decode('ascii')
        return f"https://www.meshtastic.org/d/#{s}".replace("=", "")

me = interface.getNode(meshtastic.LOCAL_ADDR)
print(getSpecificChannelUrl(me,"localhost"))

This gets me an URL that seems legit, but then sending a message from the tlora to a tbeam does not seem to work.

1 Like

fixed.

multiple channel support is still very limited due to low interest/use cases.

Are you referring to multi-channel support in the python api, the android app, or in general?

I ask because I can think of more than a few multi-channel use cases.

1 Like

It is in the python api, no one is actually using it that I know of. Pull requests are welcome if you want to get firmware or Protobuf support working better, but I think a lot of the potential use cases are going to be better served by features that are much closer to complete and less confusing.

1 Like

Hey garth,

Can you expand on that comment “I think a lot of the potential use cases are going to be better served by features that are much closer to complete”? What features might replace the need for a secondary channel or an open public channel along side a private channel?