Digi Dia FileLogger

Have the Wi-9P starter kit. The hardware is working very well and I’ve gotten the demo python programs to run plus have added XBee nodes and the FileLogger to the configuration file.
It took some playing to discover what the logger_set in Dia wanted but did figure it out. But it can only ‘rewind’ or ‘fast forward’ to dump the latest or oldest recored states. The Developer’s Guide states:

The standard channel interaction calls (such as channel_list) are supported in a logger’s Channel Database. Additionally, the following functions may be implemented:
•
log_rewind rewinds the channel database to represent the oldest known state
25

•
log_seek sets the channel database to represent the known state closest to the given timestamp
•
log_time returns the time the state of the channel database represents
•
log_event_iterator returns a list of events occurring between two times
•
*log_next Advance the channel database one event in time
•
*log_prev Step the channel database back one event in time

  • Not available in the current File Logger.

But the Seek, Time and Event commands are not available making the logger not very useful. Digging into the code I found in channel_database.py:

## Functions Not implemented:
def log_next(self):
    """Not implemented"""
    raise ChannelDatabaseFunctionNotImplemented, "Not implemented"

def log_prev(self):
    """Not implemented"""
    raise ChannelDatabaseFunctionNotImplemented, "Not implemented"

def log_rewind(self):
    """Not implemented"""
    raise ChannelDatabaseFunctionNotImplemented, "Not implemented"

def log_seek(self, timestamp):
    """Not implemented"""
    raise ChannelDatabaseFunctionNotImplemented, "Not implemented"

def log_time(self):
    """Not implemented"""
    raise ChannelDatabaseFunctionNotImplemented, "Not implemented"

def log_event_iterator(self, timestamp_from, timestamp_to):
    """Not implemented"""
    raise ChannelDatabaseFunctionNotImplemented, "Not implemented"

This is an incomplete piece of code. Will this code be completed and released anytime soon?

You’re looking a little too high up in the object inheritance tree. file_logger_context.py contains a concrete implementation of ChannelDatabaseInterface. It also fails to implement several of the methods, but log_event_iterator() seems to be where the action’s at.

Ok, thanks for some direction.
I’m looking and found the log_event_iterator def. I’m ok programing in assembler and C but do get a little lost with C++ classes, etc. I think it’ll be some time before I can work on python code at this depth.
This is why I am a bit disappointed with the incompleteness of iDigi Dia as it is toted as being an easy way to implement and customize a ZigBee network, all that is needed to write is a config file (.yml) and device drivers not recoding deep inside the CLI code modules.

Why do you think that Dia requires “recoding deep inside the CLI code modules”, and that Dia is incomplete? The documentation could certainly be better, and I’ve found a few bugs, but by and large I find Dia to be quite complete. There’s no need to modify the core code. And the CLI interface is helpful for troubleshooting and viewing your configuration, but it’s mainly a troubleshooting tool.

Well as the example that started this thread:
With the CLI logger in its current state of coding one can only Rewind to the oldest entry or fast_forward to the latest entry. There isn’t any way to ‘step through’ the log entries. Inside the code there are ‘next’, ‘back’ and ‘seek’ code but none are available at the CLI.

Maybe what you are trying to tell me is that these code pieces are only for use within code I write!

I do agree with the documentation, its pretty bad. Even more so is the fragmentation of information on the pieces used, Dia, Wi9P OS, XBee modules, etc. It also seems that one is expected to dig into lots of code to find general specs.

Anyway, thanks for the help.

Actually, you can step through the log entries, using the event iterator. It takes a range of timestamps. It requires a little more thought than prev/next, but it is quite useful.

Is this event iterator available from the Dia CLI or just from code I would need to write?

It’s the log_event_iterator method of the ChannelDatabaseInterface class. You’d have to write code to call that method.