mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Update QNAP lib to 0.2.6; handle null temps gracefully (#14117)
There's one particular QNAP model which sometimes return empty/null temperatures for certain disks. This commit ensures that this model can be integrated with HASS without causing KeyErrors or other exceptions - if this edge case is hit, the sensor will simply show `0` instead.
This commit is contained in:
parent
58ae8d91f9
commit
2749ca4ef4
@ -17,7 +17,7 @@ from homeassistant.const import (
|
|||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
REQUIREMENTS = ['qnapstats==0.2.5']
|
REQUIREMENTS = ['qnapstats==0.2.6']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -352,7 +352,7 @@ class QNAPDriveSensor(QNAPSensor):
|
|||||||
return data['health']
|
return data['health']
|
||||||
|
|
||||||
if self.var_id == 'drive_temp':
|
if self.var_id == 'drive_temp':
|
||||||
return int(data['temp_c'])
|
return int(data['temp_c']) if data['temp_c'] is not None else 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
|
@ -1099,7 +1099,7 @@ pyxeoma==1.4.0
|
|||||||
pyzabbix==0.7.4
|
pyzabbix==0.7.4
|
||||||
|
|
||||||
# homeassistant.components.sensor.qnap
|
# homeassistant.components.sensor.qnap
|
||||||
qnapstats==0.2.5
|
qnapstats==0.2.6
|
||||||
|
|
||||||
# homeassistant.components.switch.rachio
|
# homeassistant.components.switch.rachio
|
||||||
rachiopy==0.1.2
|
rachiopy==0.1.2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user