Allow multiple push servers
This commit is contained in:
parent
a51d5f7ff2
commit
ccd78f4c48
|
@ -14,9 +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')
|
||||
auth = config['push'].get('auth')
|
||||
ntfyList = json.loads(config['push'].get('ntfy'))
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -70,8 +68,9 @@ def persistState():
|
|||
|
||||
|
||||
def sendNotification():
|
||||
for ntfy in ntfyList:
|
||||
requests.post(
|
||||
url=f'https://{ntfy}/{topic}?auth={auth}',
|
||||
url=f'https://{ntfy["host"]}/{ntfy["topic"]}?auth={ntfy["auth"]}',
|
||||
data='update'.encode(encoding='utf-8')
|
||||
)
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ east-pin=1
|
|||
west-pin=2
|
||||
|
||||
[push]
|
||||
ntfy=ntfy.sh
|
||||
topic=topic
|
||||
auth=auth
|
||||
ntfy=[
|
||||
{"host": "localhost", "topic": "topic", "auth": "auth"},
|
||||
{"host": "ntfy.sh", "topic": "topic", "auth": "auth"}
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue