doorbell threshold
This commit is contained in:
@@ -34,16 +34,16 @@ while True:
|
|||||||
|
|
||||||
# send MQTT
|
# send MQTT
|
||||||
headers = {
|
headers = {
|
||||||
"Content-Type": "application/json",
|
# "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJjYjY5NjA5NmY0N2E0NmZlOGEzYjczOGYzYmUzOTk5ZSIsImlhdCI6MTY2MTM0NDgxOSwiZXhwIjoxOTc2NzA0ODE5fQ.z9fzbVOA1Pbur3Zb07481n-SoYesj8cetw-CX6WPmTs",
|
||||||
"Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJjYjY5NjA5NmY0N2E0NmZlOGEzYjczOGYzYmUzOTk5ZSIsImlhdCI6MTY2MTM0NDgxOSwiZXhwIjoxOTc2NzA0ODE5fQ.z9fzbVOA1Pbur3Zb07481n-SoYesj8cetw-CX6WPmTs"
|
"Content-Type": "application/json"
|
||||||
}
|
}
|
||||||
data = json.dumps({'payload': 'RING', 'topic': 'lewe/doorbell', 'retain': 'False'}).encode('utf8')
|
data = json.dumps({'payload': 'RING', 'topic': 'lewe/doorbell', 'retain': 'False'}).encode('utf8')
|
||||||
request = urllib.request.Request("localhost:8123/api/services/mqtt/publish", data, headers)
|
request = urllib.request.Request("localhost:8123/api/services/mqtt/publish", data, headers)
|
||||||
# request = urllib.request.Request("https://www.nodebucket.de:8123/api/services/mqtt/publish", data, headers)
|
# request = urllib.request.Request("https://www.nodebucket.de:8123/api/services/mqtt/publish", data, headers)
|
||||||
response = urllib.request.urlopen(reqest)
|
response = urllib.request.urlopen(reqest)
|
||||||
except Exception:
|
except Exception as err:
|
||||||
logger.error("Could not ring doorbell")
|
logger.error("Could not ring doorbell")
|
||||||
# logger.exception("Could not ring doorbell")
|
logger.error(err.message)
|
||||||
time.sleep(300)
|
time.sleep(300)
|
||||||
else:
|
else:
|
||||||
logger.info(data)
|
logger.info(data)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
/*
|
/* Klingel-Sensor auf Arduino Nano ATmega168
|
||||||
|
*
|
||||||
* https://www.arduino.cc/en/Tutorial/BuiltInExamples/Button
|
* https://www.arduino.cc/en/Tutorial/BuiltInExamples/Button
|
||||||
*
|
*
|
||||||
* D2 -------------
|
* D2 -------------
|
||||||
@@ -13,7 +14,7 @@
|
|||||||
|
|
||||||
const int ledPin = LED_BUILTIN;
|
const int ledPin = LED_BUILTIN;
|
||||||
const int buttonPin = 2; // Button connected to D2
|
const int buttonPin = 2; // Button connected to D2
|
||||||
const int flare_threshold = 120;
|
const int flare_threshold = 60;
|
||||||
|
|
||||||
bool active = false;
|
bool active = false;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user