Skip to content

Commit

Permalink
[Edgecore][AS9726-32D] Read the data when the PSU is in the power-goo…
Browse files Browse the repository at this point in the history
…d state.
  • Loading branch information
roger530-ho committed Aug 15, 2023
1 parent a0d01b7 commit 5abf753
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 5abf753

Please sign in to comment.