safraeli commited on
Commit
285c15b
·
verified ·
1 Parent(s): 0f9e40e

Fix: backend/api/routes/sensors.py

Browse files
Files changed (1) hide show
  1. backend/api/routes/sensors.py +3 -3
backend/api/routes/sensors.py CHANGED
@@ -129,7 +129,7 @@ async def air_leaf_delta(
129
  ):
130
  """Hourly air-leaf temperature delta from ThingsBoard (Air2 under panels)."""
131
  try:
132
- df = _tb_timeseries("Air2", ["airLeafDeltaT"], hours)
133
  if df.empty:
134
  return []
135
  return [{"timestamp": ts.isoformat(), "value": round(float(row["airLeafDeltaT"]), 2)}
@@ -145,7 +145,7 @@ async def temp_humidity(
145
  ):
146
  """Hourly temperature + humidity from ThingsBoard (Air2 under panels)."""
147
  try:
148
- df = _tb_timeseries("Air2", ["airTemperature", "airHumidity"], hours)
149
  if df.empty:
150
  return []
151
  rows = []
@@ -188,7 +188,7 @@ async def vpd_history(
188
  ):
189
  """Hourly VPD from ThingsBoard (Air2 under panels)."""
190
  try:
191
- df = _tb_timeseries("Air2", ["VPD"], hours)
192
  if df.empty:
193
  return []
194
  return [{"timestamp": ts.isoformat(), "value": round(float(row["VPD"]), 2)}
 
129
  ):
130
  """Hourly air-leaf temperature delta from ThingsBoard (Air2 under panels)."""
131
  try:
132
+ df = _tb_timeseries("Air1", ["airLeafDeltaT"], hours)
133
  if df.empty:
134
  return []
135
  return [{"timestamp": ts.isoformat(), "value": round(float(row["airLeafDeltaT"]), 2)}
 
145
  ):
146
  """Hourly temperature + humidity from ThingsBoard (Air2 under panels)."""
147
  try:
148
+ df = _tb_timeseries("Air1", ["airTemperature", "airHumidity"], hours)
149
  if df.empty:
150
  return []
151
  rows = []
 
188
  ):
189
  """Hourly VPD from ThingsBoard (Air2 under panels)."""
190
  try:
191
+ df = _tb_timeseries("Air1", ["VPD"], hours)
192
  if df.empty:
193
  return []
194
  return [{"timestamp": ts.isoformat(), "value": round(float(row["VPD"]), 2)}