Cannot connect to sensor using Zigmo/router

You can set any value from 1 to 16777215 seconds

Thanks! Do you know if there is any documentation on connecting and sending/receiving data in python?

sample python lib can be found here


let us know if you need anything else.

Thanks

Hi,

I am a bit confused as to how the code connects to the RemoteXBee deivice. I basically want to specify the remote device mac address and be able to send commands to it (to configure it) and receive data from it via the local host.

you can specify the remote device address in the command.

7E 00 13 10 00 00 00 00 00 00 00 FF FF FF FE 00 00 F7 15 00 00 00 E8

In the above command the remote device address is set as broadcast. The address is 00 00 00 00 00 00 FF FF. If you are planning to send this command to a particular sensor, replace this with the mac address of the sensor.
lets say the remote device address is
00 13 A2 00 41 91 1B 83
and you want to target this sensor
the command will looks like
7E 00 13 10 00 00 13 A2 00 41 91 1B 83 FF FE 00 00 F7 15 00 00 00 checksum.

I understand that but my question is can I configure sensor delay remotely in python. Can I write 7BCD to the local host in python. Then press reset/configure and then send the command to configure a delay period in python?

I understand the python code you sent me is just printing out any sensor data that is being received. I want to basically manage the connection between local host and sensor by sending commands in python.

Thanks!

Yes, you can configure the sensor through python as well.
Here are all the commands


These commands can be send through python or any other software.
The python lib we wrote only reads the sensor data and displays the value but it can be modified to send data from local xbee to sensor. its simply reading and writing data on a serial port.

I see. Do you know how I can get started with the reading and writing data from local xbee to sensor using python?

Can I request to read sensor data from the remote xbee instead of waiting for data to come in?

here is tutorial you can checkout
https://pyserial.readthedocs.io/en/latest/shortintro.html

no, its not possible to request sensor data from the device. the reason is that the sensor is sleeping most of the time and wont be receiving any data from other devices.
This is how it works
it wakes up after pre defined time, takes sensor readings and sends over wireless and goes back to sleep.

If you want to request the sensor data then you will need a all the time powered dives.

Hi,

I was wondering if I should be seeing a value of 1.37-1.5 V on the battery coming back from the sensors?
Based on this chart is how I am obtaining the battery value

But I was wondering if you have a conversion for this to a percentage value of approximately when the sensor will run out of battery?

Also, I am able to get data https://github.com/ncd-io/NCDEnterpise-Python but I would also like to use configure different settings? Do you have any guides on how I should do that with your script?

Ida

Hi,
The sensor will work till the voltage is around 1.2V.
When the battery is fully charged the voltage will be 3.29V and when the battery is dead the voltage will be 1.2V.
using these two known values we can calculate the % value.

@jacob wrote the python lib. he might be able to suggest something.

Thanks

Yea, I just updated the base library.

Basically just added a new line to the sensor_data method:

def sensor_data(self, payload):
    parsed = {
        'nodeId': payload[0],
        'firmware': payload[1],
        'battery': msbLsb(payload[2], payload[3]) * 0.00322,
        'battery_percent': str(((msbLsb(payload[2], payload[3]) * 0.00322) - 1.3)/2.03*100) + "%",
        'counter': payload[4],
        'sensor_type_id': msbLsb(payload[5], payload[6]),
    }
    parsed['sensor_type_string'] = self.sensor_types[str(parsed['sensor_type_id'])]['name']
    parsed['sensor_data'] = self.sensor_types[str(parsed['sensor_type_id'])]['parse'](payload[8:])
    self.callback(parsed)

Hi @jacob

I am able to get data from the sensor using your script but I would like to know how to configure different settings using the script? How would I receive that configuration command that tells me the sensor is in configuration mode? Then how can I send a command over using Digi XBee python API?

I saw this in the file but I’ve not been able to use them.
‘122’: self.power_up,
‘124’: self.config_ack,
‘125’: self.config_error,

Basically, I want to know when the sensor is in config mode so I can send the correct configuration command to it. Then wait and receive the message back from the sensor to confirm there is no config_error.

Thanks

Oh I’ll have to look into the documentation for these devices again and run some tests.

I remember generalities, but not specifics on how the modes are differentiated in the packet struct.

Let me see if I can’t get a quick sample together tomorrow morning.

I’m side-tracked on some internal scripting, but I’ll get to this as soon as I can.

1 Like

Thanks! :slight_smile: Much appreciated

Alright, long story short. To make it useful I need to return a serial address of the originating module.

To do that I have to use a different object for the incoming data so its a bit of a tear down and rebuild of how some of the data is passed. Not a huge rebuild, but might be late on Monday before an example is out.

Sure. Thanks. Will wait on your example.

Also I noticed that with configuration mode: “For optimal performance keep only one sensor in config mode at a time.”
Why is this the case?
I would like to put multiple devices into config mode and then set the individual delay periods all at the same time.

During configuration if you are using MAC address to target the sensors then you can configure as many as you want at one time.
we dont recommend this if you are configuring in broadcast mode. because when you send a command in broadcast mode it will be received by all the sensor in config mode and the same settings will apply to all the sensors.

Ran into a delay using the Digi Python library where it times out anytime I send data even to just read a parameter from the modem. I’m actually waiting on my own tech support currently.