Files
TotalConnect/print_last_state.py
T

20 lines
783 B
Python
Executable File

import json
import os
state_file = 'last_state.json'
if os.path.exists(state_file):
with open(state_file, 'r', encoding='utf-8') as f:
data = json.load(f)
print("Content of last_state.json:")
for acc in data:
print(f"\nAccount: {acc.get('label')} ({acc.get('username')})")
for loc in acc.get('locations', []):
loc_id = loc.get('id')
loc_name = loc.get('name')
if '0181' in loc_name or loc_id == 1417027:
print(f" 🏢 MATCH: ID={loc_id}, Name='{loc_name}', Status={loc.get('status')}")
print(f" Triggered Partitions: {loc.get('triggered_partitions')}")
print(f" Active Zones: {loc.get('active_zones')}")
else:
print("last_state.json does not exist!")