YANO's digital garage

Copyright ©YANO All rights reserved. https://www.bravotouring.com/~yano/

Last-modified: 2024-07-25 (木)


[一語一絵/IT系]

Tuya Cloud expired / 2024-05-13 (月)

消費電力が確認できるGosundスマートプラグtinytuyaを使ってモニタリングをしていたのだが、気がついたら消費電力が採れなくなっていた。

調べてみるとtinytuya.OutletDeviceで

{'Error': 'Unexpected Payload from Device', 'Err': '904', 'Payload': None}
というエラーになっている状況はわかったものの、原因はピンとこない。

試しにtinytuya wizardしたところ、

yano@haswell:~$ python3 -m tinytuya wizard
TinyTuya Setup Wizard [1.13.2]

    Existing settings:
        API Key=acvwux..........p55y
        Secret=3b81eb715...................3819
        DeviceID=1826...........b47b
        Region=us

    Use existing credentials (Y/n):

~~

Error from Tuya server: Error from Tuya Cloud: Code 28841002: 'No permissions. Your subscription to cloud development plan has expired.'
Check DeviceID and Region
yano@haswell:~$
となった。

[External]Tuya Cloudを使っているつもりは無いんだけどなー、とは思ったが、ここで駄々をこねても仕方がないので[External]Smart Life[External]Tuya Cloudのアカウントを作り直し、Tuya Cloud 操作をやり直してLocalKeyを更新する事で、無事にtinytuya.OutletDeviceからも

{'devId': '1826...........b47b', 'dps': {'1': True, '9': 0, '18': 81, '19': 40, '20': 1008, '21': 1, '22': 735, '23': 31250, '24': 21478, '25': 970}}
という応答が返ってくるようになり、やれやれ。

ちなみに[External]Smart Lifeのアカウント再設定では、スマートプラグをペアリングモードにしてデバイスを追加する必要があるのだが、WP6はBlueTooth機能がないらしくAPモードにして手動でWP6側のWiFiに接続する必要があり、微妙に苦労した。しかも、よく考えると[External]Tuya Cloudの新しいアカウントにリンクし直すだけで、[External]Smart Lifeの方はそのままで良かった気がする。

【参照】
●ファームロジックス https://flogics.com/
スマートテーブルタップを Python から制御する 2022年2月2日
スマートプラグの電力データをPythonで読みだそう(予算1,500円) 2023年7月24日
●Qiita https://qiita.com/
新版・中華製スマートプラグを node で制御する 2020年5月14日
pythonでsmartlife電源を操作 (脱IFTTT) 2021年8月8日
中華製スマートプラグ をAPIで操作する。(tuya-cli利用の代替案) 2021年1月23日
●Tuya Smart Developer Center https://iot.tuya.com/
●GitHub https://github.com/
codetheweb/tuyapi: 🌧 An easy-to-use API for devices that use Tuya's cloud services.
jasonacox/tinytuya: Python API for Tuya WiFi smart devices using a direct local area network (LAN) connection or the cloud (TuyaCloud API).
●Google Play のアプリ https://play.google.com/store/apps/
Go Smart
Tuya Smart
Smart Life
●Wikipedia https://en.wikipedia.org/wiki/
Tuya Inc.