Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@

**Custom Generac integration component with support for generators and propane tank monitors. It will set up the following platforms.**

| Platform | Entities created for each generator (by `entity_key`) |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `binary_sensor` | `is_connected`, `is_connecting`, `has_maintenance_alert`, `show_warning`, `missed_exercise`, plus conditional `enrolled_in_vpp`, `active_vpp_event`, `subscription_dunning` |
| `button` | `reset_service_timer`, `boost_polling` |
| `sensor` | `status`, `run_time`, `protection_time`, `activation_date`, `last_seen`, `connection_time`, `battery_voltage`, `device_type`, `dealer_email`, `dealer_name`, `dealer_phone`, `address`, `status_text`, `status_label`, `error_code`, `serial_number`, `model_number`, `device_ssid`, `panel_id`, `signal_strength`, `hours_until_service`, plus conditional `exercise_minutes`, `outdoor_temperature`, `device_battery_level` |
| `weather` | conditional `weather` |
| `image` | conditional `hero_image` |
| Platform | Entities created for each generator (by `entity_key`) |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `binary_sensor` | `is_connected`, `is_connecting`, `has_maintenance_alert`, `show_warning`, `missed_exercise`, plus conditional `enrolled_in_vpp`, `active_vpp_event`, `subscription_dunning` |
| `button` | `reset_service_timer`, `boost_polling` |
| `event` | `activity` |
| `sensor` | `status`, `run_time`, `protection_time`, `activation_date`, `last_seen`, `connection_time`, `battery_voltage`, `device_type`, `dealer_email`, `dealer_name`, `dealer_phone`, `address`, `status_text`, `status_label`, `error_code`, `serial_number`, `model_number`, `device_ssid`, `panel_id`, `signal_strength`, `hours_until_service`, `last_outage`, `last_exercise`, `last_outage_duration`, plus conditional `exercise_minutes`, `outdoor_temperature`, `device_battery_level` |
| `weather` | conditional `weather` |
| `image` | conditional `hero_image` |

| Platform | Entities created for each propane tank monitor (by `entity_key`) |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand Down Expand Up @@ -94,14 +95,19 @@ You can also trigger fast polling manually (for example, from an automation trig

### Telemetry, Long-Term Statistics & Diagnostics

- **Long-Term Statistics (LTS)**: Operational numeric sensors expose Home Assistant `state_class` (`total_increasing` on `run_time` and `protection_time`; `measurement` on `battery_voltage`, `exercise_minutes`, `outdoor_temperature`, `capacity`, `fuel_level`, `remaining_fuel`, `estimated_runtime`, `signal_strength`, `device_battery_level`, and `hours_until_service`) for history graphs and long-term recorder statistics.
- **Long-Term Statistics (LTS)**: Operational numeric sensors expose Home Assistant `state_class` (`total_increasing` on `run_time` and `protection_time`; `measurement` on `battery_voltage`, `exercise_minutes`, `outdoor_temperature`, `capacity`, `fuel_level`, `remaining_fuel`, `estimated_runtime`, `signal_strength`, `device_battery_level`, `hours_until_service`, and `last_outage_duration`) for history graphs and long-term recorder statistics.
- **Fault, VPP & Subscription Telemetry**: Generators expose active fault codes via `Error Code` (`error_code`), and—when present in the MobileLink payload—Virtual Power Plant status (`enrolled_in_vpp`, `active_vpp_event`) and subscription billing alerts (`subscription_dunning`).
- **Diagnostic Categorization**: Static metadata and diagnostic entities (serial/model/panel ID, device SSID/type, address, dealer contact info, activation/last-seen/connection timestamps, fuel type, tank orientation, signal strength, VPP enrollment, and subscription billing alert) are grouped under Home Assistant's **Diagnostic** entity category to keep primary dashboards uncluttered.

### Readiness Tracking, Maintenance Timer & Repairs Alerts
### Readiness Tracking, Session Ledger, Activity Events & Repairs Alerts

Each generator automatically tracks exercise activity and maintenance runtime baselines using Home Assistant storage (persisting cleanly across restarts without reloading the integration):
Each generator automatically tracks exercise activity, outage/exercise session history, and maintenance runtime baselines using Home Assistant storage (persisting cleanly across restarts without reloading the integration):

- **Outage & Exercise Session Ledger**:
- `Last Outage` (`last_outage`) and `Last Exercise` (`last_exercise`) record UTC timestamps of observed outages (`Running`) and exercises (`Exercising`), staying `unknown` on fresh installs until a real run is observed. Short unobserved `run_time` increases between idle polls are classified as exercises while longer jumps are recorded as inferred outages.
- `Last Outage Duration` (`last_outage_duration`, in minutes) exposes the most recent outage duration along with `started_at`, `ended_at`, `run_hours_delta`, `estimated_fuel_used`, and `inferred` state attributes.
- **Generator Activity Events (`event` platform)**:
- Each generator exposes an `Activity` (`activity`, default entity ID `event.<generator>_activity`) event entity emitting `outage_started`, `outage_ended`, `exercise_started`, `exercise_completed`, `fault_detected`, and `fault_cleared` with structured metadata for Logbook timelines and event-triggered automations.
- **Maintenance Service Timer**:
- `Hours Until Service` (`hours_until_service`, default entity ID `sensor.<generator>_hours_until_service`) shows estimated runtime hours remaining until the configured service interval (default `100` hours, configurable via **Options** -> `service_interval_hours`; set to `0` to disable).
- On first setup, the baseline initializes to the generator's current `run_time` to avoid false day-1 alarms.
Expand All @@ -116,11 +122,12 @@ Each generator automatically tracks exercise activity and maintenance runtime ba

### Bundled Automation Blueprints

When the integration sets up, three ready-to-use automation blueprints are automatically installed to `<config>/blueprints/automation/generac/`:
When the integration sets up, four ready-to-use automation blueprints are automatically installed to `<config>/blueprints/automation/generac/`:

1. **Generac Outage Load Shedding** (`generac_outage_load_shedding.yaml`) — Sheds high-draw entities when status transitions to `Running` (ignoring `Exercising` cycles), waits for `Ready` stabilization, and optionally restores previously active loads with a stagger delay.
2. **Generac Fault & Dealer Contact Alert** (`generac_fault_dealer_alert.yaml`) — Sends a notification populated with generator status, diagnostic `status_text`, optional `error_code`, and your preferred dealer's name and phone number on `Warning`, `Stopped`, `Communication Issue`, warning, or maintenance alerts.
3. **Generac Pre-Storm Readiness Digest** (`generac_storm_readiness_digest.yaml`) — Sends a readiness digest with status, connectivity, battery voltage, hours until service, and optional propane fuel level, remaining fuel, and estimated runtime when a weather alert or trigger entity turns `on`.
4. **Generac Post-Outage Summary** (`generac_post_outage_summary.yaml`) — Waits for a `Running` outage (ignoring `Exercising` cycles) to stabilize back in `Ready` and sends an "All Clear" summary with outage duration, run hours added, estimated fuel used, optional remaining propane runtime, and hours until service.

## Username + Password Authentication

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
blueprint:
name: Generac Post-Outage Summary
description: >-
Wait for a Generac generator outage ("Running", ignoring scheduled
"Exercising" cycles) to finish and stabilize in "Ready", then send an
All Clear summary with outage duration, estimated fuel used, optional
propane fuel autonomy, and hours until service.
domain: automation
author: ha-generac
input:
generator_status:
name: Generator Status Sensor
description: Generac status sensor for your generator.
selector:
entity:
filter:
- integration: generac
domain: sensor
last_outage_duration_sensor:
name: Last Outage Duration Sensor
description: Generac Last Outage Duration sensor for your generator.
selector:
entity:
filter:
- integration: generac
domain: sensor
hours_until_service_sensor:
name: Hours Until Service Sensor (Optional)
description: Optional Generac Hours Until Service sensor.
default: null
selector:
entity:
filter:
- integration: generac
domain: sensor
remaining_fuel_sensor:
name: Remaining Propane Fuel Sensor (Optional)
description: Optional Generac propane tank remaining fuel sensor (gal).
default: null
selector:
entity:
filter:
- integration: generac
domain: sensor
estimated_runtime_sensor:
name: Estimated Runtime Remaining Sensor (Optional)
description: Optional Generac propane estimated runtime remaining sensor (h).
default: null
selector:
entity:
filter:
- integration: generac
domain: sensor
ready_stabilization_delay:
name: Utility Stabilization Delay
description: >-
Seconds to wait after the generator returns to "Ready" before sending
the post-outage summary.
default: 60
selector:
number:
min: 0
max: 600
unit_of_measurement: seconds
notify_service:
name: Notification Service
description: >-
Home Assistant notify service to call (for example, notify.notify or
notify.mobile_app_your_phone).
default: notify.notify
selector:
text: {}

mode: single
max_exceeded: silent

triggers:
- trigger: state
entity_id: !input generator_status
to: "Running"

variables:
duration_entity: !input last_outage_duration_sensor
service_entity: !input hours_until_service_sensor
remaining_fuel_entity: !input remaining_fuel_sensor
estimated_runtime_entity: !input estimated_runtime_sensor

actions:
- alias: Wait for generator to stabilize in Ready without flapping back to Running
repeat:
sequence:
- alias: Wait for Ready stabilization or outage restart
wait_for_trigger:
- id: ready
trigger: state
entity_id: !input generator_status
to: "Ready"
for:
seconds: !input ready_stabilization_delay
- id: running_again
trigger: state
entity_id: !input generator_status
to: "Running"
until:
- condition: template
value_template: "{{ wait.trigger is not none and wait.trigger.id == 'ready' }}"
- alias: Send post-outage All Clear summary
action: !input notify_service
data:
title: "Generac Post-Outage Summary (All Clear)"
message: |-
{%- set duration = states(duration_entity) -%}
{%- set fuel_used = state_attr(duration_entity, 'estimated_fuel_used') -%}
{%- set run_delta = state_attr(duration_entity, 'run_hours_delta') -%}
Utility power restored and generator is back in Ready.
Outage Duration: {{ duration if duration not in ['unknown', 'unavailable', ''] else 'Unknown' }}{{ ' min' if duration not in ['unknown', 'unavailable', ''] else '' }}
{%- if run_delta not in [none, ''] %}
Run Hours Added: {{ run_delta }} h
{%- endif %}
{%- if fuel_used not in [none, ''] %}
Estimated Fuel Used: {{ fuel_used }} gal
{%- endif %}
{%- if remaining_fuel_entity not in [none, ''] %}
{%- set remaining_fuel = states(remaining_fuel_entity) %}
{%- if remaining_fuel not in ['unknown', 'unavailable', ''] %}
Remaining Fuel: {{ remaining_fuel }} gal
{%- endif %}
{%- endif %}
{%- if estimated_runtime_entity not in [none, ''] %}
{%- set estimated_runtime = states(estimated_runtime_entity) %}
{%- if estimated_runtime not in ['unknown', 'unavailable', ''] %}
Estimated Runtime Remaining: {{ estimated_runtime }} h
{%- endif %}
{%- endif %}
{%- if service_entity not in [none, ''] %}
{%- set hours_left = states(service_entity) %}
{%- if hours_left not in ['unknown', 'unavailable', ''] %}
Hours Until Service: {{ hours_left }} h
{%- endif %}
{%- endif %}
19 changes: 18 additions & 1 deletion custom_components/generac/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,24 @@
WEATHER = "weather"
IMAGE = "image"
BUTTON = "button"
PLATFORMS = [BINARY_SENSOR, SENSOR, WEATHER, IMAGE, BUTTON]
EVENT = "event"
PLATFORMS = [BINARY_SENSOR, SENSOR, WEATHER, IMAGE, BUTTON, EVENT]

# Generator activity event types
EVENT_OUTAGE_STARTED = "outage_started"
EVENT_OUTAGE_ENDED = "outage_ended"
EVENT_EXERCISE_STARTED = "exercise_started"
EVENT_EXERCISE_COMPLETED = "exercise_completed"
EVENT_FAULT_DETECTED = "fault_detected"
EVENT_FAULT_CLEARED = "fault_cleared"
GENERATOR_ACTIVITY_EVENT_TYPES = [
EVENT_OUTAGE_STARTED,
EVENT_OUTAGE_ENDED,
EVENT_EXERCISE_STARTED,
EVENT_EXERCISE_COMPLETED,
EVENT_FAULT_DETECTED,
EVENT_FAULT_CLEARED,
]

# Readiness & maintenance defaults
DEFAULT_SERVICE_INTERVAL_HOURS = 100
Expand Down
Loading
Loading