Meshtastic

Need an example of --gpiowrb

Quick question,

I’m playing around with putting a router up on the hill in a solar rechargeable light, and I thought it would be cute to be able to remote control the light. I figured I could use the following command to change the state of the GPIO pin 4, but I can’t seem to make it do anything.

meshtastic --dest ‘!7c9ebdf0b18c’ --gpiowrb 4 1

Sending the above gets me:

Writing GPIO mask 0x10 with value 0x10 to !7c9ebdf0b18c

But no change on pin 4 on the T-beam

Is this implemented and working yet?

Could someone share an example command?

alas - this gpio feature isn’t yet supported. I’ve been mostly using it as a test case for the new device API (which is supported). I need to do a bit more work on security before encouraging others to actually use it :wink: . The security will be built on top of the ‘multiple channel’ support, so it will be a few weeks before this is in.

1 Like

A few months later - any update?
Has gpiowrb been implemented yet? I am using V1.2.10

When I try:

meshtastic --port /dev/cu.SLAB_USBtoUART --dest ‘!d1c81e28’ --gpiowrb 13 1

The console hangs and the device just shows a repeating horizontal progress bar.

A little more progress:
If I rather direct the gpiowrb command to another node fc30 whilst I am connected to 1e28 via USB ie

meshtastic --port /dev/cu.SLAB_USBtoUART --dest ‘!d1c8fc30’ --gpiowrb 13 1
Connected to radio
Writing GPIO mask 0x2000 with value 0x2000 to !d1c8fc30

The console then hangs requiring ^C to terminate, the connected node 1e28 just displays a repeating progress bar but the destination node fc30 indeed does set its bit on GPIO13.
Any ideas?

Hi, I did some experiments with the GPIO firmware 1.1.50 and it works quite well in remote transmission. The command I use to activate the only pins that seem to work is
meshtastic --gpiowrb xx 1 --dest ‘! 050d2dcc’ where xx are the pins: 15, 25, 14, 2 and 0. The others don’t seem to work …
For the command you need to give the CTRL-C, with the help of Manuel IZ1KGA who modified the main.py software at this point. Now I would like to remotely read a GPIO but I don’t understand if this is possible.




1 Like

When you say:

For the command you need to give the CTRL-C

Are you implying that CTRL-C is the normal way to terminate the “gpiowrb” command - and does not indicate a problem?

I wonder what the Python-API gives - need to try it.

In the previous message I had written where to make the change, but perhaps it is not clear, I changed the file “main.py” like this:

if args.gpiowrb or args.gpiord or args.gpiowatch:
rhc = remote_hardware.RemoteHardwareClient(interface)
closeNow = True
if args.gpiowrb:
bitmask = 0
bitval = 0
for wrpair in (args.gpiowrb or []):
bitmask |= 1 << int(wrpair[0])
bitval |= int(wrpair[1]) << int(wrpair[0])
print(f"Writing GPIO mask 0x{bitmask:x} with value 0x{bitval:x} to {args.dest}")
rhc.writeGPIOs(args.dest, bitmask, bitval)

OK, so it looks like you have added:

Which does an interface.close(), which in turn stops the repeating horizontal progress bar.

TTGO T-Beam V1.1

meshtastic --version
1.2.40

Firmware 1.2.45

meshtastic --port /dev/ttyUSB0 --dest !f244c480 --gpio-wrb 25 0
meshtastic --port /dev/ttyUSB0 --dest !f244c480 --gpio-wrb 25 1

works for PIN 0, 2, 14,15, 25 as per @ik1jns comments.

I continue the investigations.

No need for closeNow = True or other modification.

For PIN 14

import time
import meshtastic
from pubsub import pub
from meshtastic import remote_hardware

interface = meshtastic.SerialInterface("/dev/ttyUSB0")                
rhc = remote_hardware.RemoteHardwareClient(interface)

bitmask = 0x4000
bitval = bitmask
dest = "!f244c480"

while 1:
    rhc.writeGPIOs(dest, bitmask, bitval)
    time.sleep(4)
    rhc.writeGPIOs(dest, bitmask, 0)
    time.sleep(4)

it works.

If I try with PIN13 (0x2000) then the device just shows a repeating horizontal progress bar and then crash.

1 Like