<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>2022/06/29 on Yano&#39;s digital garage</title>
    <link>https://www.bravotouring.com/~yano/archives/2022/06/29/</link>
    <description>Recent content in 2022/06/29 on Yano&#39;s digital garage</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Wed, 29 Jun 2022 23:39:08 +0900</lastBuildDate>
    <atom:link href="https://www.bravotouring.com/~yano/archives/2022/06/29/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>tinytuyaとtuyapi</title>
      <link>https://www.bravotouring.com/~yano/diary/it/20220629_tinytuya.htm</link>
      <pubDate>Wed, 29 Jun 2022 23:39:08 +0900</pubDate>
      <guid>https://www.bravotouring.com/~yano/diary/it/20220629_tinytuya.htm</guid>
      <description>&lt;p&gt;消費電力が確認できる&lt;a href=&#34;https://www.bravotouring.com/~yano/diary/it/20220627_gosund.htm&#34;&gt;Gosundスマートプラグ&lt;/a&gt;の続報。&lt;/p&gt;&#xA;&lt;table align=&#34;right&#34; class=&#34;Panorama&#34;&gt;&#xA;&lt;tr&gt;&#xA;&lt;td&gt;&lt;img alt=&#34;Python API for Tuya WiFi smart devices using a direct local area network (LAN) connection or the cloud (TuyaCloud API).&#34; src=&#34;https://www.bravotouring.com/~yano/images/2022/20220629_tinytuya.jpg&#34;/&gt;&lt;/td&gt;&#xA;&lt;/tr&gt;&#xA;&lt;tr&gt;&#xA;&lt;td class=&#34;PhotoMemo&#34;&gt;&lt;a href=&#34;https://github.com/jasonacox/tinytuya&#34;&gt;jasonacox/tinytuya&lt;/a&gt;より&lt;/td&gt;&#xA;&lt;/tr&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;デバイスID&#39;18261828c4dd57XXXXXX&#39;とローカルキー&#39;7e5f08badbYYYYYY&#39;が取得できたので、クラウドではなくLAN経由に対応している(らしい)&lt;a href=&#34;https://github.com/jasonacox/tinytuya&#34;&gt;tinytuya&lt;/a&gt;にトライ。&lt;/p&gt;&#xA;&lt;p&gt;まずはpython3とtinytuyaをインストールし、&lt;span class=&#34;Software&#34;&gt;&#34;tinytuya scan&#34;&lt;/span&gt;でスマートプラグのIPアドレスを調査。&#xA;&lt;blockquote class=&#34;Log&#34;&gt;&#xA;yano@haswell:~$ sudo apt install python3 python3-pip&lt;br/&gt;&#xA;yano@haswell:~$ python3 -m pip install tinytuya&lt;br/&gt;&#xA;yano@haswell:~$ python3 -m tinytuya scan&lt;br/&gt;&#xA;&lt;br/&gt;&#xA;TinyTuya (Tuya device scanner) [1.7.2]&lt;br/&gt;&#xA;&lt;br/&gt;&#xA;Scanning on UDP ports 6666 and 6667 for devices (15 retries)...&lt;br/&gt;&#xA;&lt;br/&gt;&#xA;Unknown v3.3 Device   Product ID = keyneruwsdethu7u  [Valid payload]:&lt;br/&gt;&#xA;    Address = 172.16.NN.MM,  Device ID = 1826182870039fXXXXXX, Local Key = ,  Version = 3.3, MAC =&lt;br/&gt;&#xA;    No Stats for 172.16.NN.MM: DEVICE KEY required to poll for status&lt;br/&gt;&#xA;Unknown v3.3 Device   Product ID = keyneruwsdethu7u  [Valid payload]:&lt;br/&gt;&#xA;    Address = 172.16.NN.MM,  Device ID = 18261828c4dd57XXXXXX, Local Key = ,  Version = 3.3, MAC =&lt;br/&gt;&#xA;    No Stats for 172.16.NN.MM: DEVICE KEY required to poll for status&lt;br/&gt;&#xA;&lt;br/&gt;&#xA;Scan Complete!  Found 2 devices.&lt;br/&gt;&#xA;&lt;br/&gt;&#xA;&gt;&gt; Saving device snapshot data to snapshot.json&lt;br/&gt;&#xA;&lt;br/&gt;&#xA;yano@haswell:~$&#xA;&lt;/blockquote&gt;&#xA;&lt;span class=&#34;Software&#34;&gt;&#34;tuyapower&#34;&lt;/span&gt;だとこんな感じ。&#xA;&lt;blockquote class=&#34;Log&#34;&gt;&#xA;yano@haswell:~$ python3 -m pip install tuyapower&lt;br/&gt;&#xA;yano@haswell:~$ python3 -m tuyapower&lt;br/&gt;&#xA;TuyaPower (Tuya compatible smart plug scanner) [0.2.0] tinytuya [1.7.2]&lt;br/&gt;&#xA;&lt;br/&gt;&#xA;Scanning on UDP ports 6666 and 6667 for devices (15 retries)...&lt;br/&gt;&#xA;&lt;br/&gt;&#xA;FOUND Device [Valid payload]: 172.16.NN.MM&lt;br/&gt;&#xA;    ID = 1826182870039fXXXXXX, product = keyneruwsdethu7u, Version = 3.3&lt;br/&gt;&#xA;    Device Key required to poll for stats&lt;br/&gt;&#xA;FOUND Device [Valid payload]: 172.16.NN.MM&lt;br/&gt;&#xA;    ID = 18261828c4dd57XXXXXX, product = keyneruwsdethu7u, Version = 3.3&lt;br/&gt;&#xA;    Device Key required to poll for stats&lt;br/&gt;&#xA;&lt;br/&gt;&#xA;Scan Complete!  Found 2 devices.&lt;br/&gt;&#xA;&lt;br/&gt;&#xA;yano@haswell:~$&#xA;&lt;/blockquote&gt;&#xA;プラグが複数ある場合はデバイスIDで識別可能だ。&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
