pyebus.ebus module
Pythonic EBUS Representation.
- class pyebus.ebus.Ebus(host='127.0.0.1', port=8888, timeout=10, scaninterval=None, scans=None, circuitinfos=None, msgdefcodes=None, msgdefs=None)[source]
Bases:
object
Pythonic EBUS Representation.
The EBUS handle, using one
Connection
to an EBUSD instance. One EBUSD server can handle multipleEbus
instances.- Keyword Arguments:
host (str) – EBUSD host
port (int) – EBUSD port
timeout (int) – Connection Timeout on connect and write.
scaninterval (str) – EBUSD scan - check interval
scans (str) – EBUSD scan - number of intervals
circuitinfos (list) – List with
CircuitInfo
instancesmsgdefcodes (list) – EBUSD Message Definition Codes
msgdefs (MsgDefs) – Message Definitions
- CONNECTOR
alias of
Connection
- DEFAULT_SCANINTERVAL = 10
- DEFAULT_SCANS = 3
- connection
- scaninterval
- scans
- msgdefcodes
- property ident
Ident.
- property host
Host Name or IP.
- property port
Port.
- property timeout
Timeout.
- property circuitinfos
Circuit Informations
CircuitInfo
.This property is writeable.
- get_circuitinfo(circuit)[source]
Return
CircuitInfo
for circuit.
- async async_wait_scancompleted()[source]
Wait until EBUSD device scan is completed.
EBUSD scans the bus infrastructure at startup be default. Devices and messages are detected during this time. This method waits until no new message are found. It checks every scaninterval seconds. The number of messages has to be stable for scans times.
- Raises:
ConnectionRefusedError – If connection cannot be established
ConnectionError – On connection breakdown.
CommandError – If command failed
Shutdown – On EBUSD shutdown.
- async async_load_msgdefs()[source]
Load Message Definitions from EBUSD.
Alias for
async_load_msgdefcodes
anddecode_msgdefcodes
.- Raises:
ConnectionRefusedError – If connection cannot be established
ConnectionError – On connection breakdown.
CommandError – If command failed
Shutdown – On EBUSD shutdown.
- async async_load_msgdefcodes(add=False)[source]
Load EBUS Message Definition Codes from EBUSD and store to
msgdefcodes
.- Raises:
ConnectionRefusedError – If connection cannot be established
ConnectionError – On connection breakdown.
CommandError – If command failed
Shutdown – On EBUSD shutdown.
- async async_read(msgdef, ttl=None, setprio=None)[source]
Read Message.
- Parameters:
msgdef (MsgDef) – Message Definition
- Keyword Arguments:
ttl (int) – Time-to-live. Maximum age of read value in seconds.
setprio – Priority 1-9 or A for automatic.
- Returns:
Message
- Return type:
- Raises:
ValueError – on decoder error
ConnectionRefusedError – If connection cannot be established
ConnectionError – On connection breakdown.
CommandError – If command failed
Shutdown – On EBUSD shutdown.
- async async_write(msgdef, value, ttl=0)[source]
Write Message.
If msgdef just contains a subset of fields, the value is applied only to these, by running a read-modify-write operation.
- Parameters:
msgdef (MsgDef) – Message Definition
- Keyword Arguments:
ttl (int) – Time-to-live. Maximum age of read value in seconds. Just needed in case of a Read-Modify-Write.
- Raises:
ConnectionRefusedError – If connection cannot be established
ConnectionError – On connection breakdown.
- async async_listen(msgdefs=None)[source]
Listen to EBUS for messages.
Listen to automatically updated messages and EBUSDs polling mechanism.
- Keyword Arguments:
msgdefs (MsgDefs) – Message definitions to be listened, other messages are ignored.
- Yields:
Msg – Messages
- Raises:
ConnectionRefusedError – If connection cannot be established
ConnectionError – On connection breakdown.
CommandError – If command failed
Shutdown – On EBUSD shutdown.
- async async_observe(msgdefs=None, ttl=None, setprio=None)[source]
Observe msgdefs messages.
Explicitly read all messages and then listen to automatically updated messages and EBUSDs polling mechanism.
- Keyword Arguments:
- Yields:
Msg – Message
- Raises:
ConnectionRefusedError – If connection cannot be established
ConnectionError – On connection breakdown.
CommandError – If command failed
Shutdown – On EBUSD shutdown.
- async async_get_state()[source]
Return state string.
This method does NOT raise any exception.
- Returns:
OK or any error value.
- Return type:
- async async_is_online()[source]
Return True if everything is fine.
This method does NOT raise any exception.
- Returns:
bool
- async async_get_info()[source]
Return EBUSD meta information.
- Returns
dict: Meta information according to metainfo
- async async_load_circuitinfos()[source]
Load EBUSD Circuit Information and store in
circuitinfos
.
- async async_cmd(cmd, infinite=False, check=False)[source]
Send EBUS_Command cmd to EBUSD and Receive Response.
- Parameters:
cmd (str) – Commmand String
- Keyword Arguments:
- Yields:
str – response
- Raises:
ConnectionRefusedError – If connection cannot be established
ConnectionError – On connection breakdown.
CommandError – If command failed and check==True.
Shutdown – On EBUSD shutdown.