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