Browse Source

[variable_value] wrong sign in get_value_since

Maxime Alves LIRMM@home 4 years ago
parent
commit
88d947ea9d
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      pyheatpump/models/variable_value.py

+ 2
- 1
pyheatpump/models/variable_value.py View File

67
     @staticmethod
67
     @staticmethod
68
     def get(var_type, address, time=datetime.now()):
68
     def get(var_type, address, time=datetime.now()):
69
         try:
69
         try:
70
+            print(int(time.strftime('%s'))+1)
70
             row = next(DB.sql(
71
             row = next(DB.sql(
71
             """SELECT * FROM var_value
72
             """SELECT * FROM var_value
72
             WHERE
73
             WHERE
73
                 type = :type
74
                 type = :type
74
                 AND address = :address
75
                 AND address = :address
75
-                AND time <= :time
76
+                AND time >= :time
76
             ORDER BY time DESC
77
             ORDER BY time DESC
77
             LIMIT 1""", {
78
             LIMIT 1""", {
78
                 'type':str(var_type), 'address':address, 'time':int(time.strftime('%s'))+1
79
                 'type':str(var_type), 'address':address, 'time':int(time.strftime('%s'))+1

Loading…
Cancel
Save