Problem reading values from GPIO pins

I am trying to read sensor values from one of the ADC pins of the T-beams. I followed the instructions in https://meshtastic.org/docs/hardware/peripheral/ to first create a ‘gpio’ channel on the local node. Then I connected the remote node to the same channel. I then made sure that my nodes could talk to each other over this ‘gpio’ channel.

After that I connected the sensor to the T-beam and ran the following code to read the gpio pin.

import meshtastic.remote_hardware
import meshtastic.mesh_interface
iface = meshtastic.mesh_interface.MeshInterface()
sensor = meshtastic.remote_hardware.RemoteHardwareClient(iface)
print(sensor.readGPIOs(‘!da5ceb20’,0x800000000)) # read gpio 35 from nodeid !da5ceb20

However when I run this script I get the following error.

Warning: No channel named ‘gpio’ was found.
On the sending and receive nodes create a channel named ‘gpio’.
For example, run ‘–ch-add gpio’ on one device, then ‘–seturl’ on
the other devices using the url from the device where the channel was added.

The weird part is if I run

meshtastic --gpio-rd 0x800000000 --dest !da5ceb20

in the CLI this is the output I get:

Connected to radio
Reading GPIO mask 0x800000000 from !da5ceb20
Received RemoteHardware type=READ_GPIOS_REPLY, gpio_value=0 value=0

Even though the code and the CLI are essentially the same command they give wildly different outputs.

Also, could you clarify what --dest parameter means here? Is this the ID of the local node? Or is this the ID of the remote node(where the sensor is connected).

Did you add a GPIO channel?

Yes, both my nodes can talk to each other over the gpio channel when I use the web client.

So I reflashed the firmware on the T-beam and now when I run

meshtastic --gpio-rd 0x10 --dest !da5ceb20

I always get a 0 value on the gpio pin.

Connected to radio
Reading GPIO mask 0x10 from !da5ceb20
Received RemoteHardware type=READ_GPIOS_REPLY, gpio_value=0 value=0

On the other hand, the python script still outputs the same error.