[sql] class_name = SQL class_path = plugins.sqlite_visu2_8 # path = None # dumpfile = /tmp/smarthomedb.dump
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.
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).
[outside] name = Outside [[temperature]] name = Temperatur type = num sqlite = yes
This plugin adds one item method to every item which has sqlite enabled.
This function removes orphaned item entries which are no longer referenced in the item configuration.
Dumps the database into the specified file.
sh.sql.dump('/tmp/smarthomedb.dump')
writes the database content into /tmp/smarthomedb.dump
This function renames item entries.
sh.sql.move('my.old.item', 'my.new.item')
This method returns you an value for the specified function and timeframe.
Supported functions are:
avg
: for the average valuemax
: for the maximum valuemin
: for the minimum valueon
: percentage (as float from 0.00 to 1.00) where the value has been greater than 0.
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:
i
: minuteh
: hourd
: dayw
: week
m
: month
y
: year
e.g.
sh.outside.temperature.db('min', '1d') # returns the minimum temperature within the last day sh.outside.temperature.db('avg', '2w', '1w') # returns the average temperature of the week before last week