From 95f6c719a3c4f8f662045d531ed33fa88a046517 Mon Sep 17 00:00:00 2001 From: ykyohei <38639108+ykyohei@users.noreply.github.com> Date: Fri, 10 Apr 2026 20:32:27 +0000 Subject: [PATCH] publish current and voltage to a feed and session.data --- socs/agents/ibootbar/agent.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/socs/agents/ibootbar/agent.py b/socs/agents/ibootbar/agent.py index ea96521b4..f97fb9632 100644 --- a/socs/agents/ibootbar/agent.py +++ b/socs/agents/ibootbar/agent.py @@ -94,7 +94,8 @@ def _build_message(get_result, names, time): continue message['data'][field_name] = oid_value - message['data'][field_name + "_name"] = names[int(field_name[-1])] + if 'outlet' in field_name: + message['data'][field_name + "_name"] = names[int(field_name[-1])] message['data'][field_name + "_description"] = oid_description return message @@ -143,8 +144,9 @@ def update_cache(get_result, names, outlet_locked, timestamp): # Update OID Cache for session.data oid_cache[field_name] = {"status": oid_value} - oid_cache[field_name]["name"] = names[int(field_name[-1])] - oid_cache[field_name]["locked"] = outlet_locked[int(field_name[-1])] + if 'outlet' in field_name: + oid_cache[field_name]["name"] = names[int(field_name[-1])] + oid_cache[field_name]["locked"] = outlet_locked[int(field_name[-1])] oid_cache[field_name]["description"] = oid_description oid_cache['ibootbar_connection'] = {'last_attempt': time.time(), 'connected': True} @@ -233,12 +235,18 @@ def acq(self, session, params=None): {'outletStatus_0': {'status': 1, 'name': 'Outlet-1', + 'locked': True, 'description': 'on'}, 'outletStatus_1': {'status': 0, 'name': 'Outlet-2', + 'locked': False, 'description': 'off'}, ... + 'currentLC1_0': + {'status': 0, + 'description': '0'}, + ... 'ibootbar_connection': {'last_attempt': 1656085022.680916, 'connected': True}, @@ -271,6 +279,11 @@ def acq(self, session, params=None): for i in range(8): get_list.append((self.ibootbar_type + '-MIB', 'outletStatus', i)) name_list.append((self.ibootbar_type + '-MIB', 'outletName', i)) + get_list.append((self.ibootbar_type + '-MIB', 'currentLC1', 0)) + get_list.append((self.ibootbar_type + '-MIB', 'currentLC2', 0)) + if self.ibootbar_type == 'IBOOTPDU': + get_list.append((self.ibootbar_type + '-MIB', 'voltageLC1', 0)) + get_list.append((self.ibootbar_type + '-MIB', 'voltageLC2', 0)) # Issue SNMP GET commands get_result = yield self.snmp.get(get_list, self.version)