Skip to content

Commit

Permalink
Add logging statements for switch and manual control changes via web …
Browse files Browse the repository at this point in the history
…interface
  • Loading branch information
pajikos committed Mar 11, 2024
1 parent c8dfbe0 commit 66eba95
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mqtt-switch2.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ def change_switch(state):
return jsonify({'error': 'Invalid state'}), 400

new_state = 'ON' if switch.is_lit else 'OFF'
logger.info(f"Switch is now {new_state} via web interface.")
return jsonify({'state': new_state})

@app.route('/mode/<state>', methods=['POST'])
Expand All @@ -210,6 +211,7 @@ def change_mode(state):
return jsonify({'error': 'Invalid state'}), 400

manual_control_state = 'ON' if manual_control else 'OFF'
logger.info(f"Manual control is now {manual_control_state} via web interface.")
return jsonify({'manual_control': manual_control_state})


Expand Down

0 comments on commit 66eba95

Please sign in to comment.