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.