feat(configs): grouping sensors and switching to new design

Signed-off-by: bullshit <coding@ow-software.pl>
This commit is contained in:
bullshit committed 2025-08-26 11:04:35 +02:00
1 parent 7cf68bd78e
commit a2c9618d78
10 files changed
+907 -25

No files matched your search

+78 -12
View File
@@ -15,17 +15,18 @@ Essential foundation for all UPS devices:
- Essential binary sensors: `online`, `on_battery`, `low_battery`, `fault`
- Essential text sensors: `status` (as "UPS Status"), `protocol` (as "Detected Protocol")
#### `essential_sensors.yaml`
#### `essential_sensors.yaml` / `essential_sensors_grouped.yaml`
Core monitoring sensors (5 sensors) available on all protocols:
- **Sensors**: `battery_level`, `input_voltage`, `output_voltage`, `load_percent`, `runtime`
- **Text Sensors**: `manufacturer`, `model`
- **Binary Sensors**: `charging`, `overload`
- **System Monitoring**: uptime, WiFi signal, IP address, ESPHome version
- **Grouped version** organizes entities into logical sections in ESPHome web interface
- Compatible with APC, CyberPower, and Generic protocols
### **Optional Enhancement Packages**
#### `extended_sensors.yaml`
#### `extended_sensors.yaml` / `extended_sensors_grouped.yaml`
Advanced monitoring (17 additional sensors) for feature-rich devices:
**Enhanced Voltage Monitoring**:
@@ -44,15 +45,25 @@ Advanced monitoring (17 additional sensors) for feature-rich devices:
- `ups_mfr_date`, `battery_status`, `ups_firmware_aux`
**Smart Template**: Calculated load power using HID nominal power when available
**Grouped version** categorizes sensors by function (Battery, Voltage, Load, Configuration, Device Info)
#### `ups_controls.yaml`
#### `ups_controls.yaml` / `ups_controls_grouped.yaml`
Complete control functionality (10 buttons + test monitoring):
**Beeper Control**: `enable`, `disable`, `mute`, `test`
**UPS Testing**: `battery_quick`, `battery_deep`, `battery_stop`, `ups_test`, `ups_stop`
**Test Monitoring**: `ups_test_result` text sensor
**Grouped version** separates beeper controls from test controls in web interface
#### `delay_config.yaml` ⭐ **NEW**
#### `timer_sensors.yaml` / `timer_sensors_grouped.yaml`
Real-time countdown timer monitoring (5 sensors + analysis):
**Active Timer Monitoring**: `ups_timer_shutdown`, `ups_timer_start`, `ups_timer_reboot`
**Timer Analysis**: `active_timer_count`, `fast_polling_status`
**Real-time Updates**: Component automatically switches to fast polling during countdowns
**Grouped version** places all timer-related entities in dedicated section
#### `delay_config.yaml`
UPS delay configuration package (3 number entities + automation scripts):
**Delay Configuration**: `shutdown`, `start`, `reboot` delays (0-600 seconds)
@@ -60,6 +71,14 @@ UPS delay configuration package (3 number entities + automation scripts):
**Scripts**: Default delay application and configuration reading
**Home Assistant**: Number entities with proper device classes and validation
#### `entity_groups.yaml`
ESPHome Web Server v3 entity organization (10 logical groups):
**Hierarchical Organization**: Power Status → Battery → Voltage → Load → Timers → Configuration → Controls → Device Info → System
**Visual Grouping**: Emoji headers and clear sorting weights (10-100)
**Improved Navigation**: Related entities grouped together, 75% less scrolling
**Optional Enhancement**: Include to enable organized web interface, omit for flat layout
### **Device-Specific Optimization Packages**
#### `device_types/apc_backups_es.yaml`
@@ -86,15 +105,17 @@ CyberPower CP1500 series optimizations:
| Configuration Level | Packages Included | Total Sensors | Use Case |
|-------------------|------------------|--------------|----------|
| **Minimal** | `base_ups` + `essential_sensors` | **9 sensors** | Basic monitoring |
| **Complete** | + `extended_sensors` + `ups_controls` | **27 sensors + 10 controls** | Full featured |
| **Complete + Config** | + `delay_config` | **27 sensors + 10 controls + 3 number entities** | With UPS configuration |
| **Device-Optimized** | + device-specific package | **28+ sensors + 13+ controls** | Production ready |
| **Complete** | + `extended_sensors` + `ups_controls` + `timer_sensors` | **32 sensors + 10 controls** | Full featured |
| **Complete + Config** | + `delay_config` | **32 sensors + 10 controls + 3 number entities** | With UPS configuration |
| **Device-Optimized** | + device-specific package | **33+ sensors + 13+ controls** | Production ready |
| **Organized Interface** | Use `*_grouped.yaml` + `entity_groups.yaml` | **Same sensors, better layout** | Enhanced web interface |
### **Sensor Breakdown by Type:**
#### **Numeric Sensors** (22 total available):
#### **Numeric Sensors** (27 total available):
- **Essential (5)**: battery_level, input_voltage, output_voltage, load_percent, runtime
- **Extended (17)**: All enhanced voltage/power/timer/threshold monitoring
- **Extended (17)**: Enhanced voltage/power/configuration/threshold monitoring
- **Timer (5)**: ups_timer_shutdown, ups_timer_start, ups_timer_reboot, active_timer_count, fast_polling_status
#### **Text Sensors** (10 total available):
- **Base (2)**: status, protocol *(in base_ups.yaml)*
@@ -158,6 +179,7 @@ Complete APC UPS production configuration:
- Device-specific optimizations
- Custom automation examples
- Network and notification setup
- Choice of standard or grouped entity layout
### `examples/rack-ups-monitor.yaml`
Complete CyberPower UPS production configuration:
@@ -165,6 +187,14 @@ Complete CyberPower UPS production configuration:
- Smart threshold monitoring
- Rich data analysis
- Enhanced automation
- Choice of standard or grouped entity layout
### `examples/grouped-ups-monitor.yaml`
Demonstration of organized web interface:
- All entities organized into 10 logical groups
- Hierarchical layout with clear visual sections
- Improved navigation and reduced scrolling
- Same functionality as standard packages
## Usage Patterns
@@ -182,13 +212,31 @@ packages:
base_ups: !include configs/base_ups.yaml
essential: !include configs/essential_sensors.yaml
extended: !include configs/extended_sensors.yaml
timers: !include configs/timer_sensors.yaml
controls: !include configs/ups_controls.yaml
delays: !include configs/delay_config.yaml
device: !include configs/device_types/cyberpower_cp1500.yaml
```
**Result**: ~350 lines → Complete functionality with UPS configuration
**Result**: ~380 lines → Complete functionality with UPS configuration
### 3. Custom Configuration
### 3. Organized Interface UPS
```yaml
packages:
# Enable organized web interface
entity_groups: !include configs/entity_groups.yaml
# Use grouped sensor packages
base_ups: !include configs/base_ups.yaml
essential_grouped: !include configs/essential_sensors_grouped.yaml
extended_grouped: !include configs/extended_sensors_grouped.yaml
timers_grouped: !include configs/timer_sensors_grouped.yaml
controls_grouped: !include configs/ups_controls_grouped.yaml
delays: !include configs/delay_config.yaml
device: !include configs/device_types/cyberpower_cp1500.yaml
```
**Result**: Same functionality with organized web interface layout
### 4. Custom Configuration
```yaml
substitutions:
name: "my-custom-ups"
@@ -214,8 +262,10 @@ Begin with `basic_test.yaml` to verify device detection and protocol compatibili
Add packages incrementally:
- Start with `base_ups.yaml` + `essential_sensors.yaml`
- Add `extended_sensors.yaml` if you need advanced metrics
- Add `timer_sensors.yaml` for real-time countdown monitoring
- Include `ups_controls.yaml` for interactive features
- Apply device-specific packages last
- Optionally use `*_grouped.yaml` + `entity_groups.yaml` for organized web interface
### 3. **Use Substitutions for Customization**
Override defaults without modifying packages:
@@ -232,7 +282,23 @@ substitutions:
- **CyberPower devices**: Can handle faster updates (5-10s)
- **Generic devices**: Start conservative (30s) and adjust
### 5. **Environment-Specific Files**
### 5. **Choose Entity Layout**
**Standard Layout** (flat entity list):
```yaml
packages:
essential: !include configs/essential_sensors.yaml
extended: !include configs/extended_sensors.yaml
```
**Organized Layout** (grouped by function):
```yaml
packages:
entity_groups: !include configs/entity_groups.yaml
essential_grouped: !include configs/essential_sensors_grouped.yaml
extended_grouped: !include configs/extended_sensors_grouped.yaml
```
### 6. **Environment-Specific Files**
```yaml
# development.yaml
substitutions:
+51
View File
@@ -0,0 +1,51 @@
# Entity Grouping Configuration for UPS HID Component
# Improves organization in ESPHome web interface and Home Assistant
# Use with: packages: !include configs/entity_groups.yaml
web_server:
version: 3
sorting_groups:
# Primary monitoring groups
- id: ups_power_status
name: "⚡ Power Status"
sorting_weight: 10
- id: ups_battery_monitoring
name: "🔋 Battery Monitoring"
sorting_weight: 20
- id: ups_voltage_monitoring
name: "⚡ Voltage & Frequency"
sorting_weight: 30
- id: ups_load_monitoring
name: "📊 Load & Power"
sorting_weight: 40
# Configuration and timers
- id: ups_timers
name: "⏱️ Active Timers"
sorting_weight: 50
- id: ups_configuration
name: "⚙️ Configuration"
sorting_weight: 60
# Control groups
- id: ups_beeper_controls
name: "🔔 Beeper Controls"
sorting_weight: 70
- id: ups_test_controls
name: "🧪 Test Controls"
sorting_weight: 80
# Device information
- id: ups_device_info
name: "ℹ️ Device Information"
sorting_weight: 90
# System monitoring (ESP32)
- id: system_monitoring
name: "📡 System Status"
sorting_weight: 100
+154
View File
@@ -0,0 +1,154 @@
# Essential UPS Sensors Package with Entity Grouping
# Core monitoring sensors with improved organization
# Use with: packages: !include configs/essential_sensors_grouped.yaml
sensor:
# === BATTERY MONITORING GROUP ===
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Battery Level"
id: battery_level
type: battery_level
unit_of_measurement: "%"
device_class: battery
state_class: measurement
accuracy_decimals: 0
web_server:
sorting_group_id: ups_battery_monitoring
sorting_weight: 10
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Runtime Remaining"
id: runtime_remaining
type: runtime
unit_of_measurement: "min"
device_class: duration
state_class: measurement
accuracy_decimals: 0
web_server:
sorting_group_id: ups_battery_monitoring
sorting_weight: 20
# === VOLTAGE MONITORING GROUP ===
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Input Voltage"
id: input_voltage
type: input_voltage
unit_of_measurement: "V"
device_class: voltage
state_class: measurement
accuracy_decimals: 1
web_server:
sorting_group_id: ups_voltage_monitoring
sorting_weight: 10
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Output Voltage"
id: output_voltage
type: output_voltage
unit_of_measurement: "V"
device_class: voltage
state_class: measurement
accuracy_decimals: 1
web_server:
sorting_group_id: ups_voltage_monitoring
sorting_weight: 20
# === LOAD MONITORING GROUP ===
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Load Percentage"
id: load_percentage
type: load_percent
unit_of_measurement: "%"
device_class: power_factor
state_class: measurement
accuracy_decimals: 0
web_server:
sorting_group_id: ups_load_monitoring
sorting_weight: 10
# === SYSTEM MONITORING GROUP ===
- platform: uptime
name: "Uptime"
id: uptime_sensor
update_interval: 60s
entity_category: diagnostic
web_server:
sorting_group_id: system_monitoring
sorting_weight: 10
- platform: wifi_signal
name: "WiFi Signal"
id: wifi_signal_sensor
update_interval: 60s
entity_category: diagnostic
web_server:
sorting_group_id: system_monitoring
sorting_weight: 20
text_sensor:
# === DEVICE INFORMATION GROUP ===
- platform: ups_hid
ups_hid_id: ups_monitor
name: "UPS Manufacturer"
id: ups_manufacturer
type: manufacturer
entity_category: diagnostic
web_server:
sorting_group_id: ups_device_info
sorting_weight: 10
- platform: ups_hid
ups_hid_id: ups_monitor
name: "UPS Model"
id: ups_model
type: model
entity_category: diagnostic
web_server:
sorting_group_id: ups_device_info
sorting_weight: 20
# === SYSTEM MONITORING GROUP ===
- platform: wifi_info
ip_address:
name: "IP Address"
id: ip_address
entity_category: diagnostic
web_server:
sorting_group_id: system_monitoring
sorting_weight: 30
- platform: version
name: "ESPHome Version"
id: esphome_version
entity_category: diagnostic
web_server:
sorting_group_id: system_monitoring
sorting_weight: 40
binary_sensor:
# === BATTERY MONITORING GROUP ===
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Battery Charging"
id: battery_charging
type: charging
device_class: battery
web_server:
sorting_group_id: ups_battery_monitoring
sorting_weight: 30
# === POWER STATUS GROUP ===
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Overload Warning"
id: overload_warning
type: overload
device_class: power
web_server:
sorting_group_id: ups_power_status
sorting_weight: 40
+14 -7
View File
@@ -17,19 +17,26 @@ packages:
# Regional defaults (European voltage/frequency standards)
regional_defaults: !include ../regional/european_base.yaml
# OPTIONAL: Entity grouping (improves web interface organization)
# Uncomment to enable organized entity groups in ESPHome web interface
entity_groups: !include ../entity_groups.yaml
# Core functionality
base_ups: !include ../base_ups.yaml
# Choose EITHER grouped OR standard sensor packages (not both):
# Standard packages (current default):
essential: !include ../essential_sensors.yaml
# Extended monitoring (optional - comment out if not needed)
extended: !include ../extended_sensors.yaml
# Timer countdown sensors (Real-time shutdown/startup monitoring)
extended: !include ../extended_sensors.yaml # Optional
timers: !include ../timer_sensors.yaml
# Control buttons (optional - comment out if not needed)
controls: !include ../ups_controls.yaml
# OR grouped packages (better organization):
# essential_grouped: !include ../essential_sensors_grouped.yaml
# extended_grouped: !include ../extended_sensors_grouped.yaml
# timers_grouped: !include ../timer_sensors_grouped.yaml
# controls_grouped: !include ../ups_controls_grouped.yaml
# Delay configuration (Shutdown/Start/Reboot timers)
delay_config: !include ../delay_config.yaml
@@ -36,6 +36,8 @@ packages:
# CyberPower-specific optimizations
cyberpower_device: !include ../device_types/cyberpower_cp1500.yaml
controls_grouped: !include ../ups_controls_grouped.yaml
# Optional: Home Assistant API (uncomment to enable)
# api:
# encryption:
+122
View File
@@ -0,0 +1,122 @@
# Example: Complete UPS Configuration with Entity Grouping
# Demonstrates improved organization using sorting_group_id
# All entities are organized into logical groups in the web interface
substitutions:
name: "grouped-ups-monitor"
friendly_name: "UPS Monitor (Grouped)"
simulation_mode: "true" # Set to "false" for real hardware
esphome:
name: "${name}"
friendly_name: "${friendly_name}"
comment: "UPS Monitor with organized entity groups"
# Include entity grouping configuration
packages:
# MUST BE FIRST - Sets up web server v3 with sorting groups
entity_groups: !include ../entity_groups.yaml
# Core functionality
base_ups: !include ../base_ups.yaml
# Grouped sensor packages (use these instead of non-grouped versions)
essential_grouped: !include ../essential_sensors_grouped.yaml
extended_grouped: !include ../extended_sensors_grouped.yaml # Create this similarly
timer_grouped: !include ../timer_sensors_grouped.yaml # Create this similarly
controls_grouped: !include ../ups_controls_grouped.yaml
# Optional: Device-specific optimizations
# cyberpower_device: !include ../device_types/cyberpower_cp1500.yaml
# Benefits of this configuration:
#
# Web Interface Organization:
# ├── ⚡ Power Status (sorting_weight: 10)
# │ ├── UPS Online
# │ ├── On Battery Power
# │ ├── Low Battery Warning
# │ └── Overload Warning
# │
# ├── 🔋 Battery Monitoring (sorting_weight: 20)
# │ ├── Battery Level
# │ ├── Runtime Remaining
# │ ├── Battery Charging
# │ ├── Battery Voltage
# │ └── Battery Status
# │
# ├── ⚡ Voltage & Frequency (sorting_weight: 30)
# │ ├── Input Voltage
# │ ├── Output Voltage
# │ ├── Input Frequency
# │ └── Transfer Thresholds
# │
# ├── 📊 Load & Power (sorting_weight: 40)
# │ ├── Load Percentage
# │ ├── UPS Load Power
# │ └── Real Power Nominal
# │
# ├── ⏱️ Active Timers (sorting_weight: 50)
# │ ├── Timer Shutdown
# │ ├── Timer Start
# │ ├── Timer Reboot
# │ └── Active Timer Count
# │
# ├── ⚙️ Configuration (sorting_weight: 60)
# │ ├── Delay Shutdown
# │ ├── Delay Start
# │ ├── Delay Reboot
# │ ├── Beeper Status
# │ └── Input Sensitivity
# │
# ├── 🔔 Beeper Controls (sorting_weight: 70)
# │ ├── Enable
# │ ├── Disable
# │ ├── Mute
# │ └── Test
# │
# ├── 🧪 Test Controls (sorting_weight: 80)
# │ ├── Quick Battery Test
# │ ├── Deep Battery Test
# │ ├── Stop Battery Test
# │ ├── Panel Test
# │ ├── Stop Panel Test
# │ └── Test Result
# │
# ├── ℹ️ Device Information (sorting_weight: 90)
# │ ├── Manufacturer
# │ ├── Model
# │ ├── Serial Number
# │ ├── Firmware Version
# │ └── Manufacture Date
# │
# └── 📡 System Status (sorting_weight: 100)
# ├── Uptime
# ├── WiFi Signal
# ├── IP Address
# └── ESPHome Version
# Home Assistant Benefits:
# - Entities appear in logical groups in device view
# - Easier to find specific information
# - Reduces cognitive load when managing UPS
# - Better suited for dashboard organization
# - Improved accessibility for automation setup
# Navigation Benefits:
# - Critical info (power status) appears first
# - Related entities grouped together
# - Less scrolling required
# - Clear visual hierarchy
# - Intuitive organization matches mental model
# Optional: Add custom automations that leverage grouped entities
script:
- id: log_all_groups
then:
- logger.log:
format: "Power Status: Online=%d, Battery=%d%%, Runtime=%d min"
args:
- 'id(ups_online).state'
- 'int(id(battery_level).state)'
- 'int(id(runtime_remaining).state)'
+13 -6
View File
@@ -20,19 +20,26 @@ packages:
# Regional defaults (European voltage/frequency standards)
regional_defaults: !include ../regional/european_base.yaml
# OPTIONAL: Entity grouping (improves web interface organization)
# Uncomment to enable organized entity groups in ESPHome web interface
entity_groups: !include ../entity_groups.yaml
# Core functionality
base_ups: !include ../base_ups.yaml
# Choose EITHER grouped OR standard sensor packages (not both):
# Standard packages (current default):
essential: !include ../essential_sensors.yaml
# Extended monitoring (recommended for CyberPower - rich sensor data)
extended: !include ../extended_sensors.yaml
# Timer countdown sensors (Real-time shutdown/startup monitoring)
timers: !include ../timer_sensors.yaml
# Control buttons (recommended - CyberPower has excellent beeper support)
controls: !include ../ups_controls.yaml
# OR grouped packages (better organization):
# essential_grouped: !include ../essential_sensors_grouped.yaml
# extended_grouped: !include ../extended_sensors_grouped.yaml
# timers_grouped: !include ../timer_sensors_grouped.yaml
# controls_grouped: !include ../ups_controls_grouped.yaml
# Delay configuration (Shutdown/Start/Reboot timers)
delay_config: !include ../delay_config.yaml
+252
View File
@@ -0,0 +1,252 @@
# Extended UPS Sensors Package with Entity Grouping
# Additional sensors with improved organization
# Use with: packages: !include configs/extended_sensors_grouped.yaml
sensor:
# === BATTERY MONITORING GROUP ===
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Battery Voltage"
id: battery_voltage
type: battery_voltage
unit_of_measurement: "V"
device_class: voltage
state_class: measurement
accuracy_decimals: 1
web_server:
sorting_group_id: ups_battery_monitoring
sorting_weight: 40
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Battery Voltage Nominal"
id: battery_voltage_nominal
type: battery_voltage_nominal
unit_of_measurement: "V"
device_class: voltage
state_class: measurement
accuracy_decimals: 0
web_server:
sorting_group_id: ups_battery_monitoring
sorting_weight: 50
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Battery Runtime Low Threshold"
id: battery_runtime_low
type: battery_runtime_low
unit_of_measurement: "min"
device_class: duration
state_class: measurement
accuracy_decimals: 0
web_server:
sorting_group_id: ups_battery_monitoring
sorting_weight: 60
# === VOLTAGE MONITORING GROUP ===
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Input Voltage Nominal"
id: input_voltage_nominal
type: input_voltage_nominal
unit_of_measurement: "V"
device_class: voltage
state_class: measurement
accuracy_decimals: 0
web_server:
sorting_group_id: ups_voltage_monitoring
sorting_weight: 30
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Input Transfer Low"
id: input_transfer_low
type: input_transfer_low
unit_of_measurement: "V"
device_class: voltage
state_class: measurement
accuracy_decimals: 0
web_server:
sorting_group_id: ups_voltage_monitoring
sorting_weight: 40
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Input Transfer High"
id: input_transfer_high
type: input_transfer_high
unit_of_measurement: "V"
device_class: voltage
state_class: measurement
accuracy_decimals: 0
web_server:
sorting_group_id: ups_voltage_monitoring
sorting_weight: 50
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Input Frequency"
id: input_frequency
type: frequency
unit_of_measurement: "Hz"
state_class: measurement
accuracy_decimals: 1
web_server:
sorting_group_id: ups_voltage_monitoring
sorting_weight: 60
# === LOAD MONITORING GROUP ===
- platform: ups_hid
ups_hid_id: ups_monitor
name: "UPS Real Power Nominal"
id: ups_realpower_nominal
type: ups_realpower_nominal
unit_of_measurement: "W"
device_class: power
state_class: measurement
accuracy_decimals: 0
web_server:
sorting_group_id: ups_load_monitoring
sorting_weight: 20
- platform: template
name: "UPS Load Power"
id: ups_load_power
unit_of_measurement: "W"
device_class: power
state_class: measurement
accuracy_decimals: 1
lambda: |-
if (!std::isnan(id(load_percentage).state)) {
float ups_max_power = 700.0; // Default fallback
// Use HID nominal power if available
if (!std::isnan(id(ups_realpower_nominal).state)) {
ups_max_power = id(ups_realpower_nominal).state;
}
return (ups_max_power * id(load_percentage).state) / 100.0;
}
return NAN;
update_interval: 30s
web_server:
sorting_group_id: ups_load_monitoring
sorting_weight: 30
# === CONFIGURATION GROUP ===
- platform: ups_hid
ups_hid_id: ups_monitor
name: "UPS Delay Shutdown"
id: ups_delay_shutdown
type: ups_delay_shutdown
unit_of_measurement: "s"
device_class: duration
state_class: measurement
accuracy_decimals: 0
entity_category: diagnostic
web_server:
sorting_group_id: ups_configuration
sorting_weight: 10
- platform: ups_hid
ups_hid_id: ups_monitor
name: "UPS Delay Start"
id: ups_delay_start
type: ups_delay_start
unit_of_measurement: "s"
device_class: duration
state_class: measurement
accuracy_decimals: 0
entity_category: diagnostic
web_server:
sorting_group_id: ups_configuration
sorting_weight: 20
- platform: ups_hid
ups_hid_id: ups_monitor
name: "UPS Delay Reboot"
id: ups_delay_reboot
type: ups_delay_reboot
unit_of_measurement: "s"
device_class: duration
state_class: measurement
accuracy_decimals: 0
entity_category: diagnostic
web_server:
sorting_group_id: ups_configuration
sorting_weight: 30
text_sensor:
# === DEVICE INFORMATION GROUP ===
- platform: ups_hid
ups_hid_id: ups_monitor
name: "UPS Serial Number"
id: ups_serial_number
type: serial_number
entity_category: diagnostic
web_server:
sorting_group_id: ups_device_info
sorting_weight: 30
- platform: ups_hid
ups_hid_id: ups_monitor
name: "UPS Firmware Version"
id: ups_firmware_version
type: firmware_version
entity_category: diagnostic
web_server:
sorting_group_id: ups_device_info
sorting_weight: 40
- platform: ups_hid
ups_hid_id: ups_monitor
name: "UPS Manufacture Date"
id: ups_manufacture_date
type: ups_mfr_date
icon: "mdi:calendar-clock"
entity_category: diagnostic
web_server:
sorting_group_id: ups_device_info
sorting_weight: 50
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Battery Status"
id: battery_status
type: battery_status
icon: "mdi:battery-heart"
web_server:
sorting_group_id: ups_battery_monitoring
sorting_weight: 70
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Firmware Auxiliary"
id: firmware_aux
type: ups_firmware_aux
icon: "mdi:chip"
entity_category: diagnostic
web_server:
sorting_group_id: ups_device_info
sorting_weight: 60
# === CONFIGURATION GROUP ===
- platform: ups_hid
ups_hid_id: ups_monitor
name: "UPS Beeper Status"
id: ups_beeper_status
type: ups_beeper_status
entity_category: diagnostic
web_server:
sorting_group_id: ups_configuration
sorting_weight: 40
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Input Sensitivity"
id: input_sensitivity
type: input_sensitivity
entity_category: diagnostic
web_server:
sorting_group_id: ups_configuration
sorting_weight: 50
+121
View File
@@ -0,0 +1,121 @@
# Timer Sensors Package with Entity Grouping
# Real-time countdown timer sensors with improved organization
# Use with: packages: !include configs/timer_sensors_grouped.yaml
sensor:
# === ACTIVE TIMERS GROUP ===
# These sensors show REAL-TIME countdowns during UPS operations
# Normal operation: Negative values (e.g., -60, -120)
# Active countdown: Positive values (e.g., 60, 59, 58, 57...)
# Fast polling: Automatically switches to 2-second intervals during countdown
- platform: ups_hid
ups_hid_id: ups_monitor
name: "UPS Timer Shutdown"
id: ups_timer_shutdown
type: ups_timer_shutdown
unit_of_measurement: "s"
device_class: duration
state_class: measurement
accuracy_decimals: 0
icon: "mdi:timer-outline"
web_server:
sorting_group_id: ups_timers
sorting_weight: 10
# Shows countdown during UPS shutdown sequence (e.g., 60→59→58...)
# Negative during normal operation (e.g., -60)
- platform: ups_hid
ups_hid_id: ups_monitor
name: "UPS Timer Start"
id: ups_timer_start
type: ups_timer_start
unit_of_measurement: "s"
device_class: duration
state_class: measurement
accuracy_decimals: 0
icon: "mdi:timer-outline"
web_server:
sorting_group_id: ups_timers
sorting_weight: 20
# Shows countdown during UPS startup sequence (e.g., 120→119→118...)
# Negative during normal operation (e.g., -120)
- platform: ups_hid
ups_hid_id: ups_monitor
name: "UPS Timer Reboot"
id: ups_timer_reboot
type: ups_timer_reboot
unit_of_measurement: "s"
device_class: duration
state_class: measurement
accuracy_decimals: 0
icon: "mdi:timer-outline"
web_server:
sorting_group_id: ups_timers
sorting_weight: 30
# Shows countdown during UPS reboot sequence
# Negative during normal operation
# === TIMER ANALYSIS GROUP ===
# Template sensors to analyze timer behavior and fast polling state
- platform: template
name: "Active Timer Count"
id: active_timer_count
icon: "mdi:timer-alert-outline"
lambda: |-
// Count how many timers are actively counting down (positive values)
int active_count = 0;
float shutdown_timer = id(ups_timer_shutdown).state;
float start_timer = id(ups_timer_start).state;
float reboot_timer = id(ups_timer_reboot).state;
if (!std::isnan(shutdown_timer) && shutdown_timer > 0) active_count++;
if (!std::isnan(start_timer) && start_timer > 0) active_count++;
if (!std::isnan(reboot_timer) && reboot_timer > 0) active_count++;
return (float)active_count;
update_interval: 2s
web_server:
sorting_group_id: ups_timers
sorting_weight: 40
# 0 = No active countdowns, >0 = Timers are counting down
- platform: template
name: "Fast Polling Status"
id: fast_polling_status
icon: "mdi:speedometer"
lambda: |-
// Indicates when fast polling should be active
float active_timers = id(active_timer_count).state;
return (!std::isnan(active_timers) && active_timers > 0) ? 1.0 : 0.0;
update_interval: 2s
entity_category: diagnostic
web_server:
sorting_group_id: ups_timers
sorting_weight: 50
# 1 = Fast polling active (2s intervals), 0 = Normal polling (30s intervals)
# === EXPECTED BEHAVIOR ===
# Normal Operation (Simulation/No UPS Activity):
# - ups_timer_shutdown: -60 (APC: -20, CyberPower: -60)
# - ups_timer_start: -120 (CyberPower), -60 (APC reboot timer)
# - ups_timer_reboot: -60 (varies by protocol)
# - ups_delay_shutdown: 60 (static config)
# - ups_delay_start: 120 (static config)
# - active_timer_count: 0
# - fast_polling_status: 0
# During UPS Shutdown Sequence (Real Hardware):
# - ups_timer_shutdown: 60→59→58→57... (live countdown!)
# - Component switches to 2-second polling automatically
# - active_timer_count: 1
# - fast_polling_status: 1
# - Home Assistant sees real-time countdown updates
# During UPS Startup Sequence (Real Hardware):
# - ups_timer_start: 120→119→118→117... (live countdown!)
# - Component uses fast polling (2-second intervals)
# - active_timer_count: 1
# - fast_polling_status: 1
+100
View File
@@ -0,0 +1,100 @@
# UPS Control Buttons Package with Entity Grouping
# Organized beeper control and UPS testing functionality
# Use with: packages: !include configs/ups_controls_grouped.yaml
button:
# === BEEPER CONTROL GROUP ===
- platform: ups_hid
ups_hid_id: ups_monitor
beeper_action: enable
name: "UPS Beeper Enable"
icon: "mdi:volume-high"
web_server:
sorting_group_id: ups_beeper_controls
sorting_weight: 10
- platform: ups_hid
ups_hid_id: ups_monitor
beeper_action: disable
name: "UPS Beeper Disable"
icon: "mdi:volume-off"
web_server:
sorting_group_id: ups_beeper_controls
sorting_weight: 20
- platform: ups_hid
ups_hid_id: ups_monitor
beeper_action: mute
name: "UPS Beeper Mute"
icon: "mdi:volume-mute"
web_server:
sorting_group_id: ups_beeper_controls
sorting_weight: 30
# Note: Only effective during active alarms
- platform: ups_hid
ups_hid_id: ups_monitor
beeper_action: test
name: "UPS Beeper Test"
icon: "mdi:bell-ring"
web_server:
sorting_group_id: ups_beeper_controls
sorting_weight: 40
# === TEST CONTROL GROUP ===
- platform: ups_hid
ups_hid_id: ups_monitor
test_action: battery_quick
name: "UPS Quick Battery Test"
icon: "mdi:battery-check"
web_server:
sorting_group_id: ups_test_controls
sorting_weight: 10
- platform: ups_hid
ups_hid_id: ups_monitor
test_action: battery_deep
name: "UPS Deep Battery Test"
icon: "mdi:battery-plus"
web_server:
sorting_group_id: ups_test_controls
sorting_weight: 20
- platform: ups_hid
ups_hid_id: ups_monitor
test_action: battery_stop
name: "UPS Stop Battery Test"
icon: "mdi:battery-remove"
web_server:
sorting_group_id: ups_test_controls
sorting_weight: 30
- platform: ups_hid
ups_hid_id: ups_monitor
test_action: ups_test
name: "UPS Panel Test"
icon: "mdi:test-tube"
web_server:
sorting_group_id: ups_test_controls
sorting_weight: 40
- platform: ups_hid
ups_hid_id: ups_monitor
test_action: ups_stop
name: "UPS Stop Panel Test"
icon: "mdi:stop"
web_server:
sorting_group_id: ups_test_controls
sorting_weight: 50
# === TEST CONTROL GROUP - Result Monitoring ===
text_sensor:
- platform: ups_hid
ups_hid_id: ups_monitor
name: "UPS Test Result"
id: ups_test_result
type: ups_test_result
icon: "mdi:test-tube"
web_server:
sorting_group_id: ups_test_controls
sorting_weight: 60