{"id":3339,"date":"2018-08-15T11:24:05","date_gmt":"2018-08-15T16:24:05","guid":{"rendered":"http:\/\/lisa.rushworth.us\/?p=3339"},"modified":"2018-08-16T14:22:37","modified_gmt":"2018-08-16T19:22:37","slug":"zoneminder-snapshot-with-openhab-binding","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=3339","title":{"rendered":"Zoneminder Snapshot With openHAB Binding"},"content":{"rendered":"<p>When we upgraded to Fedora 28 on our server, ZoneMinder ceased working because some <a href=\"http:\/\/lisa.rushworth.us\/?p=3321\" target=\"_blank\" rel=\"noopener\">CakePHP function names could no longer be used.<\/a> To resolve the issue, I ended up running a snapshot build of ZoneMinder that included a newer build of CakePHP. Version 1.31.45 instead of 1.30.4-7 on the repository.<\/p>\n<p>All of our cameras showed up, and although the ZoneMinder folks seem to have a bug in their SQL query when building out the table of event counts on the main page (that is, all of my monitors have blank instead of event counts and my apache log is filled with<\/p>\n<pre>[Wed Aug 15 12:08:37.152933 2018] [php7:notice] [pid 32496] [client 10.5.5.234:14705] ERR [SQL-ERR 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'and E.MonitorId = '13' ),1,NULL)) as EventCount1, count(if(1 and (  and E.Monito' at line 1', statement was 'select count(if(1 and ( E.MonitorId = '13' ),1,NULL)) as EventCount0, count(if(1 and (  and E.MonitorId = '13' ),1,NULL)) as EventCount1, count(if(1 and (  and E.MonitorId = '13' ),1,NULL)) as EventCount2, count(if(1 and (  and E.MonitorId = '13' ),1,NULL)) as EventCount3, count(if(1 and (  and E.MonitorId = '13' ),1,NULL)) as EventCount4, count(if(1 and (  and E.MonitorId = '13' ),1,NULL)) as EventCount5 from Events as E where MonitorId = ?' params:13]<\/pre>\n<p>&#8230; it works.<\/p>\n<p>Until Scott checked openHAB, where all of the items are offline. Apparently the openHAB ZoneMinder binding is using the cgi-bin stuff to get the value of ZM_PATH_ZMS. A config option which was removed from the database as part of the upgrade process.<\/p>\n<pre>Upgrading database to version 1.31.1\r\nLoading config from DBNo option 'ZM_DIR_EVENTS' found, removing.\r\nNo option 'ZM_DIR_IMAGES' found, removing.\r\nNo option 'ZM_DIR_SOUNDS' found, removing.\r\nNo option 'ZM_FRAME_SOCKET_SIZE' found, removing.\r\nNo option 'ZM_OPT_FRAME_SERVER' found, removing.\r\nNo option 'ZM_PATH_ARP' found, removing.\r\nNo option 'ZM_PATH_LOGS' found, removing.\r\nNo option 'ZM_PATH_MAP' found, removing.\r\nNo option 'ZM_PATH_SOCKS' found, removing.\r\nNo option 'ZM_PATH_SWAP' found, removing.\r\nNo option 'ZM_PATH_ZMS' found, removing.\r\n 207 entries\r\nSaving config to DB 207 entries\r\nUpgrading DB to 1.30.4 from 1.30.3<\/pre>\n<p>The calls from openHAB yield 404 errors in the access_log<\/p>\n<pre>10.0.0.5 - - [15\/Aug\/2018:09:38:04 -0400] \"GET \/zm\/api\/configs\/view\/ZM_PATH_ZMS.json HTTP\/1.1\" 404 1751 \"-\" \"Jetty\/9.3.21.v20170918\"<\/pre>\n<p>&nbsp;<\/p>\n<p>Unfortunately they&#8217;ve changed the URL to get these values &#8212; it&#8217;s <a href=\"https:\/\/github.com\/ZoneMinder\/zoneminder\/pull\/2101\" target=\"_blank\" rel=\"noopener\">&#8220;munged&#8221; from the config file<\/a> as the parameters are no longer stored to the Config table.<br \/>\nhttp:\/\/zoneminder.domain.ccTLD\/zm\/api\/configs\/view\/ZM_PATH_ZMS.json<br \/>\nis now<br \/>\nhttp:\/\/zoneminder.domain.ccTLD\/zm\/api\/configs\/viewByName\/ZM_PATH_ZMS.json<\/p>\n<p>So &#8230; that&#8217;s a problem!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When we upgraded to Fedora 28 on our server, ZoneMinder ceased working because some CakePHP function names could no longer be used. To resolve the issue, I ended up running a snapshot build of ZoneMinder that included a newer build of CakePHP. Version 1.31.45 instead of 1.30.4-7 on the repository. All of our cameras showed &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[63,30],"tags":[44,394,61],"class_list":["post-3339","post","type-post","status-publish","format-standard","hentry","category-home-automation","category-system-administration","tag-openhab","tag-openhab2","tag-zoneminder"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/3339","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=3339"}],"version-history":[{"count":5,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/3339\/revisions"}],"predecessor-version":[{"id":3354,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/3339\/revisions\/3354"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3339"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3339"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3339"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}