How felipeheuer/energy_guard works
Energy Guard is a Home Assistant integration that configures controllable devices as virtual circuit breakers. The user selects eligible devices and their power sensors; setup creates per-device entities, whose monitoring logic normalizes readings, applies a limit and delay, raises alerts, and can turn off the device. Configuration controls and persistent peak/trip statistics round out the workflow. The source excerpts show these core calls and event links; broader Home Assistant platform behavior is represented only where documented or directly referenced.
Main entry points: binary_sensor.py Alert and trip logic · __init__.py Entry setup · config_flow.py Device selection · sensor.py Peak and trip sensors
Components 14
Configuration
- Device selection
custom_components/energy_guard/config_flow.py - Entry setup
custom_components/energy_guard/__init__.py - Shared constants
custom_components/energy_guard/const.py
Monitoring
- Alert and trip logic
custom_components/energy_guard/binary_sensor.py
Controls
- Limit and delay
custom_components/energy_guard/number.py - Monitor and cutoff
custom_components/energy_guard/switch.py - Reset stats button
custom_components/energy_guard/button.py
Diagnostics
- Peak and trip sensors
custom_components/energy_guard/sensor.py
Other components
- Home Assistant user
- Device and entity registries
- Power sensor entities
- Device switch
- Home Assistant event bus
- Home Assistant entities
Connections 14
- Home Assistant user → Device selection: selects devices
README.md - Device selection → Device and entity registries: discovers devices
custom_components/energy_guard/config_flow.py - Device selection → Entry setup: saves selection
custom_components/energy_guard/config_flow.py - Entry setup → Device and entity registries: resolves devices
custom_components/energy_guard/__init__.py - Entry setup → Home Assistant entities: forwards platforms
custom_components/energy_guard/__init__.py - Entry setup → Shared constants: uses platform list
custom_components/energy_guard/__init__.py - Alert and trip logic → Power sensor entities: reads power state
custom_components/energy_guard/binary_sensor.py - Alert and trip logic → Limit and delay: reads limit and delay
custom_components/energy_guard/binary_sensor.py - Alert and trip logic → Monitor and cutoff: reads monitor and cutoff
custom_components/energy_guard/binary_sensor.py - Alert and trip logic → Home Assistant event bus: fires trip events
custom_components/energy_guard/binary_sensor.py - Alert and trip logic → Device switch: turns off on trip
custom_components/energy_guard/binary_sensor.py - Reset stats button → Home Assistant event bus: fires reset event
custom_components/energy_guard/button.py - Peak and trip sensors → Power sensor entities: tracks peak readings
custom_components/energy_guard/sensor.py - Peak and trip sensors → Home Assistant event bus: listens for trip and reset
custom_components/energy_guard/sensor.py