Public Access
feat(ups-hid): further validate implementation and adding files
Signed-off-by: bullshit <coding@ow-software.pl>
This commit is contained in:
12 files changed
+585
-394
No files matched your search
@@ -57,7 +57,7 @@ web_server:
|
||||
external_components:
|
||||
- source:
|
||||
type: local
|
||||
path: ../components
|
||||
path: ../../components
|
||||
|
||||
# Main UPS HID Component
|
||||
ups_hid:
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
# Gitignore settings for ESPHome
|
||||
# This is an example and may include too much for your use-case.
|
||||
# You can modify this file to suit your needs.
|
||||
/.esphome/
|
||||
/secrets.yaml
|
||||
@@ -13,9 +13,6 @@ esphome:
|
||||
friendly_name: "${friendly_name}"
|
||||
comment: "Basic UPS HID functionality test"
|
||||
|
||||
# Include secrets from root directory
|
||||
<<: !include ../../secrets.yaml
|
||||
|
||||
# Use base configuration package
|
||||
packages:
|
||||
base_ups: !include ../base_ups.yaml
|
||||
|
||||
@@ -1,163 +0,0 @@
|
||||
# Basic UPS Testing Configuration (Standalone)
|
||||
# Self-contained version that doesn't depend on external files for CI/CD
|
||||
# Use: esphome compile configs/testing/basic_test_standalone.yaml
|
||||
|
||||
substitutions:
|
||||
name: "ups-basic-test"
|
||||
friendly_name: "UPS Basic Test"
|
||||
simulation_mode: "false"
|
||||
log_level: "DEBUG"
|
||||
|
||||
esphome:
|
||||
name: "${name}"
|
||||
friendly_name: "${friendly_name}"
|
||||
comment: "Basic UPS HID functionality test"
|
||||
|
||||
# Core ESP32 configuration
|
||||
esp32:
|
||||
board: esp32-s3-devkitc-1
|
||||
framework:
|
||||
type: esp-idf
|
||||
|
||||
# Logging configuration
|
||||
logger:
|
||||
level: VERBOSE
|
||||
baud_rate: 115200
|
||||
hardware_uart: UART0
|
||||
logs:
|
||||
ups_hid: DEBUG
|
||||
ups_hid.apc: DEBUG
|
||||
ups_hid.cyberpower: DEBUG
|
||||
ups_hid.generic: DEBUG
|
||||
usb_host: DEBUG
|
||||
|
||||
# Network configuration (minimal for testing)
|
||||
wifi:
|
||||
ssid: "TestNetwork"
|
||||
password: "TestPassword"
|
||||
ap:
|
||||
ssid: "${friendly_name} Fallback"
|
||||
password: "TestAPPassword"
|
||||
|
||||
captive_portal:
|
||||
|
||||
# OTA updates
|
||||
ota:
|
||||
- platform: esphome
|
||||
password: "TestOTAPassword"
|
||||
|
||||
# Web server for diagnostics
|
||||
web_server:
|
||||
port: 80
|
||||
|
||||
# External components
|
||||
external_components:
|
||||
- source:
|
||||
type: local
|
||||
path: ../../components
|
||||
|
||||
# Main UPS HID Component
|
||||
ups_hid:
|
||||
id: ups_monitor
|
||||
update_interval: 5s
|
||||
protocol_timeout: 10s
|
||||
auto_detect_protocol: true
|
||||
simulation_mode: ${simulation_mode}
|
||||
|
||||
# Status LED configuration
|
||||
light:
|
||||
- platform: esp32_rmt_led_strip
|
||||
chipset: WS2812
|
||||
pin: GPIO48
|
||||
num_leds: 1
|
||||
rgb_order: GRB
|
||||
name: "UPS Status LED"
|
||||
id: ups_status_led
|
||||
restore_mode: ALWAYS_OFF
|
||||
|
||||
# Required platform components (fix compilation errors)
|
||||
button:
|
||||
|
||||
# Essential binary sensors
|
||||
binary_sensor:
|
||||
- platform: ups_hid
|
||||
ups_hid_id: ups_monitor
|
||||
name: "UPS Online"
|
||||
id: ups_online
|
||||
type: online
|
||||
device_class: connectivity
|
||||
|
||||
- platform: ups_hid
|
||||
ups_hid_id: ups_monitor
|
||||
name: "On Battery Power"
|
||||
id: on_battery
|
||||
type: on_battery
|
||||
device_class: battery
|
||||
|
||||
- platform: ups_hid
|
||||
ups_hid_id: ups_monitor
|
||||
name: "Low Battery Warning"
|
||||
id: low_battery
|
||||
type: low_battery
|
||||
device_class: battery
|
||||
|
||||
- platform: ups_hid
|
||||
ups_hid_id: ups_monitor
|
||||
name: "UPS Fault"
|
||||
id: ups_fault
|
||||
type: fault
|
||||
device_class: problem
|
||||
|
||||
# Essential text sensors
|
||||
text_sensor:
|
||||
- platform: ups_hid
|
||||
ups_hid_id: ups_monitor
|
||||
name: "UPS Status"
|
||||
id: ups_status_text
|
||||
type: status
|
||||
|
||||
- platform: ups_hid
|
||||
ups_hid_id: ups_monitor
|
||||
name: "Detected Protocol"
|
||||
id: ups_protocol
|
||||
type: protocol
|
||||
|
||||
# Core UPS metrics
|
||||
sensor:
|
||||
- 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
|
||||
|
||||
- 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
|
||||
|
||||
# Simple test validation script
|
||||
script:
|
||||
- id: test_validation
|
||||
then:
|
||||
- logger.log:
|
||||
format: "TEST RESULTS - Protocol: %s, Battery: %.1f%%, Status: %s"
|
||||
args:
|
||||
- "id(ups_protocol).state.c_str()"
|
||||
- "id(battery_level).state"
|
||||
- "id(ups_status_text).state.c_str()"
|
||||
level: INFO
|
||||
|
||||
# Run validation every 30 seconds during testing
|
||||
interval:
|
||||
- interval: 30s
|
||||
then:
|
||||
- script.execute: test_validation
|
||||
@@ -13,8 +13,6 @@ esphome:
|
||||
friendly_name: "${friendly_name}"
|
||||
comment: "UPS beeper control functionality test"
|
||||
|
||||
# Include secrets from root directory
|
||||
<<: !include ../../secrets.yaml
|
||||
|
||||
# Use base configuration and controls package
|
||||
packages:
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
# Auto-generated test config for ESPHome matrix testing
|
||||
substitutions:
|
||||
device_name: "ups-matrix-test"
|
||||
friendly_name: "UPS Matrix Test"
|
||||
|
||||
esphome:
|
||||
name: ${device_name}
|
||||
friendly_name: ${friendly_name}
|
||||
|
||||
esp32:
|
||||
board: esp32-s3-devkitc-1
|
||||
framework:
|
||||
type: esp-idf
|
||||
version: 5.3.0
|
||||
|
||||
logger:
|
||||
level: INFO
|
||||
|
||||
external_components:
|
||||
- source: components/
|
||||
components: [ ups_hid ]
|
||||
|
||||
ups_hid:
|
||||
id: ups_monitor
|
||||
update_interval: 30s
|
||||
simulation_mode: true
|
||||
auto_detect_protocol: true
|
||||
|
||||
sensor:
|
||||
- platform: ups_hid
|
||||
ups_hid_id: ups_monitor
|
||||
type: battery_level
|
||||
name: "Battery Level"
|
||||
@@ -13,8 +13,6 @@ esphome:
|
||||
friendly_name: "${friendly_name}"
|
||||
comment: "UPS simulation mode test (no hardware required)"
|
||||
|
||||
# Include secrets from root directory
|
||||
<<: !include ../../secrets.yaml
|
||||
|
||||
# Use base configuration packages
|
||||
packages:
|
||||
|
||||
@@ -1,190 +0,0 @@
|
||||
# UPS Simulation Testing Configuration (Standalone)
|
||||
# Testing without physical hardware using simulation mode
|
||||
# Use: esphome compile configs/testing/simulation_test_standalone.yaml
|
||||
|
||||
substitutions:
|
||||
name: "ups-simulation-test"
|
||||
friendly_name: "UPS Simulation Test"
|
||||
simulation_mode: "true" # Enable simulation mode
|
||||
log_level: "INFO"
|
||||
|
||||
esphome:
|
||||
name: "${name}"
|
||||
friendly_name: "${friendly_name}"
|
||||
comment: "UPS simulation mode test (no hardware required)"
|
||||
|
||||
# Core ESP32 configuration
|
||||
esp32:
|
||||
board: esp32-s3-devkitc-1
|
||||
framework:
|
||||
type: esp-idf
|
||||
|
||||
# Reduced logging for simulation
|
||||
logger:
|
||||
level: ${log_level}
|
||||
baud_rate: 115200
|
||||
hardware_uart: UART0
|
||||
logs:
|
||||
ups_hid: INFO
|
||||
|
||||
# Network configuration (minimal for testing)
|
||||
wifi:
|
||||
ssid: "TestNetwork"
|
||||
password: "TestPassword"
|
||||
ap:
|
||||
ssid: "${friendly_name} Fallback"
|
||||
password: "TestAPPassword"
|
||||
|
||||
captive_portal:
|
||||
|
||||
# OTA updates
|
||||
ota:
|
||||
- platform: esphome
|
||||
password: "TestOTAPassword"
|
||||
|
||||
# Web server for diagnostics
|
||||
web_server:
|
||||
port: 80
|
||||
|
||||
# External components
|
||||
external_components:
|
||||
- source:
|
||||
type: local
|
||||
path: ../../components
|
||||
|
||||
# Required platform components (fix compilation errors)
|
||||
button:
|
||||
|
||||
# Override for simulation testing
|
||||
ups_hid:
|
||||
id: ups_monitor
|
||||
update_interval: 5s # Fast updates for demo
|
||||
protocol_timeout: 5s
|
||||
auto_detect_protocol: true
|
||||
simulation_mode: ${simulation_mode}
|
||||
|
||||
# Status LED configuration
|
||||
light:
|
||||
- platform: esp32_rmt_led_strip
|
||||
chipset: WS2812
|
||||
pin: GPIO48
|
||||
num_leds: 1
|
||||
rgb_order: GRB
|
||||
name: "UPS Status LED"
|
||||
id: ups_status_led
|
||||
restore_mode: ALWAYS_OFF
|
||||
|
||||
# Essential binary sensors
|
||||
binary_sensor:
|
||||
- platform: ups_hid
|
||||
ups_hid_id: ups_monitor
|
||||
name: "UPS Online"
|
||||
id: ups_online
|
||||
type: online
|
||||
device_class: connectivity
|
||||
|
||||
- platform: ups_hid
|
||||
ups_hid_id: ups_monitor
|
||||
name: "On Battery Power"
|
||||
id: on_battery
|
||||
type: on_battery
|
||||
device_class: battery
|
||||
|
||||
- platform: ups_hid
|
||||
ups_hid_id: ups_monitor
|
||||
name: "Low Battery Warning"
|
||||
id: low_battery
|
||||
type: low_battery
|
||||
device_class: battery
|
||||
|
||||
- platform: ups_hid
|
||||
ups_hid_id: ups_monitor
|
||||
name: "UPS Fault"
|
||||
id: ups_fault
|
||||
type: fault
|
||||
device_class: problem
|
||||
|
||||
# Essential text sensors
|
||||
text_sensor:
|
||||
- platform: ups_hid
|
||||
ups_hid_id: ups_monitor
|
||||
name: "UPS Status"
|
||||
id: ups_status_text
|
||||
type: status
|
||||
|
||||
- platform: ups_hid
|
||||
ups_hid_id: ups_monitor
|
||||
name: "Detected Protocol"
|
||||
id: ups_protocol
|
||||
type: protocol
|
||||
|
||||
# Core UPS metrics - available on all protocols
|
||||
sensor:
|
||||
- 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
|
||||
|
||||
- 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
|
||||
|
||||
- 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
|
||||
|
||||
- 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
|
||||
|
||||
- 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
|
||||
|
||||
# Simulation validation script
|
||||
script:
|
||||
- id: simulation_demo
|
||||
then:
|
||||
- logger.log:
|
||||
format: "SIMULATION DATA - Battery: %.1f%%, Load: %.1f%%, Input: %.1fV, Output: %.1fV"
|
||||
args:
|
||||
- "id(battery_level).state"
|
||||
- "id(load_percentage).state"
|
||||
- "id(input_voltage).state"
|
||||
- "id(output_voltage).state"
|
||||
level: INFO
|
||||
|
||||
# Demo data updates every 10 seconds
|
||||
interval:
|
||||
- interval: 10s
|
||||
then:
|
||||
- script.execute: simulation_demo
|
||||
Reference in new issue
Block a user