Skip to content

Commit

Permalink
feat(api): add mute and unmute
Browse files Browse the repository at this point in the history
  • Loading branch information
duhow committed Dec 11, 2024
1 parent 3a61e6e commit 5468395
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ def parse_avahi_output(output):
except Exception as e:
return jsonify({'hostname': hostname, 'error': str(e)}), 500

@app.route('/mute')
@app.route('/unmute')
def manage_listener():
action = 'stop' if request.path == '/mute' else 'start'
silent = 'SILENT=1' if 'silent' in request.args else ''
service = os.path.join(const.services_dir, 'listener')
os.system(f'{silent} {service} {action}')
return ""

@app.post('/auth')
def home_assistant_auth():
ha_url = request.form.get('url', '').rstrip('/')
Expand Down

0 comments on commit 5468395

Please sign in to comment.