{"id":493,"date":"2015-11-09T07:05:24","date_gmt":"2015-11-09T05:05:24","guid":{"rendered":"http:\/\/blog.appcloud.ch\/?p=493"},"modified":"2017-04-14T22:04:00","modified_gmt":"2017-04-14T20:04:00","slug":"another-lametric-iot-use-case","status":"publish","type":"post","link":"https:\/\/blog.sachathomet.ch\/de\/2015\/11\/09\/another-lametric-iot-use-case\/","title":{"rendered":"Ein weiteres LaMetric IoT Script &#8211; Stromsteuerung"},"content":{"rendered":"<p>Da ich momentan Urlaub habe, ist hier ein weiterer Artikel der aber nichts mit Virtualisierung zu tun hat &#8230;<\/p>\n<p>I combined my new &#8222;gadgets&#8220; the <a href=\"http:\/\/lametric.com\/\" target=\"_blank\">LaMetric<\/a> time and my new wifi Smart-Plug from <a href=\"https:\/\/mystrom.ch\" target=\"_blank\">MyStrom<\/a>. The goal was to report the current power consumption of power plug and the possibility to control the plug with the smart ticker.<\/p>\n<p><iframe loading=\"lazy\" title=\"MyStrom LaMetric IoT\" width=\"200\" height=\"113\" src=\"https:\/\/www.youtube.com\/embed\/ItRBUaqWty4?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p>MyStrom has a very straight forward API (<a href=\"https:\/\/mystrom.ch\/en\/mystrom-api\" target=\"_blank\">https:\/\/mystrom.ch\/en\/mystrom-api<\/a>), and the possibility to create apps for LaMetric is pretty easy what I&#8217;ve already mentioned in an past\u00a0blog post.<\/p>\n<p>All what is needed to implement this solution is:<\/p>\n<ul>\n<li>a web server which can parse PHP<\/li>\n<li>two small scripts<\/li>\n<li>and a private app for LaMetric<\/li>\n<\/ul>\n<p><strong>This is the script to see the current power consumption:<\/strong><\/p>\n<pre class=\"brush: php; collapse: false; title: mystrom.php; notranslate\" title=\"mystrom.php\">\r\n{\r\n    \"frames\": &#x5B;\r\n        {\r\n            \"index\": 0,\r\n            \"text\": \"  Watt\",\r\n            \"icon\": \"i1692\"\r\n        }\r\n    ]\r\n}\r\n<\/pre>\n<p>I just read the content from the API, which is already in JSON format, but I reformat it that it is in that way which I need to bring it to the LaMetric.<br \/>\n<strong>This is the script to control\u00a0the power outlet:<\/strong><\/p>\n<pre class=\"brush: php; collapse: false; title: mystrom-controller.php; notranslate\" title=\"mystrom-controller.php\">\r\n\r\n<\/pre>\n<p><strong>And the LaMetric private app:<\/strong><\/p>\n<p>This simple poll app call the script on the webserver (192.168.1.20) with the parameter of the MyStrom plug (192.168.1.59).<\/p>\n<p>On button action the controller script is launched with change the status (off to on or visa verse)<\/p>\n<p><a href=\"http:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/11\/myStromApp-mini.jpg\" target=\"_blank\" rel=\"http:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/11\/myStromApp.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-501 size-full\" src=\"http:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/11\/myStromApp-mini.jpg\" alt=\"myStromApp-mini\" width=\"494\" height=\"673\" srcset=\"https:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/11\/myStromApp-mini.jpg 494w, https:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/11\/myStromApp-mini-220x300.jpg 220w\" sizes=\"auto, (max-width: 494px) 100vw, 494px\" \/><\/a><\/p>\n<p>(192.168.1.59 is the ip of my Power outlet. 192.168.1.20 is the address of my web server, this can be a raspberry pi or a Synology.)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Da ich momentan Urlaub habe, ist hier ein weiterer Artikel der aber nichts mit Virtualisierung zu tun hat &#8230; I combined my new &#8222;gadgets&#8220; the LaMetric time and my new wifi Smart-Plug from MyStrom. The goal was to report the current power consumption of power plug and the possibility to control the plug with the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,8,1],"tags":[25,28,29,37],"class_list":["post-493","post","type-post","status-publish","format-standard","hentry","category-guide","category-scripts","category-uncategorized","tag-iot","tag-lametric","tag-mystrom","tag-smarthome"],"translation":{"provider":"WPGlobus","version":"3.0.2","language":"de","enabled_languages":["en","de"],"languages":{"en":{"title":true,"content":true,"excerpt":false},"de":{"title":true,"content":true,"excerpt":false}}},"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/blog.sachathomet.ch\/de\/wp-json\/wp\/v2\/posts\/493","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.sachathomet.ch\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.sachathomet.ch\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.sachathomet.ch\/de\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.sachathomet.ch\/de\/wp-json\/wp\/v2\/comments?post=493"}],"version-history":[{"count":4,"href":"https:\/\/blog.sachathomet.ch\/de\/wp-json\/wp\/v2\/posts\/493\/revisions"}],"predecessor-version":[{"id":942,"href":"https:\/\/blog.sachathomet.ch\/de\/wp-json\/wp\/v2\/posts\/493\/revisions\/942"}],"wp:attachment":[{"href":"https:\/\/blog.sachathomet.ch\/de\/wp-json\/wp\/v2\/media?parent=493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.sachathomet.ch\/de\/wp-json\/wp\/v2\/categories?post=493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.sachathomet.ch\/de\/wp-json\/wp\/v2\/tags?post=493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}