Briandr73
(Brian)
December 19, 2022, 5:54pm
1
I am trying to create a dashboard item for the code found here:
https://peterkieser.com/2020/11/16/home-assistant-sensors-and-cyberpower-ups-via-rmcard205/
I have created a packages folder and created the yaml file for it, but I am unsure of the next steps. Can anyone offer advice on next steps?
finity
December 19, 2022, 6:01pm
2
you need to enable packages in your configuration.yaml.
assuming your packages folder is called “packages” then add this:
homeassistant:
packages: !include_dir_named packages
Briandr73
(Brian)
December 19, 2022, 6:07pm
3
already done. just not sure how to load them in manner you would load an integration.
finity
December 19, 2022, 6:27pm
4
They don’t load like an integration in the integration UI.
they load like any of the other integrations created via yaml by using the reload button under developers tools → yaml or (because some yaml configs don’t have a reload button there) via a restart of HA
Briandr73
(Brian)
December 19, 2022, 6:52pm
5
Any idea what fails to load slug mean and how to fix:
bouwew
(Bouwe)
December 19, 2022, 6:59pm
6
Unrelated to the contents of your package.yaml file, it seems.
petro
(Petro)
December 19, 2022, 7:00pm
7
Also, the error message tells you what to do. It say’s you’re using cyberpower_LivingRoom and you should be using cyberpower_livingroom. Notice the lack of capital letters.
Briandr73
(Brian)
December 19, 2022, 7:04pm
8
was not aware of the code being case sensitive. thank you.
Briandr73
(Brian)
December 19, 2022, 7:42pm
9
I was able to get this working, but I have 2 UPS’s I want to monitor. I created a second YAML package file, but am getting errors about duplicate names such as the one below. Since I am so new to this not sure if I need a separate package YAML file or 2 scripts. If anyone has any ideas I would be appreciative of hearing them.
finity
December 19, 2022, 8:17pm
10
You need to go to the package file that you created for the second ups and make everything in that file to have a unique name/entity_id that is different than the first one.
Briandr73
(Brian)
December 19, 2022, 8:23pm
11
everything including in the file where the programmer is doing calculations?
finity
December 19, 2022, 8:29pm
12
I assume that when you say that you…
then you just made a duplicate of the code included at the web site and stuck that in a second file?
I don’t see any “calculations” in that file. I just see a bunch of sensors getting created.
maybe you could explain better what you actually did to get the second package file created.
also if you don’t hit the reply button under my post or tag me with @finity then I don’t get a notification that you replied to me.
Briandr73
(Brian)
December 19, 2022, 8:38pm
13
@finity Yes – the code in the first package yaml was duplicated into a second file. I only changed reference to IP address.
I thought calculations were being done, but I think the coder was just pulling data using snmp protocol.
When I run the yaml checker under device configuration that is when I start getting errors such as duplicate key names
finity
December 19, 2022, 11:18pm
14
right because all of those sensors that the second package creates end up with the same entity_ids (based on the “name:” key) and that’s what the error is telling you.
you need to change those to a different name.
for example:
change this from the first one:
sensor:
- platform: snmp
scan_interval: 60
name: ups_nompower
host: x.x.x.x
baseoid: 1.3.6.1.4.1.3808.1.1.1.4.2.5.0
accept_errors: true
unit_of_measurement: Watts
to this (or something you choose) in the second one:
sensor:
- platform: snmp
scan_interval: 60
name: ups_nompower_2 # <--- this line
host: x.x.x.x
baseoid: 1.3.6.1.4.1.3808.1.1.1.4.2.5.0
accept_errors: true
unit_of_measurement: Watts
and then do that for all of the sensors, groups, and customize data.
and of course the host IP
Briandr73
(Brian)
December 20, 2022, 1:20am
15
@finity Not sure what might be missing, but the entities are not being created so I cannot use on Dashboard
group.upssensor_2:
platform: snmp
scan_interval: 30
name: ups_nompower_2
host: 192.168.10.15
baseoid: 1.3.6.1.4.1.3808.1.1.1.4.2.5.0
accept_errors: true
unit_of_measurement: Watts
platform: snmp
scan_interval: 30
name: ups_nominv_2
host: 192.168.10.15
baseoid: 1.3.6.1.4.1.3808.1.1.1.3.2.1.0
accept_errors: true
unit_of_measurement: Volts
value_template: ‘{{((value | int) / 10) | int}}’
platform: snmp
scan_interval: 30
name: ups_itemp_2
host: 192.168.10.15
baseoid: 1.3.6.1.4.1.3808.1.1.1.2.2.3.0
accept_errors: true
unit_of_measurement: “°C”
platform: snmp
scan_interval: 30
name: ups_timeleft_2
host: 192.168.10.15
baseoid: 1.3.6.1.4.1.3808.1.1.1.2.2.4.0
accept_errors: true
unit_of_measurement: ‘minutes’
value_template: ‘{{((value | int) / 6000) | int}}’
platform: snmp
scan_interval: 30
name: ups_status_2
host: 192.168.10.15
baseoid: 1.3.6.1.4.1.3808.1.1.1.4.1.1.0
accept_errors: true
value_template: >-
{% set status = (value | int) %}
{%- if status == 2 -%}
Online
{%- elif status == 3 -%}
On Battery
{%- elif status == 4 -%}
On Boost
{%- elif status == 5 -%}
On Sleep
{%- elif status == 6 -%}
Off
{%- elif status == 7 -%}
Rebooting
{%- elif status == 8 -%}
On ECO
{%- elif status == 9 -%}
On Bypass
{%- elif status == 10 -%}
On Buck
{%- elif status == 11 -%}
On Overload
{%- else -%}
Unknown
{%- endif -%}
group_2:
ups_2:
name: UPS_2
entities:
- sensor.ups_status_2
- sensor.ups_nompower_2
- sensor.ups_nominv_2
- sensor.ups_itemp_2
- sensor.ups_timeleft_2
homeassistant:
customize_2:
sensor.ups_nompower_2:
friendly_name: ‘UPS Nominal Output Power’
icon: mdi:flash
sensor.ups_nominv_2:
friendly_name: ‘UPS Nominal Input Voltage’
icon: mdi:flash
sensor.ups_status_2:
friendly_name: ‘UPS Status’
icon: mdi:information-outline
sensor.ups_itemp_2:
friendly_name: ‘UPS Internal Temperature’
icon: mdi:thermometer
sensor.ups_timeleft_2:
friendly_name: ‘UPS Time Left’
icon: mdi:clock-alert
finity
December 20, 2022, 2:02am
16
you are misunderstanding how it works (obviously… )
I’m going to assume that file 1 is directly as it is from the web link above.
so in your “packages” folder you will have two files:
packages
|->file_1.yaml
|->file_2.yaml
these can be called whatever you want. I’m just using those names for reference.
file_1.yaml contains the exact config from the link.
file_2.yaml will look like this (I’ve annotated which lines are different):
sensor:
- platform: snmp
scan_interval: 60
name: ups_nompower_2 #<-this line is changed
host: x.x.x.x
baseoid: 1.3.6.1.4.1.3808.1.1.1.4.2.5.0
accept_errors: true
unit_of_measurement: Watts
- platform: snmp
scan_interval: 60
name: ups_nominv_2 #<-this line is changed
host: x.x.x.x
baseoid: 1.3.6.1.4.1.3808.1.1.1.3.2.1.0
accept_errors: true
unit_of_measurement: Volts
value_template: '{{((value | int) / 10) | int}}'
- platform: snmp
scan_interval: 60
name: ups_itemp_2 #<-this line is changed
host: x.x.x.x
baseoid: 1.3.6.1.4.1.3808.1.1.1.2.2.3.0
accept_errors: true
unit_of_measurement: "°C"
- platform: snmp
scan_interval: 60
name: ups_timeleft_2 #<-this line is changed
host: x.x.x.x
baseoid: 1.3.6.1.4.1.3808.1.1.1.2.2.4.0
accept_errors: true
unit_of_measurement: 'minutes'
value_template: '{{((value | int) / 6000) | int}}'
- platform: snmp
scan_interval: 30
name: ups_status_2 #<-this line is changed
host: x.x.x.x
baseoid: 1.3.6.1.4.1.3808.1.1.1.4.1.1.0
accept_errors: true
value_template: >-
{% set status = (value | int) %}
{%- if status == 2 -%}
Online
{%- elif status == 3 -%}
On Battery
{%- elif status == 4 -%}
On Boost
{%- elif status == 5 -%}
On Sleep
{%- elif status == 6 -%}
Off
{%- elif status == 7 -%}
Rebooting
{%- elif status == 8 -%}
On ECO
{%- elif status == 9 -%}
On Bypass
{%- elif status == 10 -%}
On Buck
{%- elif status == 11 -%}
On Overload
{%- else -%}
Unknown
{%- endif -%}
group:
ups_2: #<-this line is changed:
name: UPS 2 #<-this line is changed
entities:
- sensor.ups_status_2 #<-this line is changed
- sensor.ups_nompower_2 #<-this line is changed
- sensor.ups_nominv_2 #<-this line is changed
- sensor.ups_itemp_2 #<-this line is changed
- sensor.ups_timeleft_2 #<-this line is changed
homeassistant:
customize:
sensor.ups_nompower_2: #<-this line is changed
friendly_name: 'UPS 2 Nominal Output Power' #<-this line is changed
icon: mdi:flash
sensor.ups_nominv_2: #<-this line is changed:
friendly_name: 'UPS 2 Nominal Input Voltage' #<-this line is changed
icon: mdi:flash
sensor.ups_status_2: #<-this line is changed:
friendly_name: 'UPS 2 Status' <-this line is changed
icon: mdi:information-outline
sensor.ups_itemp_2: #<-this line is changed:
friendly_name: 'UPS 2 Internal Temperature' #<-this line is changed
icon: mdi:thermometer
sensor.ups_timeleft_2: #<-this line is changed:
friendly_name: 'UPS 2 Time Left' #<-this line is changed
icon: mdi:clock-alert
Briandr73
(Brian)
December 20, 2022, 3:45pm
17
I am not sure what I missed, but thanks for replying with code corrections.The other thing I am still wrestling with is entities are not being created and I am not sure how to fix. Even with your code corrections still getting an error about invalid domain group? Any ideas on fixing. thank you for your gracious help.
petro
(Petro)
December 20, 2022, 4:05pm
18
Can you please post your errors, don’t paraphrase, just post the whole error.
Briandr73
(Brian)
December 20, 2022, 5:16pm
19
Moderator: I did above in thread (16 hrs ago) but will do again since it was missed by yourself and perhaps others.
petro
(Petro)
December 20, 2022, 5:27pm
20
That’s the error in the frontend. I’m talking about the actual errors in the logs.