Jon Hobbs
Published © GPL3+

Home Automation Laboratory (HAL) - Part 2 - Data Persistence

We install a database and configure our Home Automation Laboratory to use it to store our home automation data.

IntermediateFull instructions provided2 hours3,730
Home Automation Laboratory (HAL) - Part 2 - Data Persistence

Things used in this project

Hardware components

Raspberry Pi 3 Model B
Raspberry Pi 3 Model B
×1
Raspberry Pi Pi Case
×1

Software apps and online services

OpenHAB
MySQL
MySQL Workbench

Story

Read more

Code

jdbc.persist

ActionScript
This is our initial jdbc.persist file. It tells OpenHAB what data to store and when to store it or retrieve it.
// persistence strategies have a name and a definition and are referred to in the "Items" section 
Strategies { 
    // if no strategy is specified for an item entry below, 
    // the default list will be used 
       everyMinute     : "0 * * * * ?" 
       every5Minutes : "0 */5 * * * ?" 
       everyHour   : "0 0 * * * ?" 
       everyDay    : "0 0 0 * * ?" 
       default = everyChange 
} 
/* 
* Each line in this section defines for which item(s) which strategy(ies) should be applied. 
* You can list single items, use "*" for all items or "groupitem*" for all members of a group 
* item (excl. the group item itself). 
*/ 
Items { 
   // persist all items once a day and on every change and restore them from the db at startup 
   * : strategy = everyChange, everyDay, restoreOnStartup 
   // additionally, persist all temperature and weather values every hour 
      gTemperatur* : strategy = every5Minutes, restoreOnStartup 

Credits

Jon Hobbs

Jon Hobbs

9 projects • 27 followers
Just a Minnesota kid hanging out in Kansas

Comments