{"id":442,"date":"2018-09-03T21:06:13","date_gmt":"2018-09-04T04:06:13","guid":{"rendered":"http:\/\/dragonwarz.net\/?p=442"},"modified":"2018-09-03T21:06:13","modified_gmt":"2018-09-04T04:06:13","slug":"adding-sensor-support","status":"publish","type":"post","link":"https:\/\/dragonwarz.net\/?p=442","title":{"rendered":"Adding Sensor Support"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I decided to get more hardware support for different Sensors going.\u00a0 In the process, I&#8217;m cleaning up and enhancing the sensor and database code.\u00a0 This will allow recording of ONLY what sensors are present, so there&#8217;s no big list of &#8220;N\/A&#8221; for things not there, just null columns.\u00a0\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I think I have added \/ modified all the compatible sensors that I have, which include the Raspberry Pi Sense hat, and the following, that are all Pimoroni brand Sensors;\u00a0 bh1745 (Light), BME680 (Temp, Pressure, Humidity and gas resistance), Enviro hat (temp, pressure, light, magnetometer,\u00a0accelerometer), LSM303D (magnetometer,\u00a0accelerometer),\u00a0VL53L1X (Distance sensor \/w lasers).\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now to modify the SQL writer to work with them.\u00a0 Although, I&#8217;m going to take a little time to rethink how it determines which sensors are available, as I would like to cut down on the amount of code needed to identify said available sensors&#8230; Not to mention make it simpler to understand and modify.\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">30 min later &#8230;.\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I think I got it!\u00a0 create a new line per sensor in the &#8220;Sensors installed&#8221; file, have a number as the first char, such as 0 = not installed, 1 = installed.\u00a0 Then after that, put the name of the sensor, as it would only look at the line&#8217;s first char to check.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example.<br\/># The first char is 0 for disabled and 1 for enabled<br\/>0 = Pimoroni BME680<br\/>1 = Pimoroni Enviro<br\/>0 = Pimoroni\u00a0bh1745<br\/>0 = etc.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This way, it&#8217;s easy to modify if you open the config up, as the names right there with simple instructions.\u00a0 hmm&#8230; yeah I think that will do nicely. Time to work that into the installer script.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I decided to get more hardware support for different Sensors going.\u00a0 In the process, I&#8217;m cleaning up and enhancing the sensor and database code.\u00a0 This will allow recording of ONLY what sensors are present, so there&#8217;s no big list of &hellip;<\/p>\n<p class=\"read-more\"><a href=\"https:\/\/dragonwarz.net\/?p=442\">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-442","post","type-post","status-publish","format-standard","hentry","category-random"],"_links":{"self":[{"href":"https:\/\/dragonwarz.net\/index.php?rest_route=\/wp\/v2\/posts\/442","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=442"}],"version-history":[{"count":1,"href":"https:\/\/dragonwarz.net\/index.php?rest_route=\/wp\/v2\/posts\/442\/revisions"}],"predecessor-version":[{"id":443,"href":"https:\/\/dragonwarz.net\/index.php?rest_route=\/wp\/v2\/posts\/442\/revisions\/443"}],"wp:attachment":[{"href":"https:\/\/dragonwarz.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=442"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dragonwarz.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=442"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dragonwarz.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=442"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}