Comments (7)
zigpy
is stable. zigpy-znp
is also somewhat stable but since few people use it right now, I can't guarantee you won't encounter any bugs.
from zigpy-znp.
There's no documentation for things like that. You would need to write your own application on top of zigpy-znp similar to bellows cli implementation
from zigpy-znp.
Using zigpy
directly is unfortunately undocumented but the interface will be the same regardless of what radio hardware you use. This code is completely untested and probably won't work but it should get you started:
import asyncio
import logging
import coloredlogs
import zigpy_znp.types as t
import zigpy_znp.commands as c
# There are many different radio libraries but they all have the same API
from zigpy_znp.zigbee.application import ControllerApplication
coloredlogs.install(level=logging.DEBUG)
logging.getLogger('zigpy_znp').setLevel(logging.DEBUG)
LOGGER = logging.getLogger(__name__)
class MainListener:
'''
Contains callbacks that zigpy will call whenever something happens.
Look for `listener_event` in the Zigpy source or just look at the logged warnings.
'''
def __init__(self, application):
self.application = application
def device_joined(self, device):
asyncio.create_task(self.async_device_joined(device))
async def async_device_joined(self, device):
LOGGER.info("Device joined: %s", device)
for endpoint_id, endpoint in device.endpoints.items():
# If it's a proper motion sensor, it probably has an IAS Zone cluster
# that you need to bind to before it does anything.
#
# If it's a Xiaomi motion sensor, it'll just send attribute updates.
if not hasattr(endpoint, 'ias_zone'):
continue
endpoint.ias_zone.add_context_listener(self)
await endpoint.ias_zone.bind()
await endpoint.ias_zone.write_attributes({'cie_addr': self.application.ieee})
await endpoint.ias_zone.enroll_response(0x00, 0x00)
def attribute_updated(self, device, cluster, attribute_id, value):
# This is where you'll receive attribute updates
LOGGER.info("Received an attribute update %s=%s on cluster %s from device %s",
attribute_id, value, cluster, device)
async def main():
app = ControllerApplication(ControllerApplication.SCHEMA({
'database_path': '/path/to/zigbee.db',
'device': {
'path': '/dev/serial/by-id/your-serial-port',
}
}))
listener = MainListener(app)
app.add_listener(listener)
await app.startup(auto_form=True)
# Permit joins for a minute
await app.permit(60)
await asyncio.sleep(60)
# Just run forever
while True:
asyncio.sleep(10000)
if __name__ == '__main__':
await asyncio.run(main())
from zigpy-znp.
some primer on zigbee https://github.com/MarkDing/IoT-Developer-Boot-Camp/wiki/Zigbee-Boot-Camp
from zigpy-znp.
Ok thanks for the great info! So basically this module is still in an early phase of development and not quite suited for my needs right?
from zigpy-znp.
I'm closing this issue for now since it doesn't directly relate to zigpy-znp, but feel free to comment if you need any help using zigpy on its own.
from zigpy-znp.
@Mopele Please consider contributing to the discussions in zigpy/zigpy#471 and zigpy/zigpy#477
from zigpy-znp.
Related Issues (20)
- OTA for Texas Instruments CC1352/CC2652, Z-Stack HOT 7
- Unable to start zigpy-znp HOT 5
- (zigpy_znp.__version__) not available HOT 3
- Dubious licensing HOT 2
- Various failing tests with zigpy==0.54.0 HOT 1
- Dependencies are unclear to me - Docker /alpine/v3.16 HOT 2
- timeout error when read CC2652 Sonoff dongle HOT 1
- Unable to form network - No module named form_network HOT 2
- zigpy_znp.tools.network_backup fails with asyncio.exceptions.CancelledError on SkyConnect HOT 5
- Develco Products "ZigBee Wallplug HA SP2" unsupported frame
- test_on_af_message_callback fails with zigpy==0.59.0
- Unable to pair devices HOT 13
- Better Error Reporting HOT 5
- command "zigpy_znp.tools.nvram_read" Timeout
- `zigpy_znp.tools.network_restore` fails with `AttributeError` HOT 2
- CC2674 (CC2674P/CC2674R) and CC1354 (CC1354P) Zigbee Coordinator compatibility with with zigpy-znp? HOT 1
- MotionSensor detected but stuck at configuration within HomeAssistant (ZHA) HOT 1
- Failed OSALNVReadExt request HOT 3
- '<' not supported between instances of 'ZigbeePacket' and 'ZigbeePacket' HOT 3
- setuptools-git-versioning < 2 still needed? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zigpy-znp.