python library for the zigate gateway (zigbee) http://zigate.fr
Project description
# zigate
python library for zigate http://zigate.fr/
This library manage communication between python and zigate key, both USB and WiFi key are supported (wifi is almost untested)
Usage :
```
# if you want logging
import logging
logging.basicConfig()
logging.root.setLevel(logging.DEBUG)
import zigate
z = zigate.ZiGate(port=None) # Leave None to auto-discover the port
>>> print(z.get_version())
OrderedDict([('major', 1), ('installer', '30b'), ('rssi', 0), ('version', '3.0b')])
>>> print(z.get_version_text())
3.0b
# refresh devices list
z.get_devices_list()
# start inclusion mode
>>> z.permit_join()
>>> z.is_permitting_join()
True
# list devices
>>> z.devices
[Device 677c , Device b8ce , Device 92a7 , Device 59ef ]
>>> z.devices[0].addr
'677c'
# get all discovered endpoints
>>> z.devices[0].endpoints
{1: {'0405_0000': {'endpoint': 1,
'data': 3997,
'cluster': 1029,
'attribute': 0,
'status': 0,
'friendly_name': 'humidity',
'value': 39.97,
'unit': '%'},
'0000_0005': {'endpoint': 1,
'data': '6c756d692e77656174686572',
'cluster': 0,
'attribute': 5,
'status': 0,
'friendly_name': 'type',
'value': 'lumi.weather',
'unit': ''},
'0000_0001': {'cluster': 0,
'endpoint': 1,
'status': 0,
'attribute': 1,
'data': 3},
'0403_0000': {'endpoint': 1,
'data': 976,
'cluster': 1027,
'attribute': 0,
'status': 0,
'friendly_name': 'pressure',
'value': 976,
'unit': 'mb'},
'0000_ff01': {'cluster': 0,
'endpoint': 1,
'status': 0,
'attribute': 65281,
'data': '0121ef0b0421a81305210800062401000000006429a6096521a30f662b737d01000a210000'},
'0403_0010': {'endpoint': 1,
'data': 9762,
'cluster': 1027,
'attribute': 16,
'status': 0,
'friendly_name': 'detailled pressure',
'value': 976.2,
'unit': 'mb'},
'0403_0014': {'cluster': 1027,
'endpoint': 1,
'status': 0,
'attribute': 20,
'data': -1},
'0402_0000': {'endpoint': 1,
'data': 2447,
'cluster': 1026,
'attribute': 0,
'status': 0,
'friendly_name': 'temperature',
'value': 24.47,
'unit': '°C'}}}
get well known attributes
>>> for attribute in z.devices[0].properties:
print(attribute)
{'endpoint': 1, 'data': 3997, 'cluster': 1029, 'attribute': 0, 'status': 0, 'friendly_name': 'humidity', 'value': 39.97, 'unit': '%'}
{'endpoint': 1, 'data': '6c756d692e77656174686572', 'cluster': 0, 'attribute': 5, 'status': 0, 'friendly_name': 'type', 'value': 'lumi.weather', 'unit': ''}
{'endpoint': 1, 'data': 976, 'cluster': 1027, 'attribute': 0, 'status': 0, 'friendly_name': 'pressure', 'value': 976, 'unit': 'mb'}
{'endpoint': 1, 'data': 9762, 'cluster': 1027, 'attribute': 16, 'status': 0, 'friendly_name': 'detailled pressure', 'value': 976.2, 'unit': 'mb'}
{'endpoint': 1, 'data': 2447, 'cluster': 1026, 'attribute': 0, 'status': 0, 'friendly_name': 'temperature', 'value': 24.47, 'unit': '°C'}
# get specific property
>>> z.devices[0].get_property('temperature')
{'endpoint': 1,
'data': 2447,
'cluster': 1026,
'attribute': 0,
'status': 0,
'friendly_name': 'temperature',
'value': 24.47,
'unit': '°C'}
```
You can use callback to catch some events
```
def my_callback(event, **kwargs):
print(event)
print(kwargs)
z = ZiGate(callback=my_callback)
```
event can be :
zigate.ZGT_CMD_NEW_DEVICE = 'new_device'
zigate.ZGT_CMD_DEVICE_UPDATE = 'device_update'
zigate.ZGT_CMD_REMOVE_DEVICE = 'remove_device'
kwargs depends of the event type
for zigate.ZGT_CMD_NEW_DEVICE:
kwargs contains device
for zigate.ZGT_CMD_DEVICE_UPDATE
kwargs contains device
and attribute updated (if applicable)
for zigate.ZGT_CMD_REMOVE_DEVICE
kwargs contains addr (the device short address)
Wifi ZiGate:
```
import zigate
z = zigate.ZiGateWiFi(host='192.168.0.10', port=9999)
print(z.get_version())
# list devices
z.devices
# start inclusion mode
z.permit_join()
```
python library for zigate http://zigate.fr/
This library manage communication between python and zigate key, both USB and WiFi key are supported (wifi is almost untested)
Usage :
```
# if you want logging
import logging
logging.basicConfig()
logging.root.setLevel(logging.DEBUG)
import zigate
z = zigate.ZiGate(port=None) # Leave None to auto-discover the port
>>> print(z.get_version())
OrderedDict([('major', 1), ('installer', '30b'), ('rssi', 0), ('version', '3.0b')])
>>> print(z.get_version_text())
3.0b
# refresh devices list
z.get_devices_list()
# start inclusion mode
>>> z.permit_join()
>>> z.is_permitting_join()
True
# list devices
>>> z.devices
[Device 677c , Device b8ce , Device 92a7 , Device 59ef ]
>>> z.devices[0].addr
'677c'
# get all discovered endpoints
>>> z.devices[0].endpoints
{1: {'0405_0000': {'endpoint': 1,
'data': 3997,
'cluster': 1029,
'attribute': 0,
'status': 0,
'friendly_name': 'humidity',
'value': 39.97,
'unit': '%'},
'0000_0005': {'endpoint': 1,
'data': '6c756d692e77656174686572',
'cluster': 0,
'attribute': 5,
'status': 0,
'friendly_name': 'type',
'value': 'lumi.weather',
'unit': ''},
'0000_0001': {'cluster': 0,
'endpoint': 1,
'status': 0,
'attribute': 1,
'data': 3},
'0403_0000': {'endpoint': 1,
'data': 976,
'cluster': 1027,
'attribute': 0,
'status': 0,
'friendly_name': 'pressure',
'value': 976,
'unit': 'mb'},
'0000_ff01': {'cluster': 0,
'endpoint': 1,
'status': 0,
'attribute': 65281,
'data': '0121ef0b0421a81305210800062401000000006429a6096521a30f662b737d01000a210000'},
'0403_0010': {'endpoint': 1,
'data': 9762,
'cluster': 1027,
'attribute': 16,
'status': 0,
'friendly_name': 'detailled pressure',
'value': 976.2,
'unit': 'mb'},
'0403_0014': {'cluster': 1027,
'endpoint': 1,
'status': 0,
'attribute': 20,
'data': -1},
'0402_0000': {'endpoint': 1,
'data': 2447,
'cluster': 1026,
'attribute': 0,
'status': 0,
'friendly_name': 'temperature',
'value': 24.47,
'unit': '°C'}}}
get well known attributes
>>> for attribute in z.devices[0].properties:
print(attribute)
{'endpoint': 1, 'data': 3997, 'cluster': 1029, 'attribute': 0, 'status': 0, 'friendly_name': 'humidity', 'value': 39.97, 'unit': '%'}
{'endpoint': 1, 'data': '6c756d692e77656174686572', 'cluster': 0, 'attribute': 5, 'status': 0, 'friendly_name': 'type', 'value': 'lumi.weather', 'unit': ''}
{'endpoint': 1, 'data': 976, 'cluster': 1027, 'attribute': 0, 'status': 0, 'friendly_name': 'pressure', 'value': 976, 'unit': 'mb'}
{'endpoint': 1, 'data': 9762, 'cluster': 1027, 'attribute': 16, 'status': 0, 'friendly_name': 'detailled pressure', 'value': 976.2, 'unit': 'mb'}
{'endpoint': 1, 'data': 2447, 'cluster': 1026, 'attribute': 0, 'status': 0, 'friendly_name': 'temperature', 'value': 24.47, 'unit': '°C'}
# get specific property
>>> z.devices[0].get_property('temperature')
{'endpoint': 1,
'data': 2447,
'cluster': 1026,
'attribute': 0,
'status': 0,
'friendly_name': 'temperature',
'value': 24.47,
'unit': '°C'}
```
You can use callback to catch some events
```
def my_callback(event, **kwargs):
print(event)
print(kwargs)
z = ZiGate(callback=my_callback)
```
event can be :
zigate.ZGT_CMD_NEW_DEVICE = 'new_device'
zigate.ZGT_CMD_DEVICE_UPDATE = 'device_update'
zigate.ZGT_CMD_REMOVE_DEVICE = 'remove_device'
kwargs depends of the event type
for zigate.ZGT_CMD_NEW_DEVICE:
kwargs contains device
for zigate.ZGT_CMD_DEVICE_UPDATE
kwargs contains device
and attribute updated (if applicable)
for zigate.ZGT_CMD_REMOVE_DEVICE
kwargs contains addr (the device short address)
Wifi ZiGate:
```
import zigate
z = zigate.ZiGateWiFi(host='192.168.0.10', port=9999)
print(z.get_version())
# list devices
z.devices
# start inclusion mode
z.permit_join()
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
zigate-0.6.0.tar.gz
(13.0 kB
view details)
Built Distribution
zigate-0.6.0-py3-none-any.whl
(16.9 kB
view details)
File details
Details for the file zigate-0.6.0.tar.gz
.
File metadata
- Download URL: zigate-0.6.0.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4cdc7b19e0238f50a9ae9047725c4940a6c7d5b293dc1b4617de6905c57d8f3f |
|
MD5 | 5d182d7048a77402a817870ff1f13139 |
|
BLAKE2b-256 | 52d3e1febc296a7fb6f5256b2547ec30055de30af1be53aec5d3025eed3f5411 |
Provenance
File details
Details for the file zigate-0.6.0-py3-none-any.whl
.
File metadata
- Download URL: zigate-0.6.0-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ff059f5a6953789eaf3e0c58bd336f3b037e3daa125d283b8e32be7fa215f00 |
|
MD5 | 3445f62a34a2f2a075144a2e96431e08 |
|
BLAKE2b-256 | eb83f561befa155d086a483a8a2589430bb23318192c5d4c20daef3007e3af34 |