Hi,
I have the same UPS. How did you setup the UPS to communicate with HA?
I currently just have my UPS connected with USB to a NAS-server so it can shutdown safely, but I’d like to monitor it in HA and use this card.
Network UPS tools (NUT) most likely. It’s compatible with most major manufacturers. Look in addons if you are running HAOS. Otherwise search online for NUT
sorry for the late reponse, but here it is:
#############################################
####### APC UPS 2200 Network card 9630 ######
#############################################
- platform: snmp
name: ups_smart_capacity_2
host: 192.168.178.12
baseoid: 1.3.6.1.4.1.318.1.1.1.2.2.1.0
accept_errors: true
unit_of_measurement: '%'
- platform: snmp
name: ups_smart_runtime_remaining_2
host: 192.168.178.12
baseoid: 1.3.6.1.4.1.318.1.1.1.2.2.3.0
accept_errors: true
value_template: >-
{% set time = (value | int) / 100 | int %}
{% set minutes = ((time % 3600) / 60) | int %}
{% set hours = ((time % 86400) / 3600) | int %}
{% set days = (time / 86400) | int %}
{%- if time < 60 -%}
Less than a minute
{%- else -%}
{%- if days > 0 -%}
{{ days }}d
{%- endif -%}
{%- if hours > 0 -%}
{%- if days > 0 -%}
{{ ' ' }}
{%- endif -%}
{{ hours }}h
{%- endif -%}
{%- if minutes > 0 -%}
{%- if days > 0 or hours > 0 -%}
{{ ' ' }}
{%- endif -%}
{{ minutes }}m
{%- endif -%}
{%- endif -%}
- platform: snmp
name: ups_smart_load_percentage_2
host: 192.168.178.12
baseoid: 1.3.6.1.4.1.318.1.1.1.4.2.3.0
accept_errors: true
unit_of_measurement: '%'
- platform: snmp
name: ups_smart_battery_temperature_2
host: 192.168.178.12
baseoid: 1.3.6.1.4.1.318.1.1.1.2.2.2.0
accept_errors: true
unit_of_measurement: '°C'
- platform: snmp
name: ups_smart_battery_status_2
host: 192.168.178.12
baseoid: 1.3.6.1.4.1.318.1.1.1.2.2.4.0
accept_errors: true
value_template: >-
{%if value == '1' %}
Good
{% elif value == '2' %}
Failed
{% endif %}
- platform: snmp
name: ups_smart_type_2
host: 192.168.178.12
baseoid: 1.3.6.1.4.1.318.1.1.1.1.1.1.0
accept_errors: true
- platform: snmp
name: ups_smart_input_voltage_2
host: 192.168.178.12
baseoid: 1.3.6.1.4.1.318.1.1.1.3.2.1.0
accept_errors: true
unit_of_measurement: 'V'
- platform: snmp
name: ups_smart_last_transfer_reason_2
host: 192.168.178.12
baseoid: 1.3.6.1.4.1.318.1.1.1.3.2.5.0
accept_errors: true
value_template: >-
{%if value == '1' %}
No events
{% elif value == '2' %}
High line voltage
{% elif value == '3' %}
Brownout
{% elif value == '4' %}
Loss of mains power
{% elif value == '5' %}
Small temporary power drop
{% elif value == '6' %}
Large temporary power drop
{% elif value == '7' %}
Small spike
{% elif value == '8' %}
Large spike
{% elif value == '9' %}
UPS self test
{% elif value == '10' %}
Excessive input voltage fluctuation
{% endif %}
- platform: snmp
name: ups_smart_output_load_2
host: 192.168.178.12
baseoid: 1.3.6.1.4.1.318.1.1.1.4.2.3.0
accept_errors: true
unit_of_measurement: '%'
- platform: snmp
name: ups_smart_output_current_2
host: 192.168.178.12
baseoid: 1.3.6.1.4.1.318.1.1.1.4.2.4.0
accept_errors: true
unit_of_measurement: 'A'
- platform: snmp
name: ups_smart_last_self_test_result_2
host: 192.168.178.12
baseoid: 1.3.6.1.4.1.318.1.1.1.7.2.3.0
accept_errors: true
value_template: >-
{%if value == '1' %}
OK
{% elif value == '2' %}
Failed
{% elif value == '3' %}
Invalid Test
{% elif value == '4' %}
Test In Progress
{% endif %}
- platform: snmp
name: ups_smart_last_self_test_date_2
host: 192.168.178.12
baseoid: 1.3.6.1.4.1.318.1.1.1.7.2.4.0
accept_errors: true
- platform: snmp
name: ups_smart_communication_status_2
host: 192.168.178.12
baseoid: 1.3.6.1.4.1.318.1.1.1.8.1.0
accept_errors: true
value_template: >-
{%if value == '1' %}
on
{% elif value == '2' %}
off
{% endif %}
- platform: snmp
name: ups_smart_status_2
host: 192.168.178.12
baseoid: 1.3.6.1.4.1.318.1.1.1.4.1.1.0
accept_errors: true
value_template: >-
{%if value == '1' %}
Unknown
{% elif value == '2' %}
On Line
{% elif value == '3' %}
On Battery
{% elif value == '4' %}
On Smart Boost
{% elif value == '5' %}
Timed Sleeping
{% elif value == '6' %}
Software Bypass
{% elif value == '7' %}
Off
{% elif value == '8' %}
Rebooting
{% elif value == '9' %}
Switched Bypass
{% elif value == '10' %}
Hardware Failure Bypass
{% elif value == '11' %}
Sleeping Until Power Returns
{% elif value == '12' %}
On Smart Trim
{% endif %}
I have an issue.
I installed all dependencies, I replaced all of mine entities, but nothing is shown even an error:
Any suggestion?
Marco
Hard to give any suggestions since you have not posted a code.
You are rigth, sorry.
Here it is:
id: nuc_card
type: custom:config-template-card
variables:
- states[''sensor.ups1500_status''].state
- states[''sensor.ups1500_status''].state
- states[''sensor.ups1500_battery_level''].state
- states[''sensor.ups1500_load''].state
- states[''sensor.ups1500_line_voltage''].state
- states[''sensor.ups1500_battery_voltage''].state
entities:
- sensor.ups1500_status
- sensor.ups1500_status
- sensor.ups1500_battery_level
- sensor.ups1500_load
- sensor.ups1500_line_voltage
- sensor.ups1500_battery_voltage
card:
type: entities
show_header_toggle: 'off'
style: |
.card-header {
padding: 0px 0px 0px 0px !important;
}
entities:
- type: section
style: |
.label {
text-align: center !important;
margin-left: 0px !important;
font-size: 17px !important;
}
label: ${ 'APC --- ' + vars[0] + ' --- ' + vars[1] }
- type: custom:hui-element
card_type: vertical-stack
cards:
- type: horizontal-stack
cards:
- type: picture
style: |
ha-card {
--paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
--ha-card-background: "rgba(0, 0, 0, 0.0)";
--ha-card-box-shadow: 'none';
}
image: /local/wifi-guest.png
- type: custom:button-card
layout: icon_name_state2nd
show_icon: true
show_state: true
styles:
grid: null
card:
- '--ha-card-background': rgba(0, 0, 0, 0.0)
- '--ha-card-box-shadow': none
icon:
- padding: 10px 0px 0px
- height: 40px
- width: 40px
state:
- padding: 10px 0px 0px
- justify-self: start
- font-family: Roboto, sans-serif
- font-size: 14px
name:
- padding: 20px 0px 0px
- justify-self: start
entity: sensor.ups1500_runtime_left
name: 'Remaining:'
icon: mdi:battery-high
- type: horizontal-stack
cards:
- type: custom:bar-card
show_icon: true
align: split
columns: 1
max: 100
positions:
icon: inside
indicator: inside
name: inside
value: inside
unit_of_measurement: '%'
severity:
- value: 50
color: '#3498db'
- value: 75
color: '#f39c12'
- value: 100
color: '#e45e65'
style: |
ha-card {
--paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
--ha-card-background: "rgba(0, 0, 0, 0.0)";
--paper-item-icon-color: 'var(--text-primary-color)';
--ha-card-box-shadow: 'none';
}
bar-card-name {
margin-left: -10px;
}
entity: sensor.ups1500_battery_level
name: Battery
icon: mdi:battery-high
entity_row: true
- type: custom:bar-card
show_icon: true
align: split
columns: 1
max: 100
positions:
icon: inside
indicator: inside
name: inside
value: inside
unit_of_measurement: '%'
severity:
- value: 50
color: '#3498db'
- value: 75
color: '#f39c12'
- value: 100
color: '#e45e65'
style: |
ha-card {
--paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
--ha-card-background: "rgba(0, 0, 0, 0.0)";
--paper-item-icon-color: 'var(--text-primary-color)';
--ha-card-box-shadow: 'none';
}
bar-card-name {
margin-left: -10px;
}
entity: sensor.ups1500_load
name: Load
entity_row: true
- type: entities
entities:
- entity: sensor.ups1500_line_voltage
name: Input Voltage
icon: mdi:power-plug
- entity: sensor.ups1500_battery_voltage
name: Battery Voltage
icon: mdi:battery-charging-high
style: |
ha-card {
--paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
--ha-card-background: "rgba(0, 0, 0, 0.0)";
--paper-item-icon-color: 'var(--text-primary-color)';
--ha-card-box-shadow: 'none';
}
Is it your card or taken from somewhere?
Yes,
I took from 1st post on this thread, with my entities
Marco
First entity is duplicated, fix this first and remove the first entity from both variables and entities sections at the top of the code. If still not showing it means one or more of the entities you have at the top does not exist, you can remove them 1 at a time if you need to then you can see what one is causing the error…
Hi,
replaced 1st entity and removed one by one, but still not work. All entities exist, and work, they are used in another UPS card I have
id: nuc_card
type: custom:config-template-card
variables:
- states[''input_text.termostato_stato''].state
- states[''sensor.ups1500_status''].state
- states[''sensor.ups1500_battery_level''].state
- states[''sensor.ups1500_load''].state
- states[''sensor.ups1500_line_voltage''].state
- states[''sensor.ups1500_battery_voltage''].state
entities:
- input_text.termostato_stato
- sensor.ups1500_status
- sensor.ups1500_battery_level
- sensor.ups1500_load
- sensor.ups1500_line_voltage
- sensor.ups1500_battery_voltage
card:
type: entities
show_header_toggle: 'off'
style: |
.card-header {
padding: 0px 0px 0px 0px !important;
}
entities:
- type: section
style: |
.label {
text-align: center !important;
margin-left: 0px !important;
font-size: 17px !important;
}
label: ${ 'APC --- ' + vars[0] + ' --- ' + vars[1] }
- type: custom:hui-element
card_type: vertical-stack
cards:
- type: horizontal-stack
cards:
- type: picture
style: |
ha-card {
--paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
--ha-card-background: "rgba(0, 0, 0, 0.0)";
--ha-card-box-shadow: 'none';
}
image: /local/wifi-guest.png
- type: custom:button-card
layout: icon_name_state2nd
show_icon: true
show_state: true
styles:
grid: null
card:
- '--ha-card-background': rgba(0, 0, 0, 0.0)
- '--ha-card-box-shadow': none
icon:
- padding: 10px 0px 0px
- height: 40px
- width: 40px
state:
- padding: 10px 0px 0px
- justify-self: start
- font-family: Roboto, sans-serif
- font-size: 14px
name:
- padding: 20px 0px 0px
- justify-self: start
entity: sensor.ups1500_runtime_left
name: 'Remaining:'
icon: mdi:battery-high
- type: horizontal-stack
cards:
- type: custom:bar-card
show_icon: true
align: split
columns: 1
max: 100
positions:
icon: inside
indicator: inside
name: inside
value: inside
unit_of_measurement: '%'
severity:
- value: 50
color: '#3498db'
- value: 75
color: '#f39c12'
- value: 100
color: '#e45e65'
style: |
ha-card {
--paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
--ha-card-background: "rgba(0, 0, 0, 0.0)";
--paper-item-icon-color: 'var(--text-primary-color)';
--ha-card-box-shadow: 'none';
}
bar-card-name {
margin-left: -10px;
}
entity: sensor.ups1500_battery_level
name: Battery
icon: mdi:battery-high
entity_row: true
- type: custom:bar-card
show_icon: true
align: split
columns: 1
max: 100
positions:
icon: inside
indicator: inside
name: inside
value: inside
unit_of_measurement: '%'
severity:
- value: 50
color: '#3498db'
- value: 75
color: '#f39c12'
- value: 100
color: '#e45e65'
style: |
ha-card {
--paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
--ha-card-background: "rgba(0, 0, 0, 0.0)";
--paper-item-icon-color: 'var(--text-primary-color)';
--ha-card-box-shadow: 'none';
}
bar-card-name {
margin-left: -10px;
}
entity: sensor.ups1500_load
name: Load
entity_row: true
- type: entities
entities:
- entity: sensor.ups1500_line_voltage
name: Input Voltage
icon: mdi:power-plug
- entity: sensor.ups1500_battery_voltage
name: Battery Voltage
icon: mdi:battery-charging-high
style: |
ha-card {
--paper-card-background-color: 'rgba(0, 0, 0, 0.0)';
--ha-card-background: "rgba(0, 0, 0, 0.0)";
--paper-item-icon-color: 'var(--text-primary-color)';
--ha-card-box-shadow: 'none';
}
I see the problem now, variables should be like this:
variables:
- states['input_text.termostato_stato'].state
- states['sensor.ups1500_status'].state
- states['sensor.ups1500_battery_level'].state
- states['sensor.ups1500_load'].state
- states['sensor.ups1500_line_voltage'].state
- states['sensor.ups1500_battery_voltage'].state
You are making a big mistake using this code. Care to read a bit more than the 1st post. And suggest to read docs for config-template-card - you will see that it is not needed to use it where it is NOT needed to use it.
Optimised code!
For those using this card already or for those that want to implement this card I have changed the code to something newer which hopefully is better (I am open to more suggestions). The card will look the same as before. I have made all entities that you need to change in capital letters to make it easier.
type: entities
card_mod:
style: |
div#states.card-content {
padding: 0px 16px 16px 16px !important;
}
entities:
- type: custom:hui-element
card_type: markdown
content: |
APC --- {{states('sensor.UPS_MODEL')}} --- {{states('sensor.UPS_STATUS')}}
card_mod:
style: |
ha-card.type-markdown {
font-size: 17px !important;
display: flex !important;
justify-content: center !important;
}
ha-card {
border-width: 0px !important;
}
ha-markdown {
padding: 16px 16px 0px !important;
}
- type: custom:hui-element
card_type: vertical-stack
cards:
- type: custom:layout-card
layout_type: custom:grid-layout
layout:
grid-template-columns: 50% 50%
place-items: center
cards:
- type: picture
image: /local/images/UPS_IMAGE.png
card_mod:
style: |
ha-card {
border-width: 0px !important;
}
- type: custom:button-card
entity: sensor.BATTERY_REMAINING_TIME
name: 'Remaining:'
icon: mdi:battery-high
layout: icon_name_state2nd
show_icon: true
show_state: true
card_mod:
style: |
ha-card {
border-width: 0px !important;
place-self: flex-start !important;
}
div#name.ellipsis {
place-self: flex-start !important;
}
div#state.ellipsis {
place-self: flex-start !important;
}
- type: custom:bar-card
columns: 2
entity_row: true
positions:
icon: inside
indicator: 'off'
name: inside
value: inside
entities:
- entity: sensor.BATTERY_REMAINING_PERCENTAGE
name: Battery
icon: mdi:battery-high
unit_of_measurement: '%'
severity:
- from: 0
to: 17
color: '#d70000'
- from: 18
to: 34
color: '#d45e00'
- from: 35
to: 51
color: '#cf9000'
- from: 52
to: 68
color: '#cfd300'
- from: 69
to: 84
color: '#84cf00'
- from: 85
to: 100
color: '#30d000'
- entity: sensor.UPS_LOAD
name: Load
icon: mdi:gauge
unit_of_measurement: '%'
severity:
- value: 50
color: '#3498db'
- value: 75
color: '#f39c12'
- value: 100
color: '#e45e65'
card_mod:
style: |
ha-card {
--paper-item-icon-color: var(--primary-text-color);
border-width: 0px !important;
}
- type: custom:hui-element
card_type: entities
entities:
- entity: sensor.UPS_INPUT_VOLTAGE
name: Input Voltage
- entity: sensor.UPS_BATTERY_VOLTAGE
name: Battery Voltage
card_mod:
style: |
ha-card {
--paper-item-icon-color: var(--primary-text-color);
border-width: 0px !important;
}
I have made a post with hopefully better code, I hope you can check it and make any suggestions
If you got rid of CTC and using a markdown - this is better.
Thanks it works.
1st post have wrong code
Marco
Hi,
I have seen from reading this top to bottom and there is quite few constructive criticisims. I like the card front end and I got 3 UPS setup with NUT communicating via UPS and tied into the same integration in HA.
My ask is what card would work best as there has been a lot of back and forth. I would just like to see the “polished or finished look” for CyberPower NAS’s. thanks
Then you will probably need 3 same cards with diff. inputs, right?
I have separate instances for each NUT via the integration. Sensors name vary a bit, but it works. NUT seems to do the heavy lifting for me. Each ups lives in a different spot in HA on Dashboard, but yes. I figured for starters lets get one that is working correctly. Then worry about the other 2.
Actually I might need 5 when its all said and done. I got 2 other UPS’s that run as part of a package. If your curious — Home Assistant sensors and CyberPower UPS via RMCARD205 – Peter Kieser
If you need 5 similar cards with diff inputs - consider using a decluttering-card.
As for “which card to declutter” - there are some cards presented here, test them one by one.
It is up to you / your education which way to choose - either “give me a working solution” or “I will test variants by myself & choose”.