 (defn- reset-counters!
   "Resets the counters for a given sensor."
   [session where]
-  (dbnew/execute session
+  (db/execute session
    (hayt/update :sensors
                 (hayt/set-columns {:events 0
                                    :errors 0})

      (label-invalid-value session sensor (where-from m)))))

(defn- sensor-exists? [session m]
  (first (dbnew/execute session
                  (hayt/select :sensors
                               (hayt/where (where-from m))))))


  [[= :device_id (:device_id m)] [= :type (:type m)]])

(defn- update-sensor [session sensor delta]
  (db/execute session
                 (hayt/update :sensors
                              (hayt/set-columns delta)
                              (hayt/where (where-from sensor)))))
