Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
ccd78f4c48 | |||
a51d5f7ff2 | |||
b1f0d91d75 | |||
e854be1d3b |
@ -1,6 +1,6 @@
|
||||
# garage
|
||||
|
||||
A Raspberry Pi project for monitoring garage doors using reed switches.
|
||||
A Raspberry Pi project for monitoring garage doors using reed switches. The state is pushed to ntfy on updates and is also stored in a json file in the www/ directory.
|
||||
|
||||
## Configuration
|
||||
```
|
||||
|
@ -14,8 +14,7 @@ config = ConfigParser()
|
||||
config.read('garage.cfg')
|
||||
eastPin = config['garage'].getint('east-pin')
|
||||
westPin = config['garage'].getint('west-pin')
|
||||
ntfy = config['push'].get('ntfy')
|
||||
topic = config['push'].get('topic')
|
||||
ntfyList = json.loads(config['push'].get('ntfy'))
|
||||
|
||||
|
||||
def main():
|
||||
@ -69,8 +68,9 @@ def persistState():
|
||||
|
||||
|
||||
def sendNotification():
|
||||
for ntfy in ntfyList:
|
||||
requests.post(
|
||||
url=f'https://{ntfy}/{topic}',
|
||||
url=f'https://{ntfy["host"]}/{ntfy["topic"]}?auth={ntfy["auth"]}',
|
||||
data='update'.encode(encoding='utf-8')
|
||||
)
|
||||
|
||||
|
@ -3,5 +3,7 @@ east-pin=1
|
||||
west-pin=2
|
||||
|
||||
[push]
|
||||
ntfy=ntfy.sh
|
||||
topic=topic
|
||||
ntfy=[
|
||||
{"host": "localhost", "topic": "topic", "auth": "auth"},
|
||||
{"host": "ntfy.sh", "topic": "topic", "auth": "auth"}
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user