Fixed missing check on light and pressure sensors

This commit is contained in:
Mark Qvist 2024-04-01 17:36:45 +02:00
parent 18698da14e
commit e92224f89e
1 changed files with 2 additions and 2 deletions

View File

@ -595,7 +595,7 @@ class Pressure(Sensor):
delta = None
if relative_to and "pressure" in relative_to.sensors:
rs = relative_to.sensors["pressure"]
if "mbar" in rs.data and rs.data["mbar"] != None:
if rs.data != None and "mbar" in rs.data and rs.data["mbar"] != None:
if self.data["mbar"] != None:
delta = round(rs.data["mbar"] - self.data["mbar"], 1)
@ -1129,7 +1129,7 @@ class AmbientLight(Sensor):
delta = None
if relative_to and "ambient_light" in relative_to.sensors:
rs = relative_to.sensors["ambient_light"]
if "lux" in rs.data and rs.data["lux"] != None:
if rs.data != None and "lux" in rs.data and rs.data["lux"] != None:
if self.data["lux"] != None:
delta = round(rs.data["lux"] - self.data["lux"], 2)