bacpypes icon indicating copy to clipboard operation
bacpypes copied to clipboard

LocalTrendLogObject

Open JoelBender opened this issue 5 years ago • 6 comments

Create a LocalTrendLogObject with all the right stuff for maintaining the log which will need an additional API for interpreting the Range choices as well as something like log_status(), log_value(), log_failure(), and log_time_change(). Continuation of #207. This might include a LocalEventLogObject as well.

JoelBender avatar Apr 19 '19 13:04 JoelBender

any news from this object? is it implemented or not yet? I wish to have a such object in BIPSimpleApplication, but I could not find any

kazemiprince avatar Apr 10 '20 16:04 kazemiprince

Yikes! Almost a year! No, nothing yet. :-(

JoelBender avatar Apr 14 '20 03:04 JoelBender

cast_in nightmare.... thought it would be an easy ride

ChristianTremblay avatar Feb 15 '23 02:02 ChristianTremblay

Quite a bit of a pain. Are you dealing with non-primitive data types in the LogRecordLogDatum?

JoelBender avatar Feb 15 '23 06:02 JoelBender

A realValue... i just don't get it.

The internal data type is a ListOf or a SequenceOfAny depending on how I generate logBuffer internally.

I end up with some bytes error saying that bytes value should be between 0-256 ... or an invalid constructor.

This error occurs when I try to readRange the logBuffer from another BAC0 instance. As this is under the doReadRange thing.

ChristianTremblay avatar Feb 15 '23 11:02 ChristianTremblay

Note to myself, remember bacpypes deal with dates as year minus 1900... been hard to tackle down. There should be a "StupidProof" mechanism in the Date class that subtract 1900 if it sees a 2000 date....

This explained the bytes error... and allowed me to fill the itemData of the response

    resp = ReadRangeACK(context=apdu)
    resp.objectIdentifier = objId
    resp.propertyIdentifier = apdu.propertyIdentifier
    resp.propertyArrayIndex = apdu.propertyArrayIndex

    resp.resultFlags = [1, 1, 0]
    resp.itemCount = len(value)

    # save the result in the item data
    item_data = SequenceOfAny()
    item_data.cast_in(value)
    resp.itemData = item_data
    self._log.debug("    - itemData : %r", resp.itemData)
    self._log.debug("    - resp: %r", resp)
    self.response(resp)

Made me refactor BAC0 to treat logDeviceObjectProperties as otional...

Each LogRecord is built this way

LogRecord(
            timestamp=_dt,
            logDatum=LogRecordLogDatum(realValue=Real(val)),
            statusFlags=StatusFlags([0, 0, 0, 0]),
        )

Now I need to figure a good way to build some kind of database in memory from the reading I get...to then build the logRecord.... I actually done something weak and I get duplicates.

Hope those notes will help others

ChristianTremblay avatar Feb 16 '23 04:02 ChristianTremblay