Clock and Timekeeping Application¶
The Clock and Timekeeping Application is used to provide access to date and time information to CBus units.
This is used for example in conjunction with programmable units that act differently depending on the time or date, and with touchscreen units that may display the time on their screens.
Please refer to this document in conjunction with the Clock and Timekeeping Application Guide published by Clipsal.
-
class
cbus.protocol.application.clock.
ClockApplication
¶ Bases:
cbus.protocol.application.sal.BaseApplication
This class is called in the cbus.protocol.applications.APPLICATIONS dict in order to describe how to decode clock and timekeeping application events received from the network.
Do not call this class directly.
-
static
decode_sals
(data: bytes) → Sequence[cbus.protocol.application.sal.SAL]¶ Decodes a clock and timekeeping application packet and returns its SAL(s).
-
static
supported_applications
() → Set[cbus.common.Application]¶ Gets a list of supported Application IDs for the application.
All application IDs must be in the range 0x00 - 0xff.
-
static
-
class
cbus.protocol.application.clock.
ClockSAL
¶ Bases:
cbus.protocol.application.sal.SAL
,abc.ABC
Base type for clock and timekeeping application SALs.
-
application
¶
-
static
decode_sals
(data: bytes) → Sequence[cbus.protocol.application.clock.ClockSAL]¶ Decodes a clock broadcast application packet and returns it’s SAL(s).
Parameters: data – SAL data to be parsed. Returns: The SAL messages contained within the given data. Return type: list of cbus.protocol.application.clock.ClockSAL
-
-
class
cbus.protocol.application.clock.
ClockUpdateSAL
(val: Union[datetime.date, datetime.time])¶ Bases:
cbus.protocol.application.clock.ClockSAL
Clock update event SAL.
Informs the network of the current time.
Creates a new SAL Clock update message.
Use
clock_update_sal(val)
instead of this constructor, as that method handlesdatetime.datetime
objects (in addition todatetime.date
anddatetime.time
, always returnsSequence[ClockUpdateSAL]
.Parameters: val – The value of that variable. Dates are represented in native date format, and times are represented in native time format. -
classmethod
decode
(data: bytes, command_code: int) → Tuple[Optional[cbus.protocol.application.clock.ClockSAL], bytes]¶ Do not call this method directly – use ClockSAL.decode
-
encode
() → bytes¶
-
is_date
¶
-
is_time
¶
-
classmethod
-
class
cbus.protocol.application.clock.
ClockRequestSAL
¶ Bases:
cbus.protocol.application.clock.ClockSAL
Clock request event SAL.
Requests network time.
Creates a new SAL Clock request message.
-
classmethod
decode
(data: bytes) → Tuple[Optional[cbus.protocol.application.clock.ClockSAL], bytes]¶ Do not call this method directly – use ClockSAL.decode
-
encode
() → bytes¶
-
classmethod
-
cbus.protocol.application.clock.
clock_update_sal
(val: Union[datetime.date, datetime.time, datetime.datetime]) → Sequence[cbus.protocol.application.clock.ClockUpdateSAL]¶ Creates Clock Update SAL(s) based on Python datetime objects.
Parameters: val – The value to set in the ClockUpdateSAL
. If this is adatetime.datetime
, this will create multipleClockUpdateSAL
objects. If this is adatetime.date
ordatetime.time
, this will only create only a singleClockUpdateSAL
.Returns: Sequence of ClockUpdateSAL
, regardless of input value type.Raises: TypeError – On invalid input type.