fix(ups-hid): voltage, frequency and runtime

Signed-off-by: bullshit <coding@ow-software.pl>
This commit is contained in:
bullshit committed 2025-08-25 12:45:27 +02:00
1 parent 7015fd2239
commit fe1637a940
11 files changed
+380 -54

No files matched your search

+6 -14
View File
@@ -1,25 +1,23 @@
# Example: APC Back-UPS ES 700 Configuration
# Complete production configuration for APC UPS
# Complete production configuration for APC UPS with European defaults
# Copy and customize this file for your APC device
substitutions:
name: "apc-ups-monitor"
friendly_name: "Office APC UPS"
# Device customization
timezone: "America/Vienna" # Replace with your timezone
# Testing/production mode
simulation_mode: "false" # Set to "true" for testing without hardware
esphome:
name: "${name}"
friendly_name: "${friendly_name}"
comment: "APC Back-UPS ES 700 Monitor"
comment: "APC Back-UPS ES 700 Monitor with European defaults"
# Use modular configuration packages
packages:
# Core functionality
# Regional defaults (European voltage/frequency standards)
regional_defaults: !include ../regional/european_base.yaml
# Core functionality
base_ups: !include ../base_ups.yaml
essential: !include ../essential_sensors.yaml
@@ -32,12 +30,6 @@ packages:
# APC-specific optimizations
apc_device: !include ../device_types/apc_backups_es.yaml
# Time component for accurate timestamps
time:
- platform: sntp
id: sntp_time
timezone: "${timezone}"
# Optional: Home Assistant API (uncomment to enable)
# api:
# encryption:
+11 -3
View File
@@ -1,5 +1,5 @@
# Protocol Selection Demo Configuration
# Demonstrates the new manual protocol selection feature
# Demonstrates the new manual protocol selection feature with European defaults
substitutions:
name: "ups-protocol-demo"
@@ -9,10 +9,14 @@ substitutions:
esphome:
name: "${name}"
friendly_name: "${friendly_name}"
comment: "Demonstration of manual protocol selection"
comment: "Demonstration of manual protocol selection with European defaults"
# Use base configuration package
# Use modular configuration packages
packages:
# Regional defaults (European voltage/frequency standards)
regional_defaults: !include ../regional/european_base.yaml
# Base functionality
base_ups: !include ../base_ups.yaml
essential: !include ../essential_sensors.yaml
@@ -29,6 +33,10 @@ ups_hid:
# protocol: cyberpower # Force CyberPower HID Protocol
# protocol: generic # Force Generic HID Protocol
# Platform stubs for compilation
button:
binary_sensor:
# Enhanced logging to see protocol selection
logger:
level: DEBUG
+8 -13
View File
@@ -1,24 +1,25 @@
# Example: CyberPower CP1500EPFCLCD Configuration
# Complete production configuration for CyberPower UPS
# Complete production configuration for CyberPower UPS with European defaults
# Copy and customize this file for your CyberPower device
substitutions:
name: "rack-ups-monitor"
friendly_name: "Rack CyberPower UPS"
# Device customization
timezone: "America/Vienna" # Replace with your timezone
# Testing/production mode
simulation_mode: "false" # Set to "true" for testing without hardware
# Override timezone if needed (defaults to Europe/Warsaw from regional template)
timezone: "Europe/Vienna" # Austrian timezone
esphome:
name: "${name}"
friendly_name: "${friendly_name}"
comment: "CyberPower CP1500EPFCLCD Monitor"
comment: "CyberPower CP1500EPFCLCD Monitor with European defaults"
# Use modular configuration packages
packages:
# Regional defaults (European voltage/frequency standards)
regional_defaults: !include ../regional/european_base.yaml
# Core functionality
base_ups: !include ../base_ups.yaml
essential: !include ../essential_sensors.yaml
@@ -32,12 +33,6 @@ packages:
# CyberPower-specific optimizations
cyberpower_device: !include ../device_types/cyberpower_cp1500.yaml
# Time component for accurate timestamps
time:
- platform: sntp
id: sntp_time
timezone: "${timezone}"
# Optional: Home Assistant API (uncomment to enable)
# api:
# encryption:
+31
View File
@@ -0,0 +1,31 @@
# European Base Configuration (No Secrets Required)
# Basic European electrical standards without network/API configuration
# Use this for examples and basic templates
substitutions:
# European regional defaults
timezone: "Europe/Warsaw" # Default European timezone
# Base UPS configuration with European defaults
ups_hid:
id: ups_monitor
update_interval: 30s
protocol_timeout: 15s
protocol: auto
fallback_nominal_voltage: 230.0 # European standard voltage - used only when AC power unavailable
simulation_mode: false
# Time configuration with European timezone
time:
- platform: sntp
id: sntp_time
timezone: ${timezone}
servers:
- "pool.ntp.org"
- "time.nist.gov"
# Logging optimized for European users
logger:
level: INFO
logs:
ups_hid: INFO
+26 -11
View File
@@ -1,19 +1,43 @@
# European Voltage Defaults
# Configuration template for European electrical standards (IEC 60038)
# Configuration template for European electrical standards (IEC 60038)
# Use this as a base for European installations
# Test configuration for frequency implementation and European defaults
substitutions:
# Device configuration
name: "european-ups-test"
friendly_name: "European UPS Test"
# European electrical standards
nominal_voltage: "230V" # Standard European single-phase voltage (IEC 60038)
frequency: "50Hz" # European frequency standard
# Regional timezone examples (adjust for your location)
timezone: "Europe/Berlin" # Germany
timezone: "Europe/Warsaw" # Poland
# timezone: "Europe/Vienna" # Austria
# timezone: "Europe/Berlin" # Germany
# timezone: "Europe/London" # United Kingdom
# timezone: "Europe/Paris" # France
# timezone: "Europe/Rome" # Italy
# timezone: "Europe/Madrid" # Spain
esphome:
name: ${name}
friendly_name: ${friendly_name}
comment: "Testing European defaults and frequency implementation"
# Core ESP32 configuration
esp32:
board: esp32-s3-devkitc-1
framework:
type: esp-idf
# External components
external_components:
- source:
type: local
path: ../../components
# Base UPS configuration with European defaults
ups_hid:
id: ups_monitor
@@ -40,17 +64,8 @@ logger:
# WiFi configuration template
wifi:
# Configure your WiFi credentials
ssid: !secret wifi_ssid
password: !secret wifi_password
# European WiFi channel optimization (1-13 allowed in EU)
channel: 6
# Enable fast connect for better reconnection
fast_connect: true
# Access point fallback (if main WiFi fails)
ap:
ssid: "${friendly_name} AP"
password: !secret ap_password
+31
View File
@@ -0,0 +1,31 @@
# North American Base Configuration (No Secrets Required)
# Basic North American electrical standards without network/API configuration
# Use this for examples and basic templates
substitutions:
# North American regional defaults
timezone: "America/New_York" # Default North American timezone (Eastern Time)
# Base UPS configuration with North American defaults
ups_hid:
id: ups_monitor
update_interval: 30s
protocol_timeout: 15s
protocol: auto
fallback_nominal_voltage: 120.0 # North American standard voltage - used only when AC power unavailable
simulation_mode: false
# Time configuration with North American timezone
time:
- platform: sntp
id: sntp_time
timezone: ${timezone}
servers:
- "pool.ntp.org"
- "time.nist.gov"
# Logging optimized for North American users
logger:
level: INFO
logs:
ups_hid: INFO
@@ -39,17 +39,8 @@ logger:
# WiFi configuration template
wifi:
# Configure your WiFi credentials
ssid: !secret wifi_ssid
password: !secret wifi_password
# North American WiFi channel optimization (1-11 allowed in US/Canada)
channel: 6
# Enable fast connect for better reconnection
fast_connect: true
# Access point fallback (if main WiFi fails)
ap:
ssid: "${friendly_name} AP"
password: !secret ap_password
@@ -0,0 +1,81 @@
# North American Regional Template Test Configuration
# Tests North American regional defaults (120V/60Hz)
# Use: esphome compile configs/testing/north_american_template_test.yaml
substitutions:
name: "north-american-test"
friendly_name: "North American Test"
simulation_mode: "true" # Safe testing without hardware
esphome:
name: "${name}"
friendly_name: "${friendly_name}"
comment: "Testing North American regional template (120V/60Hz)"
# Core ESP32 configuration
esp32:
board: esp32-s3-devkitc-1
framework:
type: esp-idf
# Minimal logging
logger:
level: INFO
baud_rate: 115200
# Basic network
wifi:
ssid: "TestNetwork"
password: "TestPassword"
# External components
external_components:
- source:
type: local
path: ../../components
# Use North American regional template
packages:
regional_defaults: !include ../regional/north_american_defaults.yaml
# UPS component (inherits North American defaults from regional template)
ups_hid:
id: ups_monitor
update_interval: 30s
simulation_mode: ${simulation_mode}
# fallback_nominal_voltage comes from regional template (120V North American)
# Platform stubs
binary_sensor:
button:
# Test sensors to validate North American regional defaults
sensor:
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Battery Level"
type: battery_level
unit_of_measurement: "%"
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Input Voltage (North American 120V)"
type: input_voltage
unit_of_measurement: "V"
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Input Frequency (North American 60Hz)"
type: frequency
unit_of_measurement: "Hz"
text_sensor:
- platform: ups_hid
ups_hid_id: ups_monitor
name: "UPS Status"
type: status
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Protocol Name"
type: protocol
@@ -0,0 +1,81 @@
# Regional Template Test Configuration
# Tests both European and North American regional defaults
# Use: esphome compile configs/testing/regional_template_test.yaml
substitutions:
name: "regional-template-test"
friendly_name: "Regional Template Test"
simulation_mode: "true" # Safe testing without hardware
esphome:
name: "${name}"
friendly_name: "${friendly_name}"
comment: "Testing regional template functionality and defaults"
# Core ESP32 configuration
esp32:
board: esp32-s3-devkitc-1
framework:
type: esp-idf
# Minimal logging
logger:
level: INFO
baud_rate: 115200
# Basic network
wifi:
ssid: "TestNetwork"
password: "TestPassword"
# External components
external_components:
- source:
type: local
path: ../../components
# Use European regional template (can be changed to ../regional/north_american_defaults.yaml)
packages:
regional_defaults: !include ../regional/european_defaults.yaml
# UPS component (inherits European defaults from regional template)
ups_hid:
id: ups_monitor
update_interval: 30s
simulation_mode: ${simulation_mode}
# fallback_nominal_voltage comes from regional template (230V European)
# Platform stubs
binary_sensor:
button:
# Test sensors to validate regional defaults
sensor:
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Battery Level"
type: battery_level
unit_of_measurement: "%"
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Input Voltage (European 230V)"
type: input_voltage
unit_of_measurement: "V"
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Input Frequency (European 50Hz)"
type: frequency
unit_of_measurement: "Hz"
text_sensor:
- platform: ups_hid
ups_hid_id: ups_monitor
name: "UPS Status"
type: status
- platform: ups_hid
ups_hid_id: ups_monitor
name: "Protocol Name"
type: protocol