Juham Automation is a Python‑based toolkit that provides building blocks for smart home energy management, released as a beta version on PyPI and compatible with Python 3.8+.

The package is split into two main sub‑modules: automation, which handles MQTT‑driven device control, and ts (time series), which stores the same MQTT streams for historical analysis and forecasting.

The HeatingAutomater works with a power meter to compute the home’s net energy balance by comparing instantaneous consumption with on‑site generation, driving downstream optimization decisions.

Energy revenue calculation translates power data into financial metrics using current electricity prices and fees, giving homeowners hourly and daily cost feedback to shift loads to cheaper periods.

Environmental monitoring integrates Shelly Plus Add‑on and sensors like DS18B20 and DHT22, feeding temperature and humidity data into MQTT for longitudinal study and comfort‑energy correlation.

The Utilization Optimization Index (UOI) combines real‑time pricing, temperature forecasts, and renewable generation predictions to identify optimal windows for energy‑intensive appliances, deferring grid use when cheap solar is imminent.

For heating systems, the UOI distinguishes between a primary electric boiler and a secondary pre‑heating boiler, prioritizing thermal store charging during sunny PV periods or leveraging solar‑thermal hot water to reduce electrical demand.

The Power Plan feature creates a 12‑hour ahead schedule based on forecasted prices and solar irradiance, activating loads to minimize cost while respecting user‑defined comfort constraints.

When on‑site generation exceeds consumption, the Energy Balancer activates deferrable loads (e.g., water heater) to absorb surplus energy, preventing low‑value grid export and increasing domestic storage.

Safety is ensured by the Power Diagnosis subsystem, which monitors relay states and compares commanded versus actual feedback to detect miswirings, stuck contacts, or communication failures before they cause hazards.

Getting started involves installing an MQTT broker (e.g., Mosquitto), creating three JSON config files (PahoMqtt.json, Juham.json, Timeseries.json), and running the example script from juham/examples to see end‑to‑end functionality.