Skip to content

Commit 2d9310e

Browse files
committed
Now doesn't need batv correction view any more so view removed and python updated to use actual table
1 parent b920b55 commit 2d9310e

File tree

2 files changed

+1
-17
lines changed

2 files changed

+1
-17
lines changed

database/feshie-structure.sql

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -218,16 +218,7 @@ CREATE TABLE IF NOT EXISTS `battery_readings` (
218218
-- `devices` -> `id`
219219
--
220220

221-
-- --------------------------------------------------------
222221

223-
--
224-
-- Stand-in structure for view `battery_readings_corrected`
225-
--
226-
CREATE TABLE IF NOT EXISTS `battery_readings_corrected` (
227-
`device_id` varchar(40)
228-
,`timestamp` datetime
229-
,`value` double
230-
);
231222
-- --------------------------------------------------------
232223

233224
--
@@ -754,14 +745,7 @@ CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW
754745

755746
-- --------------------------------------------------------
756747

757-
--
758-
-- Structure for view `battery_readings_corrected`
759-
--
760-
DROP TABLE IF EXISTS `battery_readings_corrected`;
761748

762-
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `battery_readings_corrected` AS select `battery_readings`.`device_id` AS `device_id`,`battery_readings`.`timestamp` AS `timestamp`,((`battery_readings`.`value` * 1.4417) - 0.2532) AS `value` from `battery_readings`;
763-
764-
-- --------------------------------------------------------
765749

766750
--
767751
-- Structure for view `chain_temperatures`

feshiedb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ def get_temperature_readings(self, node):
369369
def get_battery_readings(self, node):
370370
if self.db is None:
371371
raise FeshieDbError()
372-
self.db.query("SELECT DATE_FORMAT( timestamp, \"%%Y-%%m-%%d %%H:%%i:00\"), value FROM battery_readings_corrected WHERE device_id = \"%s\" AND timestamp > \"%s\" AND timestamp <= NOW();" % (node, DATE_LIMIT))
372+
self.db.query("SELECT DATE_FORMAT( timestamp, \"%%Y-%%m-%%d %%H:%%i:00\"), value FROM battery_readings WHERE device_id = \"%s\" AND timestamp > \"%s\" AND timestamp <= NOW();" % (node, DATE_LIMIT))
373373
raw = self.db.store_result().fetch_row(0)
374374
return raw
375375

0 commit comments

Comments
 (0)