Skip to content

Commit 94c0373

Browse files
author
Andriy Kokhan
committed
Implemented PSU thermal APIs
1 parent 49481bd commit 94c0373

File tree

2 files changed

+20
-2
lines changed
  • platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform

2 files changed

+20
-2
lines changed

platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/psu.py

+18
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,24 @@ def get_position_in_parent(self):
201201
"""
202202
return self.__index
203203

204+
def get_temperature(self):
205+
"""
206+
Retrieves current temperature reading from PSU
207+
Returns:
208+
A float number of current temperature in Celsius up to nearest thousandth
209+
of one degree Celsius, e.g. 30.125
210+
"""
211+
return self.get_thermal(0).get_temperature()
212+
213+
def get_temperature_high_threshold(self):
214+
"""
215+
Retrieves the high threshold temperature of PSU
216+
Returns:
217+
A float number, the high threshold temperature of PSU in Celsius
218+
up to nearest thousandth of one degree Celsius, e.g. 30.125
219+
"""
220+
return self.get_thermal(0).get_high_threshold()
221+
204222
@property
205223
def _thermal_list(self):
206224
if self.__thermals is None:

platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/thermal.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ def kv(line):
8282
@classmethod
8383
def __sensors_get(cls, cached=True) -> dict:
8484
cls.__lock.acquire()
85-
if time.time() > cls.__timestamp + 5:
86-
# Update cache once per 5 seconds
85+
if time.time() > cls.__timestamp + 15:
86+
# Update cache once per 15 seconds
8787
try:
8888
data = platform_sensors_get(['-A', '-u']) or ''
8989
data += subprocess.check_output("/usr/bin/sensors -A -u",

0 commit comments

Comments
 (0)