{"id":1409,"date":"2016-12-23T00:01:49","date_gmt":"2016-12-22T23:01:49","guid":{"rendered":"http:\/\/iot.fkainka.de\/?p=1409"},"modified":"2018-10-24T16:05:10","modified_gmt":"2018-10-24T15:05:10","slug":"day23-2016","status":"publish","type":"post","link":"https:\/\/iot.fkainka.de\/en\/day23-2016","title":{"rendered":"Day 23: MQTT Climate"},"content":{"rendered":"<p>Behind the door for today is a battery clip for a 9 V block, with which you can make the entire system moveable. An alternative to a battery is a power bank (a rechargeable battery pack, normally for mobile phones). You can see in today&#8217;s layout picture how to connect a 9 V battery correctly.<\/p>\n<div id=\"attachment_1410\" style=\"width: 626px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day23_Climate_Steckplatine.jpg\"><img aria-describedby=\"caption-attachment-1410\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-1410 size-large\" src=\"http:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day23_Climate_Steckplatine-1024x560.jpg\" alt=\"So k\u00f6nnen Sie eine 9V-Batterie am heutigen Aufbau anschlie\u00dfen\" width=\"616\" height=\"337\" srcset=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day23_Climate_Steckplatine-1024x560.jpg 1024w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day23_Climate_Steckplatine-300x164.jpg 300w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day23_Climate_Steckplatine-768x420.jpg 768w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day23_Climate_Steckplatine-972x532.jpg 972w, https:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day23_Climate_Steckplatine.jpg 1162w\" sizes=\"(max-width: 616px) 100vw, 616px\" \/><\/a><p id=\"caption-attachment-1410\" class=\"wp-caption-text\">This is how you can connect a 9 V battery to today&#8217;s layout<\/p><\/div>\n<p>Climate data should be captured again today. But this time they are published through the MQTT broker and are thus accessible worldwide. The data could thus be called up via a plug-in and stored in a database.<br \/>\n<iframe loading=\"lazy\" style=\"height: 400px; width: 100%; margin: 10px 0;\" src=\"https:\/\/create.arduino.cc\/editor\/FKainka\/02f00213-651d-4651-bcf2-1a779c2e9e24\/preview?embed\" width=\"300\" height=\"150\" frameborder=\"0\"><\/iframe><br \/>\nDownload today&#8217;s programme and program your NanoESP with it. After a short time, the board is connected to the WLAN and the broker and begins to send the measurement data. Now go to the<a href=\"http:\/\/www.hivemq.com\/try-out\/\"> http:\/\/www.hivemq.com\/try-out\/<\/a> page and connect to the broker. Subscribe to these topics:<\/p>\n<p><strong>NanoESP\/MyMQTTiD\/climate\/temp<\/strong><\/p>\n<p><strong> NanoESP\/MyMQTTiD\/climate\/light<\/strong><\/p>\n<p><strong> NanoESP\/MyMQTTiD\/climate\/hum<\/strong><\/p>\n<p>As always, replace MyMQTTiD with your personal ID. You now see in the browser how the data arrive in quick succession. Next subscribe to the following topic:<\/p>\n<p><strong>NanoESP\/MyMQTTiD\/climate\/status<\/strong><\/p>\n<p>You ought to receive the message &#8220;online.&#8221; Now disconnect the board from the power. Logically, you should now no longer receive any new temperature data. However, after approx. 10 seconds, the status changes from &#8220;online&#8221; to &#8220;offline.&#8221; How is that possible if the board can&#8217;t send any messages at all anymore?<\/p>\n<p>The trick lies in the last will message that was defined upon connection to the broker. This message is sent when the connection is suddenly broken. But it takes a while for the broker to notice the interruption of the connection. How long it takes is likewise defined when the connection is established, with the keep-alive time. If no message is sent from the board to the broker within the time given there, the broker assumes that the connection was broken. This time is defined in the library as standard at 120 seconds. For today&#8217;s test, however, it is 10 seconds. So that the connection is not cut off only because the NanoESP currently has nothing to report, there is the stayConnected command. Here, if not stated otherwise, a ping is sent to the broker after half of the keep-alive time as a sign that the connection is still active.<\/p>","protected":false},"excerpt":{"rendered":"<p>Behind the door for today is a battery clip for a 9 V block, with which you can make the entire system moveable. An alternative to a battery is a power bank (a rechargeable battery pack, normally for mobile phones)&#8230;.<br \/><a class=\"read-more-button\" href=\"https:\/\/iot.fkainka.de\/en\/day23-2016\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":1410,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[123,124,311],"tags":[129,130,21,127],"jetpack_publicize_connections":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Day 23: MQTT Climate - Internet of Things with the NanoESP<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/iot.fkainka.de\/day23-2016\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Day 23: MQTT Climate - Internet of Things with the NanoESP\" \/>\n<meta property=\"og:description\" content=\"Behind the door for today is a battery clip for a 9 V block, with which you can make the entire system moveable. An alternative to a battery is a power bank (a rechargeable battery pack, normally for mobile phones)....Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/iot.fkainka.de\/day23-2016\" \/>\n<meta property=\"og:site_name\" content=\"Internet of Things with the NanoESP\" \/>\n<meta property=\"article:published_time\" content=\"2016-12-22T23:01:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-10-24T15:05:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day23_Climate_Steckplatine.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1162\" \/>\n\t<meta property=\"og:image:height\" content=\"636\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"fk\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"fk\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/iot.fkainka.de\/day23-2016\",\"url\":\"https:\/\/iot.fkainka.de\/day23-2016\",\"name\":\"Day 23: MQTT Climate - Internet of Things with the NanoESP\",\"isPartOf\":{\"@id\":\"https:\/\/iot.fkainka.de\/#website\"},\"datePublished\":\"2016-12-22T23:01:49+00:00\",\"dateModified\":\"2018-10-24T15:05:10+00:00\",\"author\":{\"@id\":\"https:\/\/iot.fkainka.de\/#\/schema\/person\/d3205fdf2649027fc35e240d4f8b285a\"},\"breadcrumb\":{\"@id\":\"https:\/\/iot.fkainka.de\/day23-2016#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/iot.fkainka.de\/day23-2016\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/iot.fkainka.de\/day23-2016#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/iot.fkainka.de\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tag 23: MQTT Climate\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/iot.fkainka.de\/#website\",\"url\":\"https:\/\/iot.fkainka.de\/\",\"name\":\"Internet of Things with the NanoESP\",\"description\":\"The webpage for the Arduino compatible WiFi-Board\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/iot.fkainka.de\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/iot.fkainka.de\/#\/schema\/person\/d3205fdf2649027fc35e240d4f8b285a\",\"name\":\"fk\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/iot.fkainka.de\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/141cf958a831e66efabf9674e117e8d9?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/141cf958a831e66efabf9674e117e8d9?s=96&d=identicon&r=g\",\"caption\":\"fk\"},\"url\":\"https:\/\/iot.fkainka.de\/en\/author\/fk\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Day 23: MQTT Climate - Internet of Things with the NanoESP","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/iot.fkainka.de\/day23-2016","og_locale":"en_US","og_type":"article","og_title":"Day 23: MQTT Climate - Internet of Things with the NanoESP","og_description":"Behind the door for today is a battery clip for a 9 V block, with which you can make the entire system moveable. An alternative to a battery is a power bank (a rechargeable battery pack, normally for mobile phones)....Read more","og_url":"https:\/\/iot.fkainka.de\/day23-2016","og_site_name":"Internet of Things with the NanoESP","article_published_time":"2016-12-22T23:01:49+00:00","article_modified_time":"2018-10-24T15:05:10+00:00","og_image":[{"width":1162,"height":636,"url":"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day23_Climate_Steckplatine.jpg","type":"image\/jpeg"}],"author":"fk","twitter_card":"summary_large_image","twitter_misc":{"Written by":"fk","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/iot.fkainka.de\/day23-2016","url":"https:\/\/iot.fkainka.de\/day23-2016","name":"Day 23: MQTT Climate - Internet of Things with the NanoESP","isPartOf":{"@id":"https:\/\/iot.fkainka.de\/#website"},"datePublished":"2016-12-22T23:01:49+00:00","dateModified":"2018-10-24T15:05:10+00:00","author":{"@id":"https:\/\/iot.fkainka.de\/#\/schema\/person\/d3205fdf2649027fc35e240d4f8b285a"},"breadcrumb":{"@id":"https:\/\/iot.fkainka.de\/day23-2016#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/iot.fkainka.de\/day23-2016"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/iot.fkainka.de\/day23-2016#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/iot.fkainka.de\/"},{"@type":"ListItem","position":2,"name":"Tag 23: MQTT Climate"}]},{"@type":"WebSite","@id":"https:\/\/iot.fkainka.de\/#website","url":"https:\/\/iot.fkainka.de\/","name":"Internet of Things with the NanoESP","description":"The webpage for the Arduino compatible WiFi-Board","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/iot.fkainka.de\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/iot.fkainka.de\/#\/schema\/person\/d3205fdf2649027fc35e240d4f8b285a","name":"fk","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/iot.fkainka.de\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/141cf958a831e66efabf9674e117e8d9?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/141cf958a831e66efabf9674e117e8d9?s=96&d=identicon&r=g","caption":"fk"},"url":"https:\/\/iot.fkainka.de\/en\/author\/fk"}]}},"jetpack_featured_media_url":"https:\/\/iot.fkainka.de\/wp-content\/uploads\/2016\/09\/Day23_Climate_Steckplatine.jpg","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6McI0-mJ","_links":{"self":[{"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/posts\/1409"}],"collection":[{"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/comments?post=1409"}],"version-history":[{"count":3,"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/posts\/1409\/revisions"}],"predecessor-version":[{"id":1540,"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/posts\/1409\/revisions\/1540"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/media\/1410"}],"wp:attachment":[{"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/media?parent=1409"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/categories?post=1409"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/iot.fkainka.de\/en\/wp-json\/wp\/v2\/tags?post=1409"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}