aqara_msg_push
SDK for Aqara Message Push
Package has
- Pydantic models for Message Push Format
- function for mapping custom json from message queue to Pydantic model
- Simple consumer for RocketMQ with Aqara confiquration
Install
Library installs with command:
pip install aqara-msg-push
For consuming you will also need:
- rocketmq-client-python - tiny python lib - python wrapper for cpp lib
- librocketmq - cpp lib (for installation guide check rocketmq-client-python README.md)
Example of Usage:
from aqara_msg_push import MessageConsumer, TopLevelMessage
from rocketmq.client import ReceivedMessage, ConsumeStatus
# Your params from https://developer.aqara.com/console/overview
ADDRESS = 'some-broker1.aqara.com:9876'
TOPIC = '99...99'
GROUP_ID = '99..ce'
ACCESS_KEY = 'K....'
SECRET_KEY = 'nt..jg'
KEY_ID = ACCESS_KEY
class MyMessageConsumer(MessageConsumer):
def callback(self, obj: TopLevelMessage, raw_msg: ReceivedMessage) -> ConsumeStatus:
print(type(obj), obj.data)
return ConsumeStatus.CONSUME_SUCCESS
MyMessageConsumer(
group_id=GROUP_ID,
access_key=ACCESS_KEY,
secret_key=SECRET_KEY,
topic=TOPIC,
address=ADDRESS,
).consume()
"""
Output:
<class 'aqara_msg_push.schema.toplevel.DeviceAttributeMessage'> [DeviceStateMessage(raw_time='1659704748378', subject_id='lumi.9999999', resource_id='4.1.85', value='1', status_code=<TriggerResult.SUCCESS: 0>, trigger_source=TriggerSource(raw_time='1659704748', type=<TriggerType.CLOUD_REMOTE_COMMAND_CONTROL: 4>, id=None), attach=None)]
<class 'aqara_msg_push.schema.toplevel.DeviceAttributeMessage'> [DeviceStateMessage(raw_time='1659704750046', subject_id='lumi.9999999', resource_id='4.1.85', value='0', status_code=<TriggerResult.SUCCESS: 0>, trigger_source=TriggerSource(raw_time='1659704749', type=<TriggerType.CLOUD_REMOTE_COMMAND_CONTROL: 4>, id=None), attach=None)]
"""
Metadata
Release files for aqara-msg-push 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aqara_msg_push-1.0.2-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for aqara_msg_push-1.0.2-py2.py3-none-any.whl |
Release files / aqara_msg_push-1.0.2-py2.py3-none-any.whl
| Download URL | aqara_msg_push-1.0.2-py2.py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
e3a9c3b1df1cca6ccb7d119f9a265a3ebc9916a21e1d0c911312997ef8d2a456
|
|
BLAKE2b-256 checksum How to use checksums |
23644ba5eccb6250bfbbb5664e204471b76b2184e639b6e484a769bd02360dff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Security for aqara-msg-push 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.