{"id":3269,"date":"2019-10-02T21:10:28","date_gmt":"2019-10-02T21:10:28","guid":{"rendered":"https:\/\/blog.paranoidprofessor.com\/?p=3269"},"modified":"2019-10-02T21:10:28","modified_gmt":"2019-10-02T21:10:28","slug":"hammers-and-saws-and-iot-oh-my","status":"publish","type":"post","link":"https:\/\/blog.paranoidprofessor.com\/index.php\/2019\/10\/02\/hammers-and-saws-and-iot-oh-my\/","title":{"rendered":"Hammers and Saws and IOT \u2013 oh my"},"content":{"rendered":"\n<p>After moving to a\nnew apartment I needed to get some hardware in order to hang a few\npictures in the livingroom. A quick trip to the hardware store should\nallow me to make my apartment a home.  While walking through the\nstore I was surprised to see smart sockets wedged in between fans and\nlight bulbs.  Not only smart sockets but also a small selection other\nsmart components such as light bulbs and light switches.<\/p>\n\n\n\n<p>When seeing that I\nhad to decide on a smart socket, smart light bulbs, or smart light\nswitches.  I thought that perhaps the most flexible item that I could\nuse would be smart socket, no electrician required.<\/p>\n\n\n\n<p>Smart sockets are\njust a rather clever bit of hardware which includes a small relay for\nswitching on the power on and off.  The real brains for the smart\nsolution is the phone app that controls the device.<\/p>\n\n\n\n<p>I thought I would get a few more smart sockets and see how smart I could make my apartment.<\/p>\n\n\n\n<p><strong>Malmbergs<\/strong><\/p>\n\n\n\n<p>The first device\ntested was that first smart socket from the hardware store. The first\nreal step for all these smart sockets is install the corresponding\napp from your app store \u2013 this app was in both the Google store and\nthe Apple store.<\/p>\n\n\n\n<p>The instructions\nthat came with the device instructed to install the app with the name\n\u201cREC Smart\u201d by Ankuoo[1].  The app requires that you create an\naccount and once the account is created you log into the app\neverything works pretty much as you might expect.<\/p>\n\n\n\n<p>Pairing a new device is just a matter of holding down the power button on the smart switch for at least five seconds and then it is in discover mode.  You can see that by the blue led flashing on the device and then just follow the prompts to add the device Illustration 1.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"441\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2019\/10\/malberg1-4-1024x441.jpg\" alt=\"xxxxxxxx\" class=\"wp-image-3277\"\/><figcaption>Illustration 1: Malberg<\/figcaption><\/figure>\n\n\n\n<p>This smart socket\nand its supporting app really does provide a lot of basic\nfunctionality.  The app will keep a list of all the sockets that have\nbeen registered.  Initially the app will give each device a generic\nname but it is also possible to assign a friendly names to each\ndevice.  \n<\/p>\n\n\n\n<p>The functionality\nthat makes the smart sockets smart is the ability, with the addition\nof software, to create schedules when it should be switched on or\noff.  One of the nice features is the countdown timer.  The timer\noffers six predefined times (5, 10, 15, 30, 60 and 120 minutes). \nThere is actually one little quirk for this particular feature.  The\ntimer functionality assumes that the socket is already turned on.  \n<\/p>\n\n\n\n<p>Traditional hardware\ntimers make it is possible to schedule when the socket should turn on\nor off.  With software it is easier to make this a bit more flexible.\n The rules can be setup for either individual days or to run at the\nsame time on multiple days.<\/p>\n\n\n\n<p>Scheduling tasks is fairly orthogonal, it is possible to add schedules, remove schedules but more important they can be disabled and re-enabled at a later time.  <\/p>\n\n\n\n<p>The final bit of\nfunctionality is called \u201canti-theft timer\u201d.  Much like the\nschedule functionality you select a time range for a day or for days.\n The app will turn the socket on and off at random intervals during\nthis time period.  \n<\/p>\n\n\n\n<p>Note: When you\nenable the anti-theft timer a warning comes up that the other\nfunctionality will be disabled while the anti-theft timer is running.<\/p>\n\n\n\n<p>I used wireshark to\nwatch the traffic when adding a device to the app.  The smart switch\ndoes make a number of connections over the internet.  Once this\nconnection has been defined it is possible to control the device\nusing the data connection from a cell phone.<\/p>\n\n\n\n<p>The communication\nbetween the device seems to be UDP messages[2].  However, despite the\ninformation available on how to control such a device on the internet\nI was unable to control the socket myself.  The information that I\ndid find implied that the packets were unencrypted and it was\npossible to resend packets to control the device.  My experience did\nnot match that of the other users from the internet.  It is possible\nthat over the last few years[3] that the manufacturer has modified\ntheir devices to put security first and remove this avenue of\ncontrol.  It is also a bit sad as I did not find any API that would\nallow me to control this device from Linux.<\/p>\n\n\n\n<p>\n[1]\n<a href=\"https:\/\/www.hornbach.at\/data\/shop\/D04\/001\/780\/491\/304\/314\/6216499_Doc_02_DE_20180117133221.pdf\">https:\/\/www.hornbach.at\/data\/shop\/D04\/001\/780\/491\/304\/314\/6216499_Doc_02_DE_20180117133221.pdf<\/a><\/p>\n\n\n\n<p>\n[2]\n<a href=\"https:\/\/github.com\/Diagonactic\/Ankuoo\">https:\/\/github.com\/Diagonactic\/Ankuoo<\/a><\/p>\n\n\n\n<p>[3] <a href=\"https:\/\/news.ycombinator.com\/item?id=11211037\">https:\/\/news.ycombinator.com\/item?id=11211037<\/a><\/p>\n\n\n\n<p><strong>S1 Series<\/strong><\/p>\n\n\n\n<p>The\nnext device I tested was the \u201cS1 Series WiFi socket\u201d.  This\nsocket is marketed as also working with Alexa which is some\nadditional functionality that the Malmberg socket does not support. I\ndo not have an Alexa so my tests were focused on the basic\nintelligence on the socket and the app that controls it.  Like the\nMalmberg device, it appears that most of the intelligence is not in\nthe device itself but is actually in the smart app that controls the\ndevice.<\/p>\n\n\n\n<p>Just like the Malmberg socket, adding a device is actually quite easy.  Press the power switch for 5 or more seconds until the led starts to flash.  From that point follow the steps in the app to add a device. (Illustration 2)<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"441\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2019\/10\/s1-5-8-1024x441.png\" alt=\"\" class=\"wp-image-3279\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2019\/10\/s1-5-8-1024x441.png 1024w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2019\/10\/s1-5-8-300x129.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2019\/10\/s1-5-8-768x331.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption>Illustration 2: S1<\/figcaption><\/figure>\n\n\n\n<p>The only complicated part about adding a new device is the wide breadth of types of devices that are supported by this app. This is a double edged sword for the technically less savy as you need to be aware of which type of device you are trying to join up.  <\/p>\n\n\n<p style=\"padding-left: 40px;\">ZigBee Low power digital radio<\/p>\n<p style=\"padding-left: 40px;\">Bluetooth Short wavelength UHF radio waves<\/p>\n<p style=\"padding-left: 40px;\">WiFi Standard wireless networking<\/p>\n\n\n<p>Just\nlike the Malmberg device, it is required that you create an account\nwith the manufacturer, Tuya, in order to use the app.<\/p>\n\n\n\n<p>Not\nunsurprisingly the app has a fairly simple set of features, quite\nsimilar to the previous app but Tuya seemed to give more attention to\nthe development of the app, it just felt more polished. \n<\/p>\n\n\n\n<p>The\ntimer also has a much finer level of granularity.  The timer can be\ndefined for how many hours and minutes before the device is switched\noff but it can also be defined to switch on after a given amount of\ntime. \n<\/p>\n\n\n\n<p>It\nis also possible to setup a schedule to turn devices on and off at\ndifferent times.  I found it to be a bit odd that this device only\nallowed you to define a day and time for switching the device either\non <strong>or<\/strong> off.  This does obviously maximize flexibility but it\nalso creates a larger list to be searched when matching up the pairs\nof on\/off times as the number of entries increases.<\/p>\n\n\n\n<p>The\nS1 Series device is different from the other two devices reviewed as\nit supports Alexa and that the Tuya corporation appears they have\nmade some libraries and documentation available[4][5].  This should\nallow people the ability to control their own devices.<\/p>\n\n\n\n<p>I\ndid take a look at the documentation that was available but it is not\nfor the faint of heart.  I was unable to create anything myself using\nthis but it is possible due to the number of projects on github. \nJust search for project with Tuya in the name.<\/p>\n\n\n\n<p>From\nlooking at the website of the Tuya corporation, it seems that they\nmight be licensing the design of their smart switch solution.  This\nis because their web site allows for the creation of your own app\nwith using your own branding[6].  \n<\/p>\n\n\n\n<p>[4]\n<a href=\"https:\/\/docs.tuya.com\/en\/app\/app-sdk\/android-sdk.html\">https:\/\/docs.tuya.com\/en\/app\/app-sdk\/android-sdk.html<\/a><\/p>\n\n\n\n<p>[5]\n<a href=\"https:\/\/github.com\/TuyaInc\/tuyasmart_android_sdk\/tree\/master\/TuyaSmartAndroidSdkDemo\/libs\">https:\/\/github.com\/TuyaInc\/tuyasmart_android_sdk\/tree\/master\/TuyaSmartAndroidSdkDemo\/libs<\/a><\/p>\n\n\n\n<p>[6]\n<a href=\"https:\/\/docs.tuya.com\/en\/app\/app-autobuilding.html\">https:\/\/docs.tuya.com\/en\/app\/app-autobuilding.html<\/a><\/p>\n\n\n\n<p><strong>Sonoff S20<\/strong><\/p>\n\n\n\n<p>The Sonoff S20 smart\nsocket is only one of many different Sonoff smart devices.  The\ncompany also sells smart sockets that also measure temperature,\nmonitor humidity as well as remote controlled light switches[7].<\/p>\n\n\n\n<p>The S20 is\ncontrolled by the eWeLink app to support setting up a timer for\ncreating a schedule for turning the device on and off. \n<\/p>\n\n\n\n<p>The pairing of devices is as simple as starting the synchronization on the switch itself while adding a connection from the smartphone app.  One of the things that make the Sonoff app different from the other two is that it does assume that there can be difficulties in the pairing process, illustration 3.  Based on the realization that difficulties can occur, the app included a frequently asked questions section with a list of the most common problems, illustration 14.  The list is both long and very helpful.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"441\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2019\/10\/s20-1024x441.png\" alt=\"\" class=\"wp-image-3280\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2019\/10\/s20-1024x441.png 1024w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2019\/10\/s20-300x129.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2019\/10\/s20-768x331.png 768w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2019\/10\/s20.png 1080w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption>Illustration 3: Sonoff S20<\/figcaption><\/figure>\n\n\n\n<p>All three\napplications are generally friendly and are localized to the language\nthat has been selected on my smart phone.  One difference in the\neWeLink app, used by the Sonoff, is that it explicitly supports 22\ndifferent languages.  You can select the language on the app itself\nwhich does allow you to select a language on the application that is\nactually different than the underlying phone operating system.  \n<\/p>\n\n\n\n<p>Although changing\nthe application language does work for all of the application menus\nand status\u2019s there is one tiny little inconsistency for the eWeLink\napp.  All of the text that is available under the frequently asked\nquestions remain in English and does not change despite what language\nis selected for the application.<\/p>\n\n\n\n<p>[7]\n<a href=\"http:\/\/sonoff.itead.cc\/en\/\">http:\/\/sonoff.itead.cc\/en\/<\/a><\/p>\n\n\n\n<p>\nAll\nof these smart sockets are well built and the smart phone apps are\neasy enough to use.  Unfortunately all of these smart sockets are\nproduced by separate companies each with incompatible protocols which\nprevents a single app from controlling them all.  The solution is to\neither purchase only from one manufacturer or modify these smart\nsockets with some open source software.  \n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After moving to a new apartment I needed to get some hardware in order to hang a few pictures in the livingroom. A quick trip to the hardware store should allow me to make my apartment a home. While walking &hellip; <a href=\"https:\/\/blog.paranoidprofessor.com\/index.php\/2019\/10\/02\/hammers-and-saws-and-iot-oh-my\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[20],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/3269"}],"collection":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/comments?post=3269"}],"version-history":[{"count":4,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/3269\/revisions"}],"predecessor-version":[{"id":3281,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/3269\/revisions\/3281"}],"wp:attachment":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/media?parent=3269"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/categories?post=3269"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/tags?post=3269"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}