File tree Expand file tree Collapse file tree 3 files changed +30
-10
lines changed
examples/vucm/snmp-eaton-ups Expand file tree Collapse file tree 3 files changed +30
-10
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ services:
44 build : .
55 image : enapter-vucm-examples/snmp-eaton-ups:latest
66 stop_signal : SIGINT
7+ restart : " no"
78 environment :
89 ENAPTER_VUCM_BLOB : " REALENAPTERVUCMBLOBMUSTBEHERE="
910 ENAPTER_SNMP_HOST : " 192.168.192.192"
Original file line number Diff line number Diff line change @@ -38,21 +38,21 @@ telemetry:
3838 type : string
3939 display_name : Battery Status
4040 enum :
41- " 1 " :
41+ " charge " :
4242 display_name : Charging
43- " 2 " :
43+ " discharge " :
4444 display_name : Discharging
45- " 3 " :
45+ " float " :
4646 display_name : Floating
47- " 4 " :
47+ " reset " :
4848 display_name : Resting
49- " 5 " :
49+ " unknown " :
5050 display_name : unknown
51- " 6 " :
51+ " disconnect " :
5252 display_name : Disconnected
53- " 7 " :
53+ " test " :
5454 display_name : Under Test
55- " 8 " :
55+ " check " :
5656 display_name : Check Battery
5757 grid_freq :
5858 type : integer
@@ -94,4 +94,4 @@ telemetry:
9494 - grid_freq
9595 - ups_freq
9696 - grid_v
97- - out_load
97+ - out_load
Original file line number Diff line number Diff line change @@ -40,7 +40,26 @@ async def task_get_telemetry_data(self):
4040
4141 status = await self .snmp_get ("1.3.6.1.4.1.534.1.2.5.0" )
4242 if status is not None :
43- self .telemetry ["status" ] = str (status )
43+ if status == 1 :
44+ status_name = "charge"
45+ elif status == 2 :
46+ status_name = "discharge"
47+ elif status == 3 :
48+ status_name = "float"
49+ elif status == 4 :
50+ status_name = "reset"
51+ elif status == 5 :
52+ status_name = "unknown"
53+ elif status == 6 :
54+ status_name = "disconnect"
55+ elif status == 7 :
56+ status_name = "test"
57+ elif status == 8 :
58+ status_name = "check"
59+ else :
60+ raise ValueError (f"unexpected status: { status } " )
61+
62+ self .telemetry ["status" ] = status_name
4463
4564 grid_freq = await self .snmp_get ("1.3.6.1.2.1.33.1.3.3.1.2.1" )
4665 if grid_freq is not None :
You can’t perform that action at this time.
0 commit comments