{"id":566,"date":"2018-11-06T15:35:51","date_gmt":"2018-11-06T23:35:51","guid":{"rendered":"http:\/\/dragonwarz.net\/?p=566"},"modified":"2018-11-06T15:35:51","modified_gmt":"2018-11-06T23:35:51","slug":"more-sql-write-modifications","status":"publish","type":"post","link":"https:\/\/dragonwarz.net\/?p=566","title":{"rendered":"More SQL write modifications"},"content":{"rendered":"\n<p>I figured it was about time to re-look at the &#8220;write to SQL DB&#8221; code, especially for the datetime entries when writing to the database.\u00a0 Long story short, I had SQL input the datetime values at the time of recording, but because the code grabbed a few readings to check against the variances, the data ended up being entering with fairly inaccurate datetime correlations (by hundreds of milliseconds or more).\u00a0\u00a0<\/p>\n\n\n\n<p>So, I changed the code in a few ways.\u00a0 First, I found out how to get the exact same formatting for the datetime as SQL was using, and used that at the time of actually getting the sensor data (through Python datetime).\u00a0 I also made the Trigger variance checks &amp; database recording, work on 5 readings at a time.\u00a0 If any of the 5 readings trigger a recording, all 5 will be recorded, so in theory, it will record entries before and after the event that triggered it.\u00a0<\/p>\n\n\n\n<p>That&#8217;s it for today.\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I figured it was about time to re-look at the &#8220;write to SQL DB&#8221; code, especially for the datetime entries when writing to the database.\u00a0 Long story short, I had SQL input the datetime values at the time of recording, &hellip;<\/p>\n<p class=\"read-more\"><a href=\"https:\/\/dragonwarz.net\/?p=566\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-566","post","type-post","status-publish","format-standard","hentry","category-random"],"_links":{"self":[{"href":"https:\/\/dragonwarz.net\/index.php?rest_route=\/wp\/v2\/posts\/566","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dragonwarz.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dragonwarz.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dragonwarz.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/dragonwarz.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=566"}],"version-history":[{"count":1,"href":"https:\/\/dragonwarz.net\/index.php?rest_route=\/wp\/v2\/posts\/566\/revisions"}],"predecessor-version":[{"id":567,"href":"https:\/\/dragonwarz.net\/index.php?rest_route=\/wp\/v2\/posts\/566\/revisions\/567"}],"wp:attachment":[{"href":"https:\/\/dragonwarz.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dragonwarz.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=566"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dragonwarz.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}