diff --git a/samples/CommandableMixin.py b/samples/CommandableMixin.py index 0fd75f2..2bce086 100755 --- a/samples/CommandableMixin.py +++ b/samples/CommandableMixin.py @@ -13,7 +13,7 @@ from bacpypes.core import run from bacpypes.errors import ExecutionError from bacpypes.object import AnalogValueObject, DateValueObject -from bacpypes.primitivedata import Null +from bacpypes.primitivedata import Null, Date from bacpypes.basetypes import PriorityValue, PriorityArray from bacpypes.app import BIPSimpleApplication @@ -148,7 +148,7 @@ class CommandableDateValueObject(CommandableMixin, DateValueObject): def __init__(self, **kwargs): if _debug: CommandableDateValueObject._debug("__init__ %r", kwargs) - CommandableMixin.__init__(self, False, **kwargs) + CommandableMixin.__init__(self, None, **kwargs) # # __main__ @@ -175,14 +175,18 @@ def main(): # make a commandable analog value object, add to the device cavo1 = CommandableAnalogValueObject( - objectIdentifier=('analogValue', 1), objectName='Commandable AV 1' + objectIdentifier=('analogValue', 1), objectName='Commandable1', ) if _debug: _log.debug(" - cavo1: %r", cavo1) this_application.add_object(cavo1) - # make a commandable binary value object, add to the device + # get the current date + today = Date().now() + + # make a commandable date value object, add to the device cdvo2 = CommandableDateValueObject( - objectIdentifier=('dateValue', 1), objectName='Commandable2' + objectIdentifier=('dateValue', 1), objectName='Commandable2', + presentValue=today.value, ) if _debug: _log.debug(" - cdvo2: %r", cdvo2) this_application.add_object(cdvo2)