From 5abf75382f31d9c026dee7604a7268d61cf4c783 Mon Sep 17 00:00:00 2001 From: roger530-ho Date: Tue, 15 Aug 2023 02:09:28 +0000 Subject: [PATCH] [Edgecore][AS9726-32D] Read the data when the PSU is in the power-good state. --- .../x86_64-accton_as9726_32d-r0/sonic_platform/psu.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/psu.py b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/psu.py index 297cbb501dac..632dae52de44 100644 --- a/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/psu.py +++ b/device/accton/x86_64-accton_as9726_32d-r0/sonic_platform/psu.py @@ -72,6 +72,9 @@ def get_voltage(self): A float number, the output voltage in volts, e.g. 12.1 """ + if self.get_status() is not True: + return 0 + vout_path = "{}{}".format(self.hwmon_path, 'psu_v_out') vout_val=self._api_helper.read_txt_file(vout_path) if vout_val is not None: @@ -85,6 +88,9 @@ def get_current(self): Returns: A float number, the electric current in amperes, e.g 15.4 """ + if self.get_status() is not True: + return 0 + iout_path = "{}{}".format(self.hwmon_path, 'psu_i_out') val=self._api_helper.read_txt_file(iout_path) if val is not None: @@ -98,6 +104,9 @@ def get_power(self): Returns: A float number, the power in watts, e.g. 302.6 """ + if self.get_status() is not True: + return 0 + pout_path = "{}{}".format(self.hwmon_path, 'psu_p_out') val=self._api_helper.read_txt_file(pout_path) if val is not None: