{"id":1144,"date":"2020-10-12T15:20:13","date_gmt":"2020-10-12T19:20:13","guid":{"rendered":"https:\/\/blog.lufamily.ca\/kang\/?p=1144"},"modified":"2020-10-12T15:20:16","modified_gmt":"2020-10-12T19:20:16","slug":"teckin-smart-led-bulb","status":"publish","type":"post","link":"https:\/\/blog.lufamily.ca\/kang\/2020\/10\/12\/teckin-smart-led-bulb\/","title":{"rendered":"Teckin Smart LED Bulb"},"content":{"rendered":"\n<p>I found a pair of these on Amazon for around $30 CAD (after a $2 coupon saving). They look like fun to install. I figured that now that I know how to <a rel=\"noreferrer noopener\" href=\"https:\/\/blog.lufamily.ca\/kang\/2020\/10\/08\/gosund-tuya-smart-outlet-with-homekit\/\" target=\"_blank\">installed Tuya devices with the Homebridge<\/a>, these would be great additions to the common areas of the house, should we need some colour added to our lives.<\/p>\n\n\n\n<p>Amazon was extremely helpful and these bulbs came the next day. Amazon Prime is such a great service!<\/p>\n\n\n\n<p>I proceeded to add these devices to the <a rel=\"noreferrer noopener\" href=\"https:\/\/apps.apple.com\/us\/app\/tuyasmart\/id1034649547\" target=\"_blank\">TuyaSmart<\/a> app without any issues. Tested the lights using the app. I then logged into the Tuya developer site to ensure that the new devices were registered.<\/p>\n\n\n\n<p>I provided the configuration into Homebridge using the following template from the <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/AMoo-Miki\/homebridge-tuya-lan\/wiki\/Supported-Devices#white-and-color-light-bulbs\" target=\"_blank\">homebridge-tuya-lan plugin page<\/a>. Unfortunately, the provided sample template did not work, because the <code>datapoint identifier<\/code>, a terminology that represents a numerical id that uniquely identifies a specific device function, such as power on\/off the device. My vague understanding is that the OEM, in this case Teckin, can pick and choose the <code>datapoint identifier<\/code> when creating their product, and map specific numerical values to the various functions of their devices. I gleaned this from Tuya&#8217;s developer documentation <a rel=\"noreferrer noopener\" href=\"https:\/\/developer.tuya.com\/en\/docs\/iot\/configure-in-platform\/function-definition\/custom-functions?id=K937y38137c64\" target=\"_blank\">here<\/a>.<\/p>\n\n\n\n<p>Therefore, the provided sample of:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\"dpPower\": 1<\/pre>\n\n\n\n<p>was simply incorrect. The <code>dpPower<\/code> setting needs to have the correct numerical value that points to the power on\/off functionality of the device. The default of 1 was not working, and I now have the challenge of finding the right value.<\/p>\n\n\n\n<p>Through much research on Tuya&#8217;s site and Google, I found out that each device has a signature \/ schema. I found out that I can get the current status by executing the following command line (key and id has been replaced with fake ones):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>% tuya-cli get --ip 192.168.168.8 --key 8ddeadbeef5456ed --id 55deadbeefdeadbeef40 -a --protocol-version 3.3\n{\n  devId: '55deadbeefdeadbeef40',\n  dps: {\n    '20': false,\n    '21': 'white',\n    '22': 1000,\n    '23': 188,\n    '24': '00bc03e803e8',\n    '25': '',\n    '26': 0\n  }\n}<\/code><\/pre>\n\n\n\n<p>I then guessed that the datapoint identifier started with 20 instead of 1. Also based on the value of 1000 for <code>dps '22'<\/code>, I also deduced that I had to change the <code>colorFunction<\/code> from <code>HEXHSB<\/code> to <code>HSB<\/code>, because it was not using HEX to denote ranges. The last hint that I got was from this <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/AMoo-Miki\/homebridge-tuya-lan\/issues\/81#issuecomment-530531566\" target=\"_blank\">comment<\/a> on a forum. Ultimately, consolidating all of the above knowledge, I arrived to the final configuration that looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n    \"name\": \"Smart Bulb 2\",\n    \"type\": \"RGBTWLight\",\n    \"manufacturer\": \"Teckin\",\n    \"model\": \"SB50 Smart Bulb\",\n    \"id\": \"55deadbeefdeadbeef40\",\n    \"key\": \"8ddeadbeef5456ed\",\n\n    \"dpPower\": 20,\n    \"dpMode\": 21,\n    \"dpBrightness\": 22,\n    \"dpColorTemperature\": 23,\n    \"dpColor\": 24,\n    \"minWhiteColor\": 140,\n    \"maxWhiteColor\": 400,\n    \"colorFunction\": \"HSB\",\n\n    \"minBrightness\": 10,\n    \"scaleBrightness\": 1000,\n    \"scaleWhiteColor\": 1000\n}<\/code><\/pre>\n\n\n\n<p>The lights finally worked with Homebridge and therefore also worked with HomeKit. I thought adding these couple of bulbs would be done in a few minutes, but it took a little more effort than I thought.<\/p>\n\n\n\n<p>I couldn&#8217;t be happier that they now work with Siri!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I found a pair of these on Amazon for around $30 CAD (after a $2 coupon saving). They look like fun to install. I figured that now that I know how to installed Tuya devices with the Homebridge, these would be great additions to the common areas of the house, should we need some colour &hellip; <a href=\"https:\/\/blog.lufamily.ca\/kang\/2020\/10\/12\/teckin-smart-led-bulb\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Teckin Smart LED Bulb&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":1145,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[108,111],"tags":[],"class_list":["post-1144","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-electronics-hobby","category-tech"],"jetpack_featured_media_url":"https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2020\/10\/Screen-Shot-2020-10-12-at-2020-10-12-2.00.15-PM.png","jetpack_shortlink":"https:\/\/wp.me\/p7V6i8-is","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/posts\/1144","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/comments?post=1144"}],"version-history":[{"count":10,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/posts\/1144\/revisions"}],"predecessor-version":[{"id":1155,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/posts\/1144\/revisions\/1155"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/media\/1145"}],"wp:attachment":[{"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/media?parent=1144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/categories?post=1144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/tags?post=1144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}