Why bacpypes3 Defines class TimeValue(Sequence)

Tools & Librariesbacpypes3TimeValueSequenceSchedule object
June 23, 2026|8 min read

In bacpypes3, class TimeValue(Sequence) is the Python implementation of the ASHRAE 135 BACnetTimeValue construct — a SEQUENCE of two named elements, time (a BACnet Time) and value (an AnyAtomic). It lives in the bacpypes3.basetypes module and inherits the metaclass that collects those elements into _elements. A TimeValue says "at this time of day, the scheduled value becomes this," which is why you see it inside DailySchedule entries of a Schedule object's Weekly_Schedule. Most errors constructing one come from passing a raw Python value where the value element needs a BACnet atomic primitive.

You're Reading the Source and Hit This Class

You open the bacpypes3 base-types module to understand how a Schedule encodes, and you land on:

class TimeValue(Sequence):
    ...

The question that usually brings people here is simple: what are the fields, why is it a Sequence, and what do I pass to build one? You may have arrived after a TypeError while constructing a schedule, or a peer device rejecting your WriteProperty with invalid-data-type even though the encode succeeded locally. Both trace back to the same two-field structure, so it is worth reading the class against the spec rather than guessing at the constructor.

What TimeValue Is in ASHRAE 135

BACnet's data types are specified in ASHRAE Standard 135 using ASN.1 notation. BACnetTimeValue is a SEQUENCE of exactly two components:

That pairing is the whole point of the type: it expresses a single scheduled transition. A list of TimeValue entries, in ascending time order, is what a DailySchedule carries for one day. Seven DailySchedule entries make up the Weekly_Schedule of a Schedule object. So a single TimeValue is the smallest unit of a BACnet schedule.

Why It Subclasses Sequence

Sequence in bacpypes3 is defined with a metaclass that, at class-creation time, scans the class for its declared components and records them in a class-level _elements collection mapping each element name to its type. Every Sequence subclass inherits that behavior, so TimeValue gets element collection, ordered encode, and decode for free. Declaring TimeValue as a Sequence with a time element typed Time and a value element typed AnyAtomic is all the library needs to know how to walk the two components on the wire.

This is the same machinery that backs class Choice(Sequence); a CHOICE reuses the element collection but constrains it to one active element. A TimeValue is a plain SEQUENCE: both elements are present and both are encoded, in order.

The Two Element Types You Have to Get Right

Because TimeValue is just a container, building one correctly is entirely about supplying the right type for each element.

How to Read the Definition for Your Release

bacpypes3 is pre-1.0, and constructor signatures and accessor names have shifted between releases. Rather than copy a signature from a tutorial, read the class that ships with your pinned version:

  1. Find the class. After pip install bacpypes3, open the bacpypes3.basetypes module in your site-packages and search for class TimeValue. The time and value element declarations are right there.
  2. Confirm the version. Cross-check against the bacpypes3 PyPI page, which links to the source repository for the currently published release. Pin the version in your project so the source you read matches the code you run.
  3. Treat ASHRAE 135 as the shape of record. The Python class mirrors the spec's SEQUENCE. If the class and the standard ever disagree, the standard wins for interoperability with other vendors' devices.

Common Pitfalls

When to Escalate

If your TimeValue entries match the spec and the local encode succeeds but a peer device still rejects the schedule, the limitation is usually on the remote side. Escalate by:

Source Attribution

The technical guidance in this entry is grounded in the following public sources:

Additional testing and field validation by SiteConduit.

bacpypes3TimeValueSequenceSchedule objectBACnet types

Was this article helpful?

Related Articles

Need to do this remotely? SiteConduit provides Layer 2 access that preserves BACnet broadcasts — no BBMD needed for remote sessions. Join the waitlist.

SC

SiteConduit Technical Team

Idea Networks Inc.

SiteConduit builds managed remote access for building automation. Our knowledge base is maintained by BAS professionals with hands-on experience deploying and troubleshooting BACnet, Niagara, Modbus, and Facility Explorer systems.