uecho package
Subpackages
- uecho.log package
- uecho.protocol package
- Submodules
- uecho.protocol.esv module
ESVESV.NOTIFICATIONESV.NOTIFICATION_REQUESTESV.NOTIFICATION_REQUEST_ERRORESV.NOTIFICATION_RESPONSEESV.NOTIFICATION_RESPONSE_REQUIREDESV.READ_REQUESTESV.READ_REQUEST_ERRORESV.READ_RESPONSEESV.UNKNOWNESV.WRITE_READ_REQUESTESV.WRITE_READ_REQUEST_ERRORESV.WRITE_READ_RESPONSEESV.WRITE_REQUESTESV.WRITE_REQUEST_ERRORESV.WRITE_REQUEST_RESPONSE_REQUIREDESV.WRITE_REQUEST_RESPONSE_REQUIRED_ERRORESV.WRITE_RESPONSEESV.is_notification()ESV.is_notification_request()ESV.is_notification_response()ESV.is_read_request()ESV.is_read_response()ESV.is_request()ESV.is_response()ESV.is_response_required()ESV.is_write_read_request()ESV.is_write_read_response()ESV.is_write_request()ESV.is_write_response()
- uecho.protocol.message module
MessageMessage.DEOJMessage.EHD1_ECHONETMessage.EHD2_FORMAT1Message.EOJ_SIZEMessage.FORMAT1_HEADER_SIZEMessage.FORMAT1_MIN_SIZEMessage.FORMAT1_PROPERTY_HEADER_SIZEMessage.FRAME_HEADER_SIZEMessage.OPCMessage.OPCGetMessage.OPCSetMessage.ParserErrorMessage.SEOJMessage.TIDMessage.TID_MAXMessage.TID_SIZEMessage.add_get_property()Message.add_property()Message.add_set_property()Message.all_propertiesMessage.from_addrMessage.get_propertiesMessage.is_response_message()Message.parse_bytes()Message.parse_hexstring()Message.propertiesMessage.set_propertiesMessage.to_addrMessage.to_bytes()Message.to_string()
- uecho.protocol.observer module
- uecho.protocol.property module
- uecho.protocol.subject module
- Module contents
ESVESV.NOTIFICATIONESV.NOTIFICATION_REQUESTESV.NOTIFICATION_REQUEST_ERRORESV.NOTIFICATION_RESPONSEESV.NOTIFICATION_RESPONSE_REQUIREDESV.READ_REQUESTESV.READ_REQUEST_ERRORESV.READ_RESPONSEESV.UNKNOWNESV.WRITE_READ_REQUESTESV.WRITE_READ_REQUEST_ERRORESV.WRITE_READ_RESPONSEESV.WRITE_REQUESTESV.WRITE_REQUEST_ERRORESV.WRITE_REQUEST_RESPONSE_REQUIREDESV.WRITE_REQUEST_RESPONSE_REQUIRED_ERRORESV.WRITE_RESPONSEESV.is_notification()ESV.is_notification_request()ESV.is_notification_response()ESV.is_read_request()ESV.is_read_response()ESV.is_request()ESV.is_response()ESV.is_response_required()ESV.is_write_read_request()ESV.is_write_read_response()ESV.is_write_request()ESV.is_write_response()
MessageMessage.DEOJMessage.EHD1_ECHONETMessage.EHD2_FORMAT1Message.EOJ_SIZEMessage.FORMAT1_HEADER_SIZEMessage.FORMAT1_MIN_SIZEMessage.FORMAT1_PROPERTY_HEADER_SIZEMessage.FRAME_HEADER_SIZEMessage.OPCMessage.OPCGetMessage.OPCSetMessage.ParserErrorMessage.SEOJMessage.TIDMessage.TID_MAXMessage.TID_SIZEMessage.add_get_property()Message.add_property()Message.add_set_property()Message.all_propertiesMessage.from_addrMessage.get_propertiesMessage.is_response_message()Message.parse_bytes()Message.parse_hexstring()Message.propertiesMessage.set_propertiesMessage.to_addrMessage.to_bytes()Message.to_string()
ObserverPropertySubject
- uecho.util package
Submodules
uecho.const module
uecho.controller module
- class uecho.controller.ControleListener
Bases:
objectControleListener is an abstract listener class to listen to response and announce messages for nodes.
- abstract node_add(node: RemoteNode)
- abstract node_updated(node: RemoteNode)
- abstract object_updated(node: RemoteNode, obj: Object)
- abstract property_updated(node: RemoteNode, obj: Object, prop: Property)
- class uecho.controller.Controller
Bases:
LocalNodeThe Controller and find any devices of Echonet Lite, send any requests to the found devices and receive the responses easily without building the binary protocol messages directly.
- add_listener(listener: ControleListener)
Adds a listener to listen to response and announce messages for nodes.
- Parameters:
listener (ControleListener) – A listener implemented abstract methods of ControleListener.
- announce_message(msg: Message) bool
Posts a multicast message to the same local network asynchronously.
- get_node(addr: str | Tuple[str, int]) RemoteNode | None
Returns the node specified the IP address.
- Parameters:
addr (Union[str, Tuple[str, int]]) – A hostname or an IP address.
- Returns:
Returns the node that is already found by the specified address, otherwise None.
- Return type:
Optional[RemoteNode]
- get_standard_manufacturer(code: int | bytes) Manufacture | None
- get_standard_manufacturer_name(code: int | bytes) str | None
- property nodes: List[RemoteNode]
Retures found nodes.
- Returns:
List[RemoteNode]; The found remote node list.
- post_message(msg: Message, dest: Tuple[str, int] | str | RemoteNode) Message | None
Posts a unicast message to the specified node and return the response message synchronously.
- Parameters:
msg (Message) – The request message.
dest (Union[Tuple[str, int], str, RemoteNode]) – The destination target.
- Returns:
The response message if successful receiving the response message, otherwise None.
- Return type:
Optional[Message]
- remove_listener(listener: ControleListener)
Removes the specified listener.
- Parameters:
listener (ControleListener) – The listener which is already added.
- search() bool
Posts a multicast read request to search all nodes in the same local network asynchronously.
- send_message(msg: Message, dest: Tuple[str, int] | str | RemoteNode) bool
Posts a unicast message to the specified node asynchronously.
- Parameters:
msg (Message) – The request message.
dest (Union[Tuple[str, int], str, RemoteNode]) – The destination target.
- Returns:
True if successful, otherwise False.
- Return type:
bool
- start() bool
Starts the controller to listen to any multicast and unicast messages from other nodes in the same local network, and executes search() after starting.
- stop() bool
Stops the controller not to listen to any messages.
uecho.device module
uecho.esv module
uecho.local_node module
uecho.manufacturer module
uecho.message module
- class uecho.message.Message(msg: Message | None = None)
Bases:
Message- DEOJ: int
- SEOJ: int
- TID: int
- add_get_property(prop: Property | Tuple[int, bytes] | int) bool
Adds the specified property to the message.
- Parameters:
prop (Union[Property, Tuple[int, bytes]]) – The new property. The property code is required, but the property bytes are optional.
- Returns:
Returns True when the specified property is added, Otherwise False.
- Return type:
bool
- add_property(prop: Property | Tuple[int, bytes] | int) bool
Adds the specified property to the message.
- Parameters:
prop (Union[Property, Tuple[int, bytes]]) – The new property. The property code is required, but the property bytes are optional.
- Returns:
Returns True when the specified property is added, Otherwise False.
- Return type:
bool
- add_set_property(prop: Property | Tuple[int, bytes] | int) bool
Adds the specified property to the message.
- Parameters:
prop (Union[Property, Tuple[int, bytes]]) – The new property. The property code is required, but the property bytes are optional.
- Returns:
Returns True when the specified property is added, Otherwise False.
- Return type:
bool
- from_addr: Tuple[str, int] | None
- is_node_profile_message()
- to_addr: Tuple[str, int] | None
uecho.messages module
- class uecho.messages.ReadRequest(DEOJ: int)
Bases:
Message- DEOJ: int
- SEOJ: int
- TID: int
- from_addr: Tuple[str, int] | None
- to_addr: Tuple[str, int] | None
- class uecho.messages.SearchMessage
Bases:
Message- DEOJ: int
- SEOJ: int
- TID: int
- from_addr: Tuple[str, int] | None
- to_addr: Tuple[str, int] | None
- class uecho.messages.WriteReadRequest(DEOJ: int)
Bases:
Message- DEOJ: int
- SEOJ: int
- TID: int
- from_addr: Tuple[str, int] | None
- to_addr: Tuple[str, int] | None
uecho.node module
- class uecho.node.Node(addr: Tuple[str, int] | None = None)
Bases:
object- PORT = 3610
- property address: Tuple[str, int] | None
- get_object(code: int | Tuple[int, int, int]) Object | None
Returns the object specified the code.
- Parameters:
code (Union[str, Tuple[int, int, int]]) – A object code.
- Returns:
Returns the object when the node has the object specified by the code, otherwise None.
- Return type:
Optional[Object]
- has_object(code: int) bool
- property ip: str
- property port: int
- set_address(addr: Tuple[str, int]) bool
uecho.node_profile module
- class uecho.node_profile.NodeProfile
Bases:
Profile- BOOTING = 48
- CLASS_CODE = 240
- CODE = 978945
- FAULT_CONTENT = 137
- FAULT_CONTENT_SIZE = 2
- IDENTIFICATION_MANUFACTURER_CODE_SIZE = 3
- IDENTIFICATION_NUMBER = 131
- IDENTIFICATION_NUMBER_SIZE = 17
- IDENTIFICATION_UNIQUE_ID_SIZE = 13
- INSTANCE_GENERAL_CODE = 1
- INSTANCE_LIST_NOTIFICATION = 213
- INSTANCE_LIST_NOTIFICATION_MAX = 255
- INSTANCE_TRANSMISSION_ONLY_CODE = 2
- LOWER_COMMUNICATION_LAYER_PROTOCOL_TYPE = 254
- NOT_BOOTING = 49
- NUMBER_OF_SELF_NODE_CLASSES = 212
- NUMBER_OF_SELF_NODE_CLASSES_SIZE = 2
- NUMBER_OF_SELF_NODE_INSTANCES = 211
- NUMBER_OF_SELF_NODE_INSTANCES_SIZE = 3
- OPERATING_STATUS = 128
- OPERATING_STATUS_OFF = 49
- OPERATING_STATUS_ON = 48
- OPERATING_STATUS_SIZE = 1
- SELF_NODE_CLASS_LIST_S = 215
- SELF_NODE_CLASS_LIST_S_MAX = 255
- SELF_NODE_INSTANCE_LIST_S = 214
- SELF_NODE_INSTANCE_LIST_S_MAX = 255
- UNIQUE_IDENTIFIER_DATA = 191
- UNIQUE_IDENTIFIER_DATA_SIZE = 2
- VERSION_INFORMATION = 130
- VERSION_INFORMATION_SIZE = 4
- code: int
- name: str
- node: Any | None
uecho.object module
- class uecho.object.Object(code: int | Tuple[int, int] | Tuple[int, int, int] | Any | None = None)
Bases:
objectObject represents a object of ECHONET Lite, and it has child properties that includes the specification attributes and the dynamic data.
- ANNO_PROPERTY_MAP = 157
- ANNO_PROPERTY_MAP_MAX_SIZE = 17
- CODE_MAX = 16777215
- CODE_MIN = 0
- CODE_SIZE = 3
- CODE_UNKNOWN = 0
- GET_PROPERTY_MAP = 159
- GET_PROPERTY_MAP_MAX_SIZE = 17
- MANUFACTURER_CODE = 138
- MANUFACTURER_CODE_SIZE = 3
- MANUFACTURER_EVALUATION_CODE_MAX = 16777215
- MANUFACTURER_EVALUATION_CODE_MIN = 16777200
- MANUFACTURER_UNKNOWN = 16777200
- OPERATING_STATUS = 128
- OPERATING_STATUS_OFF = 49
- OPERATING_STATUS_ON = 48
- OPERATING_STATUS_SIZE = 1
- PROPERTY_MAP_MAX_SIZE = 16
- SET_PROPERTY_MAP = 158
- SET_PROPERTY_MAP_MAX_SIZE = 17
- add_observer(observer) bool
Adds a message observer to the subject.
- Parameters:
Observer (observer) – A message observer.
- Returns:
Returns True when the specified observer is added, Otherwise False.
- Return type:
bool
- property class_code
- code: int
- copy()
- get_property_data(code: int) bytes | None
- property group_code
- has_property(code: int) bool
- property instance_code
- is_class(group_code: int, class_code: int) bool
Checks the object belongs to the specified group and class.
- Parameters:
group_code (int) – A group code.
class_code (int) – A class code.
- Returns:
True if the object belongs to the specified group and class, otherwise False.
- Return type:
bool
- is_code(code: int | Tuple[int, int] | Tuple[int, int, int] | Any) bool
Checks whether the object has the specified code or belongs to the specified tuple code.
- Parameters:
code (Union[int, Tuple[int, int], Tuple[int, int, int], Any]) – A single code or tuple code.
- Returns:
True if the object belongs to the specified code, otherwise False.
- Return type:
bool
- is_group(code: int) bool
Checks the object belongs to the specified group.
- Parameters:
code (int) – A group code.
- Returns:
True if the object belongs to the specified group, otherwise False.
- Return type:
bool
- name: str
- node: Any | None
- post_message(esv: int, props: List[Tuple[int, bytes]]) Any | None
Posts a unicast message to the specified property asynchronously.
- Parameters:
esv (int) – A service type of ECHONET Lite.
props (List[Tuple[int, bytes]]) – List of a request property tuple (property code, property data).
- Returns:
The response message if successful receiving the response message, otherwise None.
- Return type:
Optional[Message]
- send_message(esv: int, props: List[Tuple[int, bytes]]) bool
Sends a unicast message to the specified property asynchronously.
- Parameters:
esv (int) – A service type of ECHONET Lite.
props (List[Tuple[int, bytes]]) – List of a request property tuple (property code, property data).
- Returns:
True if successful, otherwise False.
- Return type:
bool
- set_code(code: int | Tuple[int, int] | Tuple[int, int, int] | Any) bool
Sets the spcecified code as the object code.
- Parameters:
code (Union[int, Tuple[int, int], Tuple[int, int, int], Any]) – A code or tuple code.
- Returns:
True if the specified code is valid, otherwise False.
- Return type:
bool
- set_property_data(code: int, data: bytes) bool
- set_property_integer(code: int, data: int, size: int) bool
- set_property_string(code: int, data: str) bool
- set_request_handler(listener: ObjectRequestHandler) bool
Sets a ObjectRequestHandler to handle read and write requests from other controllers and devices.
- Parameters:
listener (ObjectRequestHandler) – The listener that handles read and write requests from other controllers and devices.
- class uecho.object.ObjectRequestHandler
Bases:
objectObjectRequestHandler is an abstract handler class to handle to request messages to a device.
- abstract property_read_requested(prop: Property) bool
Handles a read request message, and updates the propery data if needed.
- Parameters:
prop (Property) – The target property.
- Returns:
True if allowed the access, otherwise False.
- Return type:
bool
- abstract property_write_requested(prop: Property, data: bytes) bool
Handles a write request message, and updates the propery data by the specified data if allowed.
- Parameters:
prop (Property) – The target property.
data (bytes) – The update data.
- Returns:
True if allowed the update, otherwise False.
- Return type:
bool
uecho.option module
uecho.profile module
- class uecho.profile.Profile(code: int | Tuple[int, int] | Tuple[int, int, int] | Any | None = None)
Bases:
SuperObject- code: int
- name: str
- node: Any | None
- set_code(code: int | Tuple[int, int] | Tuple[int, int, int] | Any) bool
Sets the spcecified code as the object code.
- Parameters:
code (Union[int, Tuple[int, int], Tuple[int, int, int], Any]) – A code or tuple code.
- Returns:
True if the specified code is valid, otherwise False.
- Return type:
bool
uecho.property module
- class uecho.property.Property(code: int = 0, data: bytes = b'')
Bases:
PropertyProperty represents a property of ECHONET Lite, and it includes the specification attributes and the dynamic data.
- ANNO = 2
- CODE_MAX = 255
- CODE_MIN = 128
- GET = 0
- OPTIONAL = 2
- PROHIBITED = 0
- PROPERTYMAP_FORMAT1_MAX_SIZE = 15
- PROPERTYMAP_FORMAT2_MAP_SIZE = 16
- PROPERTYMAP_FORMAT_MAX_SIZE = 17
- REQUIRED = 1
- SET = 1
- anno_status: bool
- attrs: List[int]
- property bytes
- copy()
- get_attribute(typ: int) int
- is_announce_enabled() bool
- is_announce_required() bool
- is_mandatory() bool
- is_read_enabled() bool
- is_read_required() bool
- is_write_enabled() bool
- is_write_required() bool
- name: str
- property number
- object: Any | None
- post_message(esv: int, data: bytes = bytearray(b'')) Message | None
Posts a unicast message to the property and return the response message synchronously.
- Parameters:
esv (int) – A service type of ECHONET Lite.
data (bytes, optional) – A property data. Defaults to bytearray().
- Returns:
The response message if successful receiving the response message, otherwise None.
- Return type:
Optional[Message]
- property property_map_codes
- send_message(esv: int, data: bytes = bytearray(b'')) bool
Sends a unicast message to the property asynchronously.
- Parameters:
esv (int) – A service type of ECHONET Lite.
data (bytes, optional) – : A property data. Defaults to bytearray().
- Returns:
True if successful, otherwise False.
- Return type:
bool
- set_attribute(typ: int, attr: int)
- size: int
- uecho.property.is_propertymap_description_format1(n: int) bool
- uecho.property.is_propertymap_description_format2(n: int) bool
uecho.remote_node module
Module contents
- class uecho.Controller
Bases:
LocalNodeThe Controller and find any devices of Echonet Lite, send any requests to the found devices and receive the responses easily without building the binary protocol messages directly.
- add_listener(listener: ControleListener)
Adds a listener to listen to response and announce messages for nodes.
- Parameters:
listener (ControleListener) – A listener implemented abstract methods of ControleListener.
- announce_message(msg: Message) bool
Posts a multicast message to the same local network asynchronously.
- get_node(addr: str | Tuple[str, int]) RemoteNode | None
Returns the node specified the IP address.
- Parameters:
addr (Union[str, Tuple[str, int]]) – A hostname or an IP address.
- Returns:
Returns the node that is already found by the specified address, otherwise None.
- Return type:
Optional[RemoteNode]
- get_standard_manufacturer(code: int | bytes) Manufacture | None
- get_standard_manufacturer_name(code: int | bytes) str | None
- property nodes: List[RemoteNode]
Retures found nodes.
- Returns:
List[RemoteNode]; The found remote node list.
- post_message(msg: Message, dest: Tuple[str, int] | str | RemoteNode) Message | None
Posts a unicast message to the specified node and return the response message synchronously.
- Parameters:
msg (Message) – The request message.
dest (Union[Tuple[str, int], str, RemoteNode]) – The destination target.
- Returns:
The response message if successful receiving the response message, otherwise None.
- Return type:
Optional[Message]
- remove_listener(listener: ControleListener)
Removes the specified listener.
- Parameters:
listener (ControleListener) – The listener which is already added.
- search() bool
Posts a multicast read request to search all nodes in the same local network asynchronously.
- send_message(msg: Message, dest: Tuple[str, int] | str | RemoteNode) bool
Posts a unicast message to the specified node asynchronously.
- Parameters:
msg (Message) – The request message.
dest (Union[Tuple[str, int], str, RemoteNode]) – The destination target.
- Returns:
True if successful, otherwise False.
- Return type:
bool
- start() bool
Starts the controller to listen to any multicast and unicast messages from other nodes in the same local network, and executes search() after starting.
- stop() bool
Stops the controller not to listen to any messages.
- class uecho.Device(code: int | Tuple[int, int] | Tuple[int, int, int] | Any)
Bases:
StandardObject- code: int
- name: str
- node: Any | None
- class uecho.LocalNode
Bases:
Node- add_observer(observer)
- is_enabled(opt: int) bool
- set_enabled(opt: int, v: bool) bool
- start(ifaddrs: List[str] = []) bool
- stop() bool
- class uecho.Message(msg: Message | None = None)
Bases:
Message- DEOJ: int
- SEOJ: int
- TID: int
- add_get_property(prop: Property | Tuple[int, bytes] | int) bool
Adds the specified property to the message.
- Parameters:
prop (Union[Property, Tuple[int, bytes]]) – The new property. The property code is required, but the property bytes are optional.
- Returns:
Returns True when the specified property is added, Otherwise False.
- Return type:
bool
- add_property(prop: Property | Tuple[int, bytes] | int) bool
Adds the specified property to the message.
- Parameters:
prop (Union[Property, Tuple[int, bytes]]) – The new property. The property code is required, but the property bytes are optional.
- Returns:
Returns True when the specified property is added, Otherwise False.
- Return type:
bool
- add_set_property(prop: Property | Tuple[int, bytes] | int) bool
Adds the specified property to the message.
- Parameters:
prop (Union[Property, Tuple[int, bytes]]) – The new property. The property code is required, but the property bytes are optional.
- Returns:
Returns True when the specified property is added, Otherwise False.
- Return type:
bool
- from_addr: Tuple[str, int] | None
- is_node_profile_message()
- to_addr: Tuple[str, int] | None
- class uecho.Node(addr: Tuple[str, int] | None = None)
Bases:
object- PORT = 3610
- property address: Tuple[str, int] | None
- get_object(code: int | Tuple[int, int, int]) Object | None
Returns the object specified the code.
- Parameters:
code (Union[str, Tuple[int, int, int]]) – A object code.
- Returns:
Returns the object when the node has the object specified by the code, otherwise None.
- Return type:
Optional[Object]
- has_object(code: int) bool
- property ip: str
- property port: int
- set_address(addr: Tuple[str, int]) bool
- class uecho.NodeProfile
Bases:
Profile- BOOTING = 48
- CLASS_CODE = 240
- CODE = 978945
- FAULT_CONTENT = 137
- FAULT_CONTENT_SIZE = 2
- IDENTIFICATION_MANUFACTURER_CODE_SIZE = 3
- IDENTIFICATION_NUMBER = 131
- IDENTIFICATION_NUMBER_SIZE = 17
- IDENTIFICATION_UNIQUE_ID_SIZE = 13
- INSTANCE_GENERAL_CODE = 1
- INSTANCE_LIST_NOTIFICATION = 213
- INSTANCE_LIST_NOTIFICATION_MAX = 255
- INSTANCE_TRANSMISSION_ONLY_CODE = 2
- LOWER_COMMUNICATION_LAYER_PROTOCOL_TYPE = 254
- NOT_BOOTING = 49
- NUMBER_OF_SELF_NODE_CLASSES = 212
- NUMBER_OF_SELF_NODE_CLASSES_SIZE = 2
- NUMBER_OF_SELF_NODE_INSTANCES = 211
- NUMBER_OF_SELF_NODE_INSTANCES_SIZE = 3
- OPERATING_STATUS = 128
- OPERATING_STATUS_OFF = 49
- OPERATING_STATUS_ON = 48
- OPERATING_STATUS_SIZE = 1
- SELF_NODE_CLASS_LIST_S = 215
- SELF_NODE_CLASS_LIST_S_MAX = 255
- SELF_NODE_INSTANCE_LIST_S = 214
- SELF_NODE_INSTANCE_LIST_S_MAX = 255
- UNIQUE_IDENTIFIER_DATA = 191
- UNIQUE_IDENTIFIER_DATA_SIZE = 2
- VERSION_INFORMATION = 130
- VERSION_INFORMATION_SIZE = 4
- code: int
- name: str
- node: Any | None
- class uecho.Object(code: int | Tuple[int, int] | Tuple[int, int, int] | Any | None = None)
Bases:
objectObject represents a object of ECHONET Lite, and it has child properties that includes the specification attributes and the dynamic data.
- ANNO_PROPERTY_MAP = 157
- ANNO_PROPERTY_MAP_MAX_SIZE = 17
- CODE_MAX = 16777215
- CODE_MIN = 0
- CODE_SIZE = 3
- CODE_UNKNOWN = 0
- GET_PROPERTY_MAP = 159
- GET_PROPERTY_MAP_MAX_SIZE = 17
- MANUFACTURER_CODE = 138
- MANUFACTURER_CODE_SIZE = 3
- MANUFACTURER_EVALUATION_CODE_MAX = 16777215
- MANUFACTURER_EVALUATION_CODE_MIN = 16777200
- MANUFACTURER_UNKNOWN = 16777200
- OPERATING_STATUS = 128
- OPERATING_STATUS_OFF = 49
- OPERATING_STATUS_ON = 48
- OPERATING_STATUS_SIZE = 1
- PROPERTY_MAP_MAX_SIZE = 16
- SET_PROPERTY_MAP = 158
- SET_PROPERTY_MAP_MAX_SIZE = 17
- add_observer(observer) bool
Adds a message observer to the subject.
- Parameters:
Observer (observer) – A message observer.
- Returns:
Returns True when the specified observer is added, Otherwise False.
- Return type:
bool
- property class_code
- code: int
- copy()
- get_property_data(code: int) bytes | None
- property group_code
- has_property(code: int) bool
- property instance_code
- is_class(group_code: int, class_code: int) bool
Checks the object belongs to the specified group and class.
- Parameters:
group_code (int) – A group code.
class_code (int) – A class code.
- Returns:
True if the object belongs to the specified group and class, otherwise False.
- Return type:
bool
- is_code(code: int | Tuple[int, int] | Tuple[int, int, int] | Any) bool
Checks whether the object has the specified code or belongs to the specified tuple code.
- Parameters:
code (Union[int, Tuple[int, int], Tuple[int, int, int], Any]) – A single code or tuple code.
- Returns:
True if the object belongs to the specified code, otherwise False.
- Return type:
bool
- is_group(code: int) bool
Checks the object belongs to the specified group.
- Parameters:
code (int) – A group code.
- Returns:
True if the object belongs to the specified group, otherwise False.
- Return type:
bool
- name: str
- node: Any | None
- post_message(esv: int, props: List[Tuple[int, bytes]]) Any | None
Posts a unicast message to the specified property asynchronously.
- Parameters:
esv (int) – A service type of ECHONET Lite.
props (List[Tuple[int, bytes]]) – List of a request property tuple (property code, property data).
- Returns:
The response message if successful receiving the response message, otherwise None.
- Return type:
Optional[Message]
- send_message(esv: int, props: List[Tuple[int, bytes]]) bool
Sends a unicast message to the specified property asynchronously.
- Parameters:
esv (int) – A service type of ECHONET Lite.
props (List[Tuple[int, bytes]]) – List of a request property tuple (property code, property data).
- Returns:
True if successful, otherwise False.
- Return type:
bool
- set_code(code: int | Tuple[int, int] | Tuple[int, int, int] | Any) bool
Sets the spcecified code as the object code.
- Parameters:
code (Union[int, Tuple[int, int], Tuple[int, int, int], Any]) – A code or tuple code.
- Returns:
True if the specified code is valid, otherwise False.
- Return type:
bool
- set_property_data(code: int, data: bytes) bool
- set_property_integer(code: int, data: int, size: int) bool
- set_property_string(code: int, data: str) bool
- set_request_handler(listener: ObjectRequestHandler) bool
Sets a ObjectRequestHandler to handle read and write requests from other controllers and devices.
- Parameters:
listener (ObjectRequestHandler) – The listener that handles read and write requests from other controllers and devices.
- class uecho.ObjectRequestHandler
Bases:
objectObjectRequestHandler is an abstract handler class to handle to request messages to a device.
- abstract property_read_requested(prop: Property) bool
Handles a read request message, and updates the propery data if needed.
- Parameters:
prop (Property) – The target property.
- Returns:
True if allowed the access, otherwise False.
- Return type:
bool
- abstract property_write_requested(prop: Property, data: bytes) bool
Handles a write request message, and updates the propery data by the specified data if allowed.
- Parameters:
prop (Property) – The target property.
data (bytes) – The update data.
- Returns:
True if allowed the update, otherwise False.
- Return type:
bool
- class uecho.Profile(code: int | Tuple[int, int] | Tuple[int, int, int] | Any | None = None)
Bases:
SuperObject- code: int
- name: str
- node: Any | None
- set_code(code: int | Tuple[int, int] | Tuple[int, int, int] | Any) bool
Sets the spcecified code as the object code.
- Parameters:
code (Union[int, Tuple[int, int], Tuple[int, int, int], Any]) – A code or tuple code.
- Returns:
True if the specified code is valid, otherwise False.
- Return type:
bool
- class uecho.Property(code: int = 0, data: bytes = b'')
Bases:
PropertyProperty represents a property of ECHONET Lite, and it includes the specification attributes and the dynamic data.
- ANNO = 2
- CODE_MAX = 255
- CODE_MIN = 128
- GET = 0
- OPTIONAL = 2
- PROHIBITED = 0
- PROPERTYMAP_FORMAT1_MAX_SIZE = 15
- PROPERTYMAP_FORMAT2_MAP_SIZE = 16
- PROPERTYMAP_FORMAT_MAX_SIZE = 17
- REQUIRED = 1
- SET = 1
- anno_status: bool
- attrs: List[int]
- property bytes
- code: int
- copy()
- data: bytes
- get_attribute(typ: int) int
- is_announce_enabled() bool
- is_announce_required() bool
- is_mandatory() bool
- is_read_enabled() bool
- is_read_required() bool
- is_write_enabled() bool
- is_write_required() bool
- name: str
- property number
- object: Any | None
- post_message(esv: int, data: bytes = bytearray(b'')) Message | None
Posts a unicast message to the property and return the response message synchronously.
- Parameters:
esv (int) – A service type of ECHONET Lite.
data (bytes, optional) – A property data. Defaults to bytearray().
- Returns:
The response message if successful receiving the response message, otherwise None.
- Return type:
Optional[Message]
- property property_map_codes
- send_message(esv: int, data: bytes = bytearray(b'')) bool
Sends a unicast message to the property asynchronously.
- Parameters:
esv (int) – A service type of ECHONET Lite.
data (bytes, optional) – : A property data. Defaults to bytearray().
- Returns:
True if successful, otherwise False.
- Return type:
bool
- set_attribute(typ: int, attr: int)
- size: int
- class uecho.ReadRequest(DEOJ: int)
Bases:
Message- DEOJ: int
- SEOJ: int
- TID: int
- from_addr: Tuple[str, int] | None
- to_addr: Tuple[str, int] | None
- class uecho.SearchMessage
Bases:
Message- DEOJ: int
- SEOJ: int
- TID: int
- from_addr: Tuple[str, int] | None
- to_addr: Tuple[str, int] | None
- class uecho.SuperObject(code: int | Tuple[int, int] | Tuple[int, int, int] | Any | None = None)
Bases:
Object- CODE = 0
- code: int
- name: str
- node: Any | None
- class uecho.WriteReadRequest(DEOJ: int)
Bases:
Message- DEOJ: int
- SEOJ: int
- TID: int
- from_addr: Tuple[str, int] | None
- to_addr: Tuple[str, int] | None