7d0be3c70c
test / test (push) Has been cancelled
Two related fixes for v0.1.3: 1. _read_power_w() reads each power sensor's unit_of_measurement and converts kW to W. Before this, sensors reporting in kW (Tesla integration's leomobile_charger_power = "1" kW) were treated as raw watts, causing the leftover calculation to undercount by ~1000×. In practice the algorithm sent the EV charge rate that matched "what's exporting NOW" instead of "what's available if EV pulled everything" — leaving ~1 kW of solar exported instead of routed to the car. 2. round() → math.ceil() on the amp computation. Trade-off: up to ~VOLTAGE watts of grid import per tick, in exchange for zero solar export. Maximizes PV self-consumption, accepts small grid cost as rounding noise. Tests added: kW conversion round-trip; ceil rounds up partial amps. All 57 pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>