{"id":768,"date":"2017-01-09T12:59:34","date_gmt":"2017-01-09T17:59:34","guid":{"rendered":"http:\/\/lisa.rushworth.us\/?p=768"},"modified":"2018-06-13T21:28:38","modified_gmt":"2018-06-14T02:28:38","slug":"web-accessible-history-from-openhab-mysql-persistence-database","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=768","title":{"rendered":"Web-Accessible History From OpenHAB MySQL Persistence Database"},"content":{"rendered":"<p>My husband has wanted a quick\/easy way to see the data stored in OpenHAB&#8217;s MySQL persistence database, so I put together a very quick (and ugly) PHP page that provides a list of all Items. If you click on an item, you can page through the item&#8217;s records. The\u00a0<a href=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2017\/01\/index.php_.txt\">index.php<\/a>\u00a0from the page is available here.\u00a0You need a web server (I am using Apache on Fedora), PHP (I am using 5.6) and MySQLi (php-mysqlnd package).<\/p>\n<p>This is a bit of paranoia on my part, but even on a page that is ONLY available internally &#8230; I don&#8217;t like to use an account with read\/write access to display data. I create a new user and assign read access:<\/p>\n<blockquote>\n<pre>CREATE USER 'YourUserName'@'localhost' IDENTIFIED BY 'P#ssw0rdH3r3';\r\nGRANT SELECT ON openhabdb.* to 'YourUserName'@'localhost';\r\nFLUSH PRIVILEGES;<\/pre>\n<\/blockquote>\n<p>Then use *that* user in the php code. This example has a web server running on the database server &#8211; and you connect to the MySQL server via localhost. If your web server is located on a different host, you&#8217;ll need to create and grant &#8216;YourUserName&#8217;@ the web server hostname.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My husband has wanted a quick\/easy way to see the data stored in OpenHAB&#8217;s MySQL persistence database, so I put together a very quick (and ugly) PHP page that provides a list of all Items. If you click on an item, you can page through the item&#8217;s records. The\u00a0index.php\u00a0from the page is available here.\u00a0You need &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33,63],"tags":[56,44],"class_list":["post-768","post","type-post","status-publish","format-standard","hentry","category-coding","category-home-automation","tag-mysql","tag-openhab"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/768","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=768"}],"version-history":[{"count":5,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/768\/revisions"}],"predecessor-version":[{"id":3203,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/768\/revisions\/3203"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=768"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=768"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=768"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}