Fix bugs
This commit is contained in:
parent
bbf04d6397
commit
5a7ca0f0e9
14
main.py
14
main.py
|
@ -37,7 +37,7 @@ async def play_sound(filename):
|
|||
await asyncio.sleep(0.1)
|
||||
|
||||
|
||||
async def bark(sound):
|
||||
async def barkbark(sound):
|
||||
global COOLDOWN
|
||||
if time.time() - COOLDOWN < 5.0:
|
||||
logging.info('Cooldown skipping.')
|
||||
|
@ -65,17 +65,17 @@ async def process_mqtt(message):
|
|||
logging.info('Invalid json, returning')
|
||||
return
|
||||
|
||||
id_ = str(data.get('id', ''))
|
||||
serial = str(data.get('serial', ''))
|
||||
|
||||
if id_ not in CAMERAS:
|
||||
logging.info('Invalid id, returning')
|
||||
if serial not in CAMERAS:
|
||||
logging.info('Invalid serial, returning')
|
||||
return
|
||||
|
||||
camera = CAMERAS[id_]
|
||||
camera = CAMERAS[serial]
|
||||
|
||||
logging.info('Ringing %s...', camera['name'])
|
||||
logging.info('Barking %s...', camera['name'])
|
||||
|
||||
await ring_bell(doorbell['sound'])
|
||||
await barkbark(camera['sound'])
|
||||
|
||||
|
||||
async def fetch_mqtt():
|
||||
|
|
Loading…
Reference in New Issue
Block a user