Compare commits
No commits in common. "main" and "v1.0.0" have entirely different histories.
@ -1,6 +1,6 @@
|
||||
# garage
|
||||
|
||||
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.
|
||||
A Raspberry Pi project for monitoring garage doors using reed switches.
|
||||
|
||||
## Configuration
|
||||
```
|
||||
|
12
garage.py
12
garage.py
@ -14,7 +14,8 @@ config = ConfigParser()
|
||||
config.read('garage.cfg')
|
||||
eastPin = config['garage'].getint('east-pin')
|
||||
westPin = config['garage'].getint('west-pin')
|
||||
ntfyList = json.loads(config['push'].get('ntfy'))
|
||||
ntfy = config['push'].get('ntfy')
|
||||
topic = config['push'].get('topic')
|
||||
|
||||
|
||||
def main():
|
||||
@ -68,11 +69,10 @@ def persistState():
|
||||
|
||||
|
||||
def sendNotification():
|
||||
for ntfy in ntfyList:
|
||||
requests.post(
|
||||
url=f'https://{ntfy["host"]}/{ntfy["topic"]}?auth={ntfy["auth"]}',
|
||||
data='update'.encode(encoding='utf-8')
|
||||
)
|
||||
requests.post(
|
||||
url=f'https://{ntfy}/{topic}',
|
||||
data='update'.encode(encoding='utf-8')
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -3,7 +3,5 @@ east-pin=1
|
||||
west-pin=2
|
||||
|
||||
[push]
|
||||
ntfy=[
|
||||
{"host": "localhost", "topic": "topic", "auth": "auth"},
|
||||
{"host": "ntfy.sh", "topic": "topic", "auth": "auth"}
|
||||
]
|
||||
ntfy=ntfy.sh
|
||||
topic=topic
|
||||
|
Loading…
Reference in New Issue
Block a user