This commit is contained in:
2022-08-24 14:48:56 +00:00
parent 211271f3e5
commit 60139c674d
@@ -33,7 +33,10 @@ while True:
response = urllib.request.urlopen('http://192.168.178.60/bell/on', timeout=5).read().decode('utf-8') response = urllib.request.urlopen('http://192.168.178.60/bell/on', timeout=5).read().decode('utf-8')
# send MQTT # send MQTT
headers = {"Content-Type": "application/json","Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJjYjY5NjA5NmY0N2E0NmZlOGEzYjczOGYzYmUzOTk5ZSIsImlhdCI6MTY2MTM0NDgxOSwiZXhwIjoxOTc2NzA0ODE5fQ.z9fzbVOA1Pbur3Zb07481n-SoYesj8cetw-CX6WPmTs"} headers = {
"Content-Type": "application/json",
"Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJjYjY5NjA5NmY0N2E0NmZlOGEzYjczOGYzYmUzOTk5ZSIsImlhdCI6MTY2MTM0NDgxOSwiZXhwIjoxOTc2NzA0ODE5fQ.z9fzbVOA1Pbur3Zb07481n-SoYesj8cetw-CX6WPmTs"
}
data = json.dumps({'payload': 'RING', 'topic': 'lewe/doorbell', 'retain': 'False'}).encode('utf8') data = json.dumps({'payload': 'RING', 'topic': 'lewe/doorbell', 'retain': 'False'}).encode('utf8')
reqest = urllib.request.Request("https://www.nodebucket.de:8123/api/services/mqtt/publish", data, headers) reqest = urllib.request.Request("https://www.nodebucket.de:8123/api/services/mqtt/publish", data, headers)
response = urllib.request.urlopen(reqest) response = urllib.request.urlopen(reqest)