{"id":516,"date":"2015-12-20T09:27:12","date_gmt":"2015-12-20T07:27:12","guid":{"rendered":"http:\/\/blog.appcloud.ch\/?p=516"},"modified":"2017-04-14T22:06:15","modified_gmt":"2017-04-14T20:06:15","slug":"control-mystrom-smart-plug-by-a-trigger-ifttt-or-octoblu","status":"publish","type":"post","link":"https:\/\/blog.sachathomet.ch\/de\/2015\/12\/20\/control-mystrom-smart-plug-by-a-trigger-ifttt-or-octoblu\/","title":{"rendered":"Steure ein MyStrom Wifi Switch mit einem Schalter (und ifttt oder octoblu)"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-518 alignright\" src=\"http:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/12\/mystrom.jpg\" alt=\"mystrom\" width=\"140\" height=\"161\" \/>Some weeks ago I bought my first smart plug from MyStrom. If you are living \u00a0in Switzerland you have\u00a0only a limited choice of smart plugs because of the non EU standard plug (T13).<\/p>\n<p>MyStrom is pretty cool because it mets almost all my requirement, there is a possibility to measure to power consumption within two rates (day and night), it&#8217;s controllable with the mobile phone app and there is a nice web interface.<\/p>\n<p><strong>But one thing I miss, I cannot react to triggers and power of the smart plug on a defined event.<\/strong> Like already in an earlier post mentioned there is a REST API which allows to control the plug <span style=\"text-decoration: underline;\">from the internal network<\/span>. (See\u00a0<a href=\"http:\/\/blog.sachathomet.ch\/another-lametric-iot-use-case\/\">Another LaMetric IoT script \u2013 power control<\/a>)<\/p>\n<p>Last day&#8217;s I just found the API documentation which allows to control the MyStrom out of the cloud:<br \/>\n<a href=\"https:\/\/mystrom.ch\/mobile\/\" target=\"_blank\">https:\/\/mystrom.ch\/mobile\/\u00a0<\/a><\/p>\n<p>So I\u00a0have now all to connect this Thing to the Internet and react on a trigger.<\/p>\n<h1>Possibility 1: The everything imaginable way,<br \/>\nMyStrom and Octoblu<\/h1>\n<h1><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-521\" src=\"http:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/12\/mystromlogo.jpg\" alt=\"mystromlogo\" width=\"100\" height=\"100\" srcset=\"https:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/12\/mystromlogo.jpg 250w, https:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/12\/mystromlogo-150x150.jpg 150w, https:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/12\/mystromlogo-100x100.jpg 100w\" sizes=\"auto, (max-width: 100px) 100vw, 100px\" \/>\u00a0 <strong>\u00a0 \u00a0 + \u00a0 \u00a0<\/strong> \u00a0<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-528\" src=\"http:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/12\/ocoblu.jpg\" alt=\"ocoblu\" width=\"100\" height=\"100\" srcset=\"https:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/12\/ocoblu.jpg 250w, https:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/12\/ocoblu-150x150.jpg 150w, https:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/12\/ocoblu-100x100.jpg 100w\" sizes=\"auto, (max-width: 100px) 100vw, 100px\" \/><\/h1>\n<p>If you are using Octoblu beta, which is currently available for everyone for free you can create very intelligent workflows to control your smart plug. You can react to twitter and power of or on depending what is twittered, you can power off your heater as soon a temperature is reached, you can stop charge as soon your device have a defined state of charge.<\/p>\n<p><strong>The Things you connect\u00a0use with Octoblu are\u00a0nearly infinite.<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-526\" src=\"http:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/12\/mystrom-octoblu.jpg\" alt=\"mystrom-octoblu\" width=\"537\" height=\"328\" srcset=\"https:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/12\/mystrom-octoblu.jpg 855w, https:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/12\/mystrom-octoblu-300x184.jpg 300w, https:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/12\/mystrom-octoblu-768x470.jpg 768w\" sizes=\"auto, (max-width: 537px) 100vw, 537px\" \/><\/p>\n<p><strong>Octoblu is for advanced use, and to be honest I&#8217;m also on the learning phase!<\/strong> I do not describe here more details for this case. There are a lot of sample blueprints on <a href=\"https:\/\/www.octoblu.com\" target=\"_blank\">https:\/\/www.octoblu.com<\/a>\u00a0. \u00a0Octoblu was acquired by Citrix in 2015.<\/p>\n<h1>Possibility 2: The easy way,<br \/>\nMyStrom and\u00a0IFTTT<\/h1>\n<h1>\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-521\" src=\"http:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/12\/mystromlogo.jpg\" alt=\"mystromlogo\" width=\"100\" height=\"100\" srcset=\"https:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/12\/mystromlogo.jpg 250w, https:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/12\/mystromlogo-150x150.jpg 150w, https:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/12\/mystromlogo-100x100.jpg 100w\" sizes=\"auto, (max-width: 100px) 100vw, 100px\" \/>\u00a0 \u00a0 \u00a0\u00a0+ \u00a0 \u00a0 \u00a0<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-517\" src=\"http:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/12\/iftttlogo.jpg\" alt=\"iftttlogo\" width=\"262\" height=\"97\" srcset=\"https:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/12\/iftttlogo.jpg 580w, https:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2015\/12\/iftttlogo-300x111.jpg 300w\" sizes=\"auto, (max-width: 262px) 100vw, 262px\" \/><\/h1>\n<p>This way is suitable for &#8222;Home use&#8220; and for people who only want to create a simple workflow where a trigger initiate for example a Power On or Power Of of the smart plug.<\/p>\n<p><strong>All what you need<\/strong> is a Control-Script on a Webserver with PHP on the Internet, and a IFTTT account.<\/p>\n<p><strong>How it works:<\/strong> The script is very simple, it just handle the \u00a0authentication process on the API, read the AuthToken out of the JSON answer and Push out the payload with the AuthToken.\u00a0IFTTT just take the trigger and call the script with the username, passwort and the payload which you can build from the API<\/p>\n<p><strong>Example:<\/strong> I want to control my smart plug by twitter, if I twitter #lightsoff<\/p>\n<p><strong>Step 1:<\/strong><\/p>\n<p>Take this script and put it on your webserver:<\/p>\n<pre class=\"brush: php; collapse: false; title: myStromAuthenticator.php; notranslate\" title=\"myStromAuthenticator.php\">\r\n\r\n<\/pre>\n<p><strong>Step 2:<\/strong><\/p>\n<p>Create a recipe on IFTTT, use Twitter as Trigger and Maker as Action. In maker you create your request:<\/p>\n<p class=\"p1\">[yourwebserver]myStromAuthenticator.php?email=[youraccountemail]&amp;password[yourpassword]&amp;payload=[yourpayload]<\/p>\n<p class=\"p1\">e.g. the payload to<span style=\"color: #ff0000;\"> turn of<\/span> the device with <span style=\"color: #339966;\">Mac 64002D012325<\/span> is: https:\/\/mystrom.ch\/mobile\/device\/switch?on=<span style=\"color: #ff0000;\">false<\/span>%id=<span style=\"color: #339966;\">64002D012325<\/span><\/p>\n<p class=\"p1\">The result should be that:<\/p>\n<p class=\"p1\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-575\" src=\"http:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2016\/02\/mystrom-ifttt-572x1024-1.jpg\" alt=\"mystrom-ifttt-572x1024\" width=\"572\" height=\"1024\" srcset=\"https:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2016\/02\/mystrom-ifttt-572x1024-1.jpg 572w, https:\/\/blog.sachathomet.ch\/wp-content\/uploads\/2016\/02\/mystrom-ifttt-572x1024-1-168x300.jpg 168w\" sizes=\"auto, (max-width: 572px) 100vw, 572px\" \/><\/p>\n<p class=\"p1\">You create 2 of those recipies, one to Power On and one to Power Off<\/p>\n<p class=\"p1\">Now you can twitter you defined hashtags to control your smart plug.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some weeks ago I bought my first smart plug from MyStrom. If you are living \u00a0in Switzerland you have\u00a0only a limited choice of smart plugs because of the non EU standard plug (T13). MyStrom is pretty cool because it mets almost all my requirement, there is a possibility to measure to power consumption within two [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,8,1],"tags":[23,25,29,31],"class_list":["post-516","post","type-post","status-publish","format-standard","hentry","category-iot","category-scripts","category-uncategorized","tag-ifttt","tag-iot","tag-mystrom","tag-octoblu"],"translation":{"provider":"WPGlobus","version":"3.0.5","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\/516","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=516"}],"version-history":[{"count":3,"href":"https:\/\/blog.sachathomet.ch\/de\/wp-json\/wp\/v2\/posts\/516\/revisions"}],"predecessor-version":[{"id":1021,"href":"https:\/\/blog.sachathomet.ch\/de\/wp-json\/wp\/v2\/posts\/516\/revisions\/1021"}],"wp:attachment":[{"href":"https:\/\/blog.sachathomet.ch\/de\/wp-json\/wp\/v2\/media?parent=516"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.sachathomet.ch\/de\/wp-json\/wp\/v2\/categories?post=516"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.sachathomet.ch\/de\/wp-json\/wp\/v2\/tags?post=516"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}