# sender/generator.py — generates realistic solar sensor data strings import random import time DOOR_STATES = ["OPEN", "CLOSE"] def generate_data(device_id: str) -> str: ts = int(time.time()) sv = round(random.uniform(40.0, 55.0), 1) si = round(random.uniform(0.0, 40.0), 1) sp = random.randint(0, 2200) bv = round(random.uniform(44.0, 58.0), 2) bcur = round(random.uniform(-30.0, 30.0), 1) bsoc = random.randint(0, 100) bsoh = random.randint(80, 100) bt = round(random.uniform(10.0, 50.0), 1) at = round(random.uniform(15.0, 45.0), 1) door = random.choice(DOOR_STATES) message = ( f"ID={device_id}," f"TS={ts}," f"SV={sv}," f"SI={si}," f"SP={sp}," f"BV={bv}," f"BCUR={bcur}," f"BSOC={bsoc}," f"BSOH={bsoh}," f"BT={bt}," f"AT={at}," f"DOOR={door}" f"\0" ) return message