You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i wrote this script while trying out the conbee II
i think it would great to have some python example code in the docs
if you think it is a good ideal feel free to use the code sample below
i think the conbee II, deconz app, phoscon app are great...i am very happy...thank you.
import requests, pprint
# ***** use must have the deconz app or service running for this to work ******
# this was test using a ConBee II on windows and raspberry pi
# - to install the deconz app follow these instructions: https://phoscon.de/en/conbee2/install
# - on windows: from start menu run the 'deCONZ app' - it defaults to port 80
# - on pi from app on cmd line w/ ui: > /usr/bin/deCONZ --http-port=8080
runThisApi = 0
port = '80'
ipAddr = 'http://192.168.2.103:' + port
key = '57XXXXXX74' # put your key here after running runThisApi = 0
outlet1 = '1'
# ---------------- get api key
# do this first
# 1) start the 'phoscon app' from the 'deconz app' ui
# 2) enable 'authenticate app' in 'phoscon app'-gateway-advanced then run this cmd
# 3) set runThisApi = 0 and run the code and you will receive an api key
if (runThisApi == 0):
payload = {"devicetype": "my application"}
r = requests.post(ipAddr+'/api/', json=payload)
# [{'success': {'username': '4EXXXXXXB6'}}]
# ---------------- turn light or socket on
if (runThisApi == 1):
payload = {"on": True}
r = requests.put(ipAddr+'/api/'+key+'/lights/'+outlet1+'/state', json=payload)
# ---------------- turn light or socket off
if (runThisApi == 2):
payload = {"on": False}
r = requests.put(ipAddr+'/api/'+key+'/lights/'+outlet1+'/state', json=payload)
# ---------------- get light or socket state
if (runThisApi == 3):
r = requests.get(ipAddr+'/api/'+key+'/lights')
pprint.pprint(r)
pprint.pprint(r.json())
The text was updated successfully, but these errors were encountered:
i wrote this script while trying out the conbee II
i think it would great to have some python example code in the docs
if you think it is a good ideal feel free to use the code sample below
i think the conbee II, deconz app, phoscon app are great...i am very happy...thank you.
The text was updated successfully, but these errors were encountered: