Python library for interfacing with konke smart appliances
Project description
PyKongke
This is a maintained fork of KonkeIO for controlling Konke LAN smart devices.
Original project: jedmeng/python-konkeio. This fork keeps the GPLv3 license and continues maintenance under the pykongke package name.
This library (and its accompanying cli tool) is used to interface with
Konke remote-control devices.
Supported Devices
Since some of Konke's device does not have a clear model, I used internal code to identify it.
Socket
- Smart Plug K
k1 - K2 / K2 Pro
k2 - Mini K / Mini Pro
minik
Power Strip
- The normal one
micmul - The Standing one with USB support
mul
Light
- KLight (LED with RGB color)
klight - KBulb
kbulb
Install
pip install pykongke
Python 3.7+ is required.
For development and tests:
python -m pip install -e ".[test]"
python -m pytest -q -s
API Reference
classes and methods
- K1(ip)
- is_online
- status
- update()
- turn_on()
- turn_off()
- K2(ip)
- is_online
- status
- update()
- turn_on()
- turn_off()
- turn_on_usb()
- turn_off_usb()
- turn_on_light()
- turn_off_light()
- get_power()
- is_support_ir()
- ir_learn()
- ir_quit()
- ir_emit()
- ir_remove()
- ir_remove_group()
- is_support_rf()
- rf_learn()
- rf_quit()
- rf_emit()
- rf_remove()
- rf_remove_group()
- MiniK(ip)
- is_online
- status
- update()
- turn_on()
- turn_off()
- is_support_ir()
- ir_learn()
- ir_quit()
- ir_emit()
- ir_remove()
- ir_remove_group()
- Mul(ip)
- is_online
- status[]
- usb_status[]
- update()
- turn_on(index)
- turn_off(index)
- turn_on_all()
- turn_off_all()
- turn_on_usb(index)
- turn_off_usb(index)
- MicMul(ip)
- is_online
- status[]
- update()
- turn_on(index)
- turn_off(index)
- turn_on_all()
- turn_off_all()
- KLight(ip)
- is_online
- status
- color
- brightness
- update()
- turn_on()
- turn_off()
- set_color()
- set_brightness()
- KBulb
- is_online
- status
- ct
- brightness
- update()
- turn_on()
- turn_off()
- set_ct()
- set_brightness()
Demo:
import asyncio
from pykongke import K2
async def main():
k2 = K2("192.168.0.222")
await k2.update()
if not k2.is_online:
print("switch is off line")
return
if k2.status == 'open':
await k2.turn_off()
elif k2.status == 'close':
await k2.turn_on()
asyncio.run(main())
CLI Command
usage: pykongke [action] [device] [address] [value] [--verbose]
Supported devices and actions supported by each device:
global: search help
k2: get_status turn_[on/off] get_usb_status turn_[on/off]_usb get_light_status turn_[on/off]_light get_power
minik: get_status turn_[on/off] learn_ir emit_ir remove_ir
micmul: get_count get_status_all get_status[1/2/3/4] turn_[on/off]_all turn_[on/off]_socket[1/2/3/4]
mul: get_count get_status_all get_status[1/2/3] get_usb_count get_usb_status_all get_usb_status[1/2]
turn_[on/off]_all turn_[on/off]_socket[1/2/3] turn_[on/off]_usb[1/2]
klight: get_status get_brightness get_color turn_[on/off] set_brightness set_color
kbulb: get_status get_brightness get_ct turn_[on/off] set_brightness set_ct
* each action starts with 'set_' must provide a value parameter
value format:
color: r,g,b
ct: 2700-6500
brightness: 0-100
example:
pykongke search
pykongke turn_on minik 192.168.0.64
pykongke get_status minik 192.168.0.64
pykongke get_power k2 192.168.0.64
pykongke turn_on_usb k2 192.168.0.64
pykongke turn_off_light k2 192.168.0.64
pykongke get_count micmul 192.168.0.64
pykongke turn_on_socket3 micmul 192.168.0.64
pykongke get_status2 mul 192.168.0.64
pykongke turn_off_all mul 192.168.0.64
pykongke get_brightness klight 192.168.0.64
pykongke set_color klight 192.168.0.64 255,255,0
pykongke set_ct kbulb 192.168.0.64 3400
pykongke turn_off kbulb 192.168.0.64
The CLI talks to devices over local UDP. Make sure the host running the command is on the same LAN as the device and can send/receive UDP packets on port 27431.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pykongke-3.0.0.tar.gz.
File metadata
- Download URL: pykongke-3.0.0.tar.gz
- Upload date:
- Size: 25.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a34cfa577fb70ccaa039ca213cae27906d7c2b1b5caaf7c58e66d3db754b36c
|
|
| MD5 |
39e93f780e02a40f14ee6e6e44b0676e
|
|
| BLAKE2b-256 |
73c75ace0896dc384ec6b90ed75bdb58336abe0c4c55d3698ea846474e1ab653
|
Provenance
The following attestation bundles were made for pykongke-3.0.0.tar.gz:
Publisher:
publish.yml on HXHuangXiang/pykongke
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pykongke-3.0.0.tar.gz -
Subject digest:
3a34cfa577fb70ccaa039ca213cae27906d7c2b1b5caaf7c58e66d3db754b36c - Sigstore transparency entry: 1701272049
- Sigstore integration time:
-
Permalink:
HXHuangXiang/pykongke@72c6f0839f5c91f7f73cfe0a39e7f268844687b3 -
Branch / Tag:
refs/tags/v3.0.0 - Owner: https://github.com/HXHuangXiang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@72c6f0839f5c91f7f73cfe0a39e7f268844687b3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pykongke-3.0.0-py3-none-any.whl.
File metadata
- Download URL: pykongke-3.0.0-py3-none-any.whl
- Upload date:
- Size: 30.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a52fb85c91de325385be7ef6b0934a80064a95ba0372289b00ede8d4574bebef
|
|
| MD5 |
e9eabea30c98e738da15666a6245a37f
|
|
| BLAKE2b-256 |
18f581604de3e4603c0fac0d2c129a26cf62e6a0cb3a8e32ae00934f023a89e8
|
Provenance
The following attestation bundles were made for pykongke-3.0.0-py3-none-any.whl:
Publisher:
publish.yml on HXHuangXiang/pykongke
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pykongke-3.0.0-py3-none-any.whl -
Subject digest:
a52fb85c91de325385be7ef6b0934a80064a95ba0372289b00ede8d4574bebef - Sigstore transparency entry: 1701272086
- Sigstore integration time:
-
Permalink:
HXHuangXiang/pykongke@72c6f0839f5c91f7f73cfe0a39e7f268844687b3 -
Branch / Tag:
refs/tags/v3.0.0 - Owner: https://github.com/HXHuangXiang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@72c6f0839f5c91f7f73cfe0a39e7f268844687b3 -
Trigger Event:
push
-
Statement type: