Public Access
chore: adding configuration
Signed-off-by: bullshit <coding@ow-software.pl>
This commit is contained in:
2 files changed
+369
No files matched your search
+251
@@ -0,0 +1,251 @@
|
||||
esphome:
|
||||
name: nut-ups-monitor
|
||||
friendly_name: "NUT UPS Monitor"
|
||||
|
||||
esp32:
|
||||
board: esp32-s3-devkitc-1
|
||||
framework:
|
||||
type: arduino
|
||||
version: recommended
|
||||
|
||||
# Enable logging
|
||||
logger:
|
||||
level: DEBUG
|
||||
|
||||
# Enable Home Assistant API
|
||||
api:
|
||||
encryption:
|
||||
key: !secret api_encryption_key
|
||||
|
||||
ota:
|
||||
- platform: esphome
|
||||
password: !secret ota_password
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_password
|
||||
ap:
|
||||
ssid: "NUT-UPS-Monitor"
|
||||
password: !secret ap_password
|
||||
|
||||
captive_portal:
|
||||
web_server:
|
||||
|
||||
# Time component
|
||||
time:
|
||||
- platform: sntp
|
||||
id: sntp_time
|
||||
|
||||
# RGB LED for status indication
|
||||
light:
|
||||
- platform: esp32_rmt_led_strip
|
||||
rgb_order: GRB
|
||||
pin: GPIO38
|
||||
num_leds: 1
|
||||
# rmt_channel: 0 @INFO: esp32_rmt_led_strip does manage the rmt channel
|
||||
chipset: ws2812
|
||||
name: "UPS Status LED"
|
||||
id: status_led
|
||||
effects:
|
||||
- strobe:
|
||||
name: "Critical Strobe"
|
||||
colors:
|
||||
- state: true
|
||||
brightness: 100%
|
||||
red: 100%
|
||||
green: 0%
|
||||
blue: 0%
|
||||
duration: 250ms
|
||||
- state: false
|
||||
duration: 250ms
|
||||
|
||||
# External components
|
||||
external_components:
|
||||
- source:
|
||||
type: local
|
||||
path: components
|
||||
|
||||
# NUT UPS Component
|
||||
nut_ups:
|
||||
id: ups_monitor
|
||||
simulation_mode: true # Set to false for production
|
||||
update_interval: 5s
|
||||
usb_vendor_id: 0x051d # APC vendor ID
|
||||
usb_product_id: 0x0002 # Back-UPS ES series
|
||||
protocol_timeout: 10s
|
||||
auto_detect_protocol: true
|
||||
|
||||
# Sensors
|
||||
sensor:
|
||||
- platform: nut_ups
|
||||
nut_ups_id: ups_monitor
|
||||
name: "UPS Battery Level"
|
||||
id: ups_battery_level
|
||||
type: battery_level
|
||||
unit_of_measurement: "%"
|
||||
device_class: battery
|
||||
state_class: measurement
|
||||
accuracy_decimals: 0
|
||||
|
||||
- platform: nut_ups
|
||||
nut_ups_id: ups_monitor
|
||||
name: "UPS Input Voltage"
|
||||
id: ups_input_voltage
|
||||
type: input_voltage
|
||||
unit_of_measurement: "V"
|
||||
device_class: voltage
|
||||
state_class: measurement
|
||||
accuracy_decimals: 1
|
||||
|
||||
- platform: nut_ups
|
||||
nut_ups_id: ups_monitor
|
||||
name: "UPS Output Voltage"
|
||||
id: ups_output_voltage
|
||||
type: output_voltage
|
||||
unit_of_measurement: "V"
|
||||
device_class: voltage
|
||||
state_class: measurement
|
||||
accuracy_decimals: 1
|
||||
|
||||
- platform: nut_ups
|
||||
nut_ups_id: ups_monitor
|
||||
name: "UPS Load"
|
||||
id: ups_load
|
||||
type: load_percent
|
||||
unit_of_measurement: "%"
|
||||
device_class: power_factor
|
||||
state_class: measurement
|
||||
accuracy_decimals: 0
|
||||
|
||||
- platform: nut_ups
|
||||
nut_ups_id: ups_monitor
|
||||
name: "UPS Runtime"
|
||||
id: ups_runtime
|
||||
type: runtime
|
||||
unit_of_measurement: "min"
|
||||
device_class: duration
|
||||
state_class: measurement
|
||||
accuracy_decimals: 0
|
||||
|
||||
- platform: nut_ups
|
||||
nut_ups_id: ups_monitor
|
||||
name: "UPS Frequency"
|
||||
id: ups_frequency
|
||||
type: frequency
|
||||
unit_of_measurement: "Hz"
|
||||
state_class: measurement
|
||||
accuracy_decimals: 1
|
||||
|
||||
# Binary Sensors
|
||||
binary_sensor:
|
||||
- platform: nut_ups
|
||||
nut_ups_id: ups_monitor
|
||||
name: "UPS Online"
|
||||
id: ups_online
|
||||
type: online
|
||||
device_class: connectivity
|
||||
|
||||
- platform: nut_ups
|
||||
nut_ups_id: ups_monitor
|
||||
name: "UPS On Battery"
|
||||
id: ups_on_battery
|
||||
type: on_battery
|
||||
device_class: battery
|
||||
|
||||
- platform: nut_ups
|
||||
nut_ups_id: ups_monitor
|
||||
name: "UPS Low Battery"
|
||||
id: ups_low_battery
|
||||
type: low_battery
|
||||
device_class: battery
|
||||
|
||||
- platform: nut_ups
|
||||
nut_ups_id: ups_monitor
|
||||
name: "UPS Fault"
|
||||
id: ups_fault
|
||||
type: fault
|
||||
device_class: problem
|
||||
|
||||
# Text Sensors
|
||||
text_sensor:
|
||||
- platform: nut_ups
|
||||
nut_ups_id: ups_monitor
|
||||
name: "UPS Model"
|
||||
id: ups_model
|
||||
type: model
|
||||
|
||||
- platform: nut_ups
|
||||
nut_ups_id: ups_monitor
|
||||
name: "UPS Manufacturer"
|
||||
id: ups_manufacturer
|
||||
type: manufacturer
|
||||
|
||||
- platform: nut_ups
|
||||
nut_ups_id: ups_monitor
|
||||
name: "UPS Status"
|
||||
id: ups_status
|
||||
type: status
|
||||
|
||||
- platform: nut_ups
|
||||
nut_ups_id: ups_monitor
|
||||
name: "UPS Protocol"
|
||||
id: ups_protocol
|
||||
type: protocol
|
||||
|
||||
# LED Status Automation using interval (most reliable approach)
|
||||
interval:
|
||||
- interval: 1s
|
||||
then:
|
||||
- lambda: |-
|
||||
// Critical conditions (highest priority)
|
||||
if (id(ups_low_battery).state || id(ups_fault).state) {
|
||||
auto call = id(status_led).turn_on();
|
||||
call.set_brightness(1.0);
|
||||
call.set_effect("Critical Strobe");
|
||||
call.perform();
|
||||
}
|
||||
// On battery (medium priority)
|
||||
else if (id(ups_on_battery).state && !id(ups_low_battery).state) {
|
||||
auto call = id(status_led).turn_on();
|
||||
call.set_brightness(0.75);
|
||||
call.set_rgb(1.0, 0.5, 0.0); // Orange
|
||||
call.set_effect("None");
|
||||
call.perform();
|
||||
}
|
||||
// Normal operation (online, not on battery)
|
||||
else if (id(ups_online).state && !id(ups_on_battery).state && !id(ups_low_battery).state) {
|
||||
auto call = id(status_led).turn_on();
|
||||
call.set_brightness(0.5);
|
||||
call.set_rgb(0.0, 1.0, 0.0); // Green
|
||||
call.set_effect("None");
|
||||
call.perform();
|
||||
}
|
||||
// Offline (lowest priority)
|
||||
else {
|
||||
auto call = id(status_led).turn_off();
|
||||
call.perform();
|
||||
}
|
||||
|
||||
# Home Assistant Dashboard Card Configuration (as comment for reference)
|
||||
# dashboard_card: |
|
||||
# type: entities
|
||||
# title: UPS Monitor
|
||||
# entities:
|
||||
# - entity: sensor.ups_battery_level
|
||||
# name: Battery Level
|
||||
# - entity: sensor.ups_input_voltage
|
||||
# name: Input Voltage
|
||||
# - entity: sensor.ups_output_voltage
|
||||
# name: Output Voltage
|
||||
# - entity: sensor.ups_load
|
||||
# name: Load
|
||||
# - entity: sensor.ups_runtime
|
||||
# name: Runtime Remaining
|
||||
# - entity: binary_sensor.ups_online
|
||||
# name: Online Status
|
||||
# - entity: binary_sensor.ups_on_battery
|
||||
# name: On Battery
|
||||
# - entity: text_sensor.ups_model
|
||||
# name: Model
|
||||
# - entity: text_sensor.ups_status
|
||||
# name: Status
|
||||
@@ -0,0 +1,118 @@
|
||||
esphome:
|
||||
name: nut-ups-monitor
|
||||
friendly_name: "NUT UPS Monitor"
|
||||
|
||||
esp32:
|
||||
board: esp32-s3-devkitc-1
|
||||
framework:
|
||||
type: arduino
|
||||
version: recommended
|
||||
|
||||
# Enable logging
|
||||
logger:
|
||||
level: DEBUG
|
||||
|
||||
# Enable Home Assistant API
|
||||
api:
|
||||
encryption:
|
||||
key: !secret api_encryption_key
|
||||
|
||||
ota:
|
||||
- platform: esphome
|
||||
password: !secret ota_password
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_password
|
||||
ap:
|
||||
ssid: "NUT-UPS-Monitor"
|
||||
password: !secret ap_password
|
||||
|
||||
captive_portal:
|
||||
web_server:
|
||||
|
||||
# RGB LED for status indication
|
||||
light:
|
||||
- platform: esp32_rmt_led_strip
|
||||
rgb_order: GRB
|
||||
pin: GPIO38
|
||||
num_leds: 1
|
||||
# rmt_channel: 0 @INFO: esp32_rmt_led_strip does manage the rmt channel
|
||||
chipset: ws2812
|
||||
name: "UPS Status LED"
|
||||
id: status_led
|
||||
effects:
|
||||
- strobe:
|
||||
name: "Critical Strobe"
|
||||
colors:
|
||||
- state: true
|
||||
brightness: 100%
|
||||
red: 100%
|
||||
green: 0%
|
||||
blue: 0%
|
||||
duration: 250ms
|
||||
- state: false
|
||||
duration: 250ms
|
||||
|
||||
# External components
|
||||
external_components:
|
||||
- source:
|
||||
type: local
|
||||
path: components
|
||||
|
||||
# NUT UPS Component
|
||||
nut_ups:
|
||||
id: ups_monitor
|
||||
simulation_mode: true # Set to false for production
|
||||
update_interval: 5s
|
||||
usb_vendor_id: 0x051d # APC vendor ID
|
||||
usb_product_id: 0x0002 # Back-UPS ES series
|
||||
protocol_timeout: 10s
|
||||
auto_detect_protocol: true
|
||||
|
||||
# Sensors
|
||||
sensor:
|
||||
- platform: nut_ups
|
||||
nut_ups_id: ups_monitor
|
||||
name: "UPS Battery Level"
|
||||
id: ups_battery_level
|
||||
type: battery_level
|
||||
unit_of_measurement: "%"
|
||||
device_class: battery
|
||||
state_class: measurement
|
||||
accuracy_decimals: 0
|
||||
|
||||
- platform: nut_ups
|
||||
nut_ups_id: ups_monitor
|
||||
name: "UPS Runtime"
|
||||
id: ups_runtime
|
||||
type: runtime
|
||||
unit_of_measurement: "min"
|
||||
device_class: duration
|
||||
state_class: measurement
|
||||
accuracy_decimals: 0
|
||||
|
||||
# Binary Sensors
|
||||
binary_sensor:
|
||||
- platform: nut_ups
|
||||
nut_ups_id: ups_monitor
|
||||
name: "UPS On Battery"
|
||||
id: ups_on_battery
|
||||
type: on_battery
|
||||
device_class: battery
|
||||
|
||||
- platform: nut_ups
|
||||
nut_ups_id: ups_monitor
|
||||
name: "UPS Fault"
|
||||
id: ups_fault
|
||||
type: fault
|
||||
device_class: problem
|
||||
|
||||
dashboard_card: |
|
||||
type: entities
|
||||
title: UPS Monitor
|
||||
entities:
|
||||
- entity: sensor.ups_battery_level
|
||||
name: Battery Level
|
||||
- entity: binary_sensor.ups_on_battery
|
||||
name: On Battery
|
||||
Reference in new issue
Block a user