Skip to content

Commit

Permalink
sqlite plugin for smartVisu 2.7 and 2.8 separated
Browse files Browse the repository at this point in the history
  • Loading branch information
cstrassburg committed Apr 13, 2016
1 parent 57acfe0 commit 556d24b
Show file tree
Hide file tree
Showing 5 changed files with 647 additions and 215 deletions.
22 changes: 3 additions & 19 deletions plugins/sqlite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,13 @@ plugin.conf
[sql]
class_name = SQL
class_path = plugins.sqlite
# path = None
# dumpfile = /tmp/smarthomedb.dump
</pre>

The `path` attribute allows you to specify the of the SQLite database.

If you specify a `dumpfile`, SmartHome.py dumps the database every night into this file.

items.conf
--------------

For num and bool items, you could set the attribute: `sqlite`. By this you enable logging of the item values and SmartHome.py set the item to the last know value at start up (equal cache = yes).
For num and bool items, you could set the attribute: `sqlite`. By this you enable logging of the item values.
If you set this attribute to `init`, SmartHome.py tries to set the item to the last know value (like cache = yes).

<pre>
[outside]
Expand All @@ -35,17 +30,6 @@ For num and bool items, you could set the attribute: `sqlite`. By this you enabl
# Functions
This plugin adds one item method to every item which has sqlite enabled.

## cleanup()
This function removes orphaned item entries which are no longer referenced in the item configuration.

## dump(filename)
Dumps the database into the specified file.
`sh.sql.dump('/tmp/smarthomedb.dump')` writes the database content into /tmp/smarthomedb.dump

## move(old, new)
This function renames item entries.
`sh.sql.move('my.old.item', 'my.new.item')`

## sh.item.db(function, start, end='now')
This method returns you an value for the specified function and timeframe.

Expand All @@ -54,7 +38,7 @@ Supported functions are:
* `avg`: for the average value
* `max`: for the maximum value
* `min`: for the minimum value
* `on`: percentage (as float from 0.00 to 1.00) where the value has been greater than 0.
* `sum`: for the value sum

For the timeframe you have to specify a start point and a optional end point. By default it ends 'now'.
The time point could be specified with `<number><interval>`, where interval could be:
Expand Down
Loading

0 comments on commit 556d24b

Please sign in to comment.