Smart plug added, but on / off doesn't work

Posted on
Sat Jul 01, 2023 9:36 am
dlleon offline
Posts: 114
Joined: Dec 14, 2012

Smart plug added, but on / off doesn't work

I've added a smart plug. Log will report values but error out on off/on command:

Tuya Error Patio Bug light tuya 'off' command failed
Tuya Device states for Outdoor patio temp
Tuya {'result': [{'code': 'va_temperature', 'value': 307}, {'code': 'va_humidity', 'value': 612}, {'code': 'battery_percentage', 'value': 10}, {'code': 'temp_unit_convert', 'value': 'f'}, {'code': 'maxtemp_set', 'value': 40}, {'code': 'minitemp_set', 'value': 10}, {'code': 'maxhum_set', 'value': 90}, {'code': 'minihum_set', 'value': 30}, {'code': 'temp_alarm', 'value': 'cancel'}, {'code': 'hum_alarm', 'value': 'cancel'}, {'code': 'bright_value', 'value': 233}, {'code': 'temp_sensitivity', 'value': 3}, {'code': 'hum_sensitivity', 'value': 5}, {'code': 'switch', 'value': False}], 'success': True, 't': 1688225702886, 'tid': 'd8b22026182411ee8c70fe98ebe72f12'}
Tuya Device info for Outdoor patio temp
Tuya {'result': {'active_time': 1675277105, 'category': 'wsdcg', 'category_name': 'Temperature and Humidity Sensor', 'create_time': 1653616332, 'gateway_id': '', 'icon': 'smart/icon/ay1522815888395iqsuQ/efec180637780e4c91208680ac12d111.png', 'id': 'ebcae61fd2f80d24adcb8n', 'ip': '104.50.216.93', 'lat': '32.9000', 'local_key': '5d2a5abff56a6555', 'lon': '-96.7800', 'model': 'NEO WIFI HT', 'name': 'Covered patio', 'online': True, 'owner_id': '72813327', 'product_id': '0k8mzr1ajxzvj5ar', 'product_name': 'WIFI HT', 'sub': False, 'time_zone': '-06:00', 'update_time': 1688225622, 'uuid': 'cdf1b10a41e19d24'}, 'success': True, 't': 1688225703035, 'tid': 'd8c23f47182411ee8c70fe98ebe72f12'}
Tuya Device states for Patio Bug light tuya
Tuya {'result': [{'code': 'switch_1', 'value': False}, {'code': 'countdown_1', 'value': 0}, {'code': 'add_ele', 'value': 4}, {'code': 'cur_current', 'value': 0}, {'code': 'cur_power', 'value': 0}, {'code': 'cur_voltage', 'value': 1231}, {'code': 'relay_status', 'value': 'power_on'}, {'code': 'cycle_time', 'value': ''}, {'code': 'random_time', 'value': ''}], 'success': True, 't': 1688225703136, 'tid': 'd8d89084182411ee8c70fe98ebe72f12'}
Tuya Device info for Patio Bug light tuya
Tuya {'result': {'active_time': 1664222446, 'category': 'cz', 'category_name': 'Socket', 'create_time': 1661133103, 'gateway_id': '', 'icon': 'smart/icon/ay15306906879543yc3O/e7a27577e2dbb5eb6ecefa2eaf5f6e25.jpg', 'id': 'ebeb887f16f7c9ecfaj80y', 'ip': '104.50.216.93', 'lat': '32.9000', 'local_key': '32445f8a540c7849', 'lon': '-96.7800', 'model': 'wifi计量插座', 'name': 'Bug light', 'online': True, 'owner_id': '72813327', 'product_id': 'xf5vhc7zctkoe7pv', 'product_name': 'Smart Plug', 'sub': False, 'time_zone': '-05:00', 'update_time': 1687970525, 'uuid': 'dc326e205f461ab1'}, 'success': True, 't': 1688225703285, 'tid': 'd8e8c7f0182411ee804ade073cb82c5d'}

Posted on
Sat Jul 01, 2023 12:56 pm
racarter offline
User avatar
Posts: 479
Joined: Jun 18, 2016
Location: North Yorkshire, UK

Re: Smart plug added, but on / off doesn't work

I assume the plug operates correctly via the Tuya app?

I've just uploaded a new version of the plugin which publishes the Tuya server response in case of command failure. Please install this and let me know the response when the failure occurs.

Posted on
Tue Jul 04, 2023 11:10 pm
dlleon offline
Posts: 114
Joined: Dec 14, 2012

Re: Smart plug added, but on / off doesn't work

Thank you for making this plug in, and thanks for the quick response. Here's the log update for both the temperature issue and the plug issue:

Tuya Starting Tuya monitoring thread
Tuya Device states for Outdoor patio temp
Tuya {'result': [{'code': 'va_temperature', 'value': 304}, {'code': 'va_humidity', 'value': 605}, {'code': 'battery_percentage', 'value': 10}, {'code': 'temp_unit_convert', 'value': 'f'}, {'code': 'maxtemp_set', 'value': 40}, {'code': 'minitemp_set', 'value': 10}, {'code': 'maxhum_set', 'value': 90}, {'code': 'minihum_set', 'value': 30}, {'code': 'temp_alarm', 'value': 'cancel'}, {'code': 'hum_alarm', 'value': 'cancel'}, {'code': 'bright_value', 'value': 1}, {'code': 'temp_sensitivity', 'value': 3}, {'code': 'hum_sensitivity', 'value': 5}, {'code': 'switch', 'value': False}], 'success': True, 't': 1688533750727, 'tid': '13859c1d1af211ee8c70fe98ebe72f12'}
Tuya Error Error in plugin execution runConcurrentThread:

File "plugin.py", line 81, in runConcurrentThread
File "plugin.py", line 155, in getReadings
type: local variable 'batteryState' referenced before assignment

Tuya Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
Tuya Error outoor fence light 'on' command failed
Tuya {'code': 2008, 'msg': 'command or value not support', 'success': False, 't': 1688533760485, 'tid': '1956e83b1af211ee804ade073cb82c5d'}
Tuya Starting Tuya monitoring thread
Tuya Device states for Outdoor patio temp
Tuya {'result': [{'code': 'va_temperature', 'value': 304}, {'code': 'va_humidity', 'value': 605}, {'code': 'battery_percentage', 'value': 10}, {'code': 'temp_unit_convert', 'value': 'f'}, {'code': 'maxtemp_set', 'value': 40}, {'code': 'minitemp_set', 'value': 10}, {'code': 'maxhum_set', 'value': 90}, {'code': 'minihum_set', 'value': 30}, {'code': 'temp_alarm', 'value': 'cancel'}, {'code': 'hum_alarm', 'value': 'cancel'}, {'code': 'bright_value', 'value': 1}, {'code': 'temp_sensitivity', 'value': 3}, {'code': 'hum_sensitivity', 'value': 5}, {'code': 'switch', 'value': False}], 'success': True, 't': 1688533760823, 'tid': '198a58ce1af211ee9fecaa50f188a4b0'}
Tuya Error Error in plugin execution runConcurrentThread:

File "plugin.py", line 81, in runConcurrentThread
File "plugin.py", line 155, in getReadings
type: local variable 'batteryState' referenced before assignment

Tuya Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
Tuya Error outoor fence light 'off' command failed
Tuya {'code': 2008, 'msg': 'command or value not support', 'success': False, 't': 1688533763923, 'tid': '1b6279b71af211ee9fecaa50f188a4b0'}

Posted on
Wed Jul 05, 2023 12:20 am
racarter offline
User avatar
Posts: 479
Joined: Jun 18, 2016
Location: North Yorkshire, UK

Re: Smart plug added, but on / off doesn't work

New release fixes batteryState error and should handle on/off requests for devices with differing command sets, which is the root of your problem. Give it a try and let me know.

Posted on
Fri Jul 07, 2023 11:56 pm
dlleon offline
Posts: 114
Joined: Dec 14, 2012

Re: Smart plug added, but on / off doesn't work

So, it's working, but throwing out errors.


Tuya Starting Tuya monitoring thread
Tuya Device states for Outdoor patio temp
Tuya {'result': [{'code': 'va_temperature', 'value': 298}, {'code': 'va_humidity', 'value': 651}, {'code': 'battery_percentage', 'value': 10}, {'code': 'temp_unit_convert', 'value': 'f'}, {'code': 'maxtemp_set', 'value': 40}, {'code': 'minitemp_set', 'value': 10}, {'code': 'maxhum_set', 'value': 90}, {'code': 'minihum_set', 'value': 30}, {'code': 'temp_alarm', 'value': 'cancel'}, {'code': 'hum_alarm', 'value': 'cancel'}, {'code': 'bright_value', 'value': 41}, {'code': 'temp_sensitivity', 'value': 3}, {'code': 'hum_sensitivity', 'value': 5}, {'code': 'switch', 'value': False}], 'success': True, 't': 1688795768223, 'tid': '221ef1631d5411ee8c70fe98ebe72f12'}
Tuya Device info for Outdoor patio temp
Tuya {'result': {'active_time': 1675277105, 'category': 'wsdcg', 'category_name': 'Temperature and Humidity Sensor', 'create_time': 1653616332, 'gateway_id': '', 'icon': 'smart/icon/ay1522815888395iqsuQ/efec180637780e4c91208680ac12d111.png', 'id': 'ebcae61fd2f80d24adcb8n', 'ip': '104.50.216.93', 'lat': '32.9000', 'local_key': '5d2a5abff56a6555', 'lon': '-96.7800', 'model': 'NEO WIFI HT', 'name': 'Covered patio', 'online': True, 'owner_id': '72813327', 'product_id': '0k8mzr1ajxzvj5ar', 'product_name': 'WIFI HT', 'sub': False, 'time_zone': '-06:00', 'update_time': 1688795358, 'uuid': 'cdf1b10a41e19d24'}, 'success': True, 't': 1688795768363, 'tid': '222c62b41d5411ee804ade073cb82c5d'}
Tuya Device states for outoor fence light
Tuya {'result': [{'code': 'switch_1', 'value': True}], 'success': True, 't': 1688795768462, 'tid': '2241eabd1d5411ee9fecaa50f188a4b0'}
Tuya Error Error in plugin execution runConcurrentThread:

File "plugin.py", line 85, in runConcurrentThread
File "plugin.py", line 193, in getReadings
type: list index out of range

Tuya Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
Tuya Starting Tuya monitoring thread
Tuya Device states for Outdoor patio temp
Tuya {'result': [{'code': 'va_temperature', 'value': 298}, {'code': 'va_humidity', 'value': 651}, {'code': 'battery_percentage', 'value': 10}, {'code': 'temp_unit_convert', 'value': 'f'}, {'code': 'maxtemp_set', 'value': 40}, {'code': 'minitemp_set', 'value': 10}, {'code': 'maxhum_set', 'value': 90}, {'code': 'minihum_set', 'value': 30}, {'code': 'temp_alarm', 'value': 'cancel'}, {'code': 'hum_alarm', 'value': 'cancel'}, {'code': 'bright_value', 'value': 41}, {'code': 'temp_sensitivity', 'value': 3}, {'code': 'hum_sensitivity', 'value': 5}, {'code': 'switch', 'value': False}], 'success': True, 't': 1688795778733, 'tid': '2862fefa1d5411ee804ade073cb82c5d'}
Tuya Device info for Outdoor patio temp
Tuya {'result': {'active_time': 1675277105, 'category': 'wsdcg', 'category_name': 'Temperature and Humidity Sensor', 'create_time': 1653616332, 'gateway_id': '', 'icon': 'smart/icon/ay1522815888395iqsuQ/efec180637780e4c91208680ac12d111.png', 'id': 'ebcae61fd2f80d24adcb8n', 'ip': '104.50.216.93', 'lat': '32.9000', 'local_key': '5d2a5abff56a6555', 'lon': '-96.7800', 'model': 'NEO WIFI HT', 'name': 'Covered patio', 'online': True, 'owner_id': '72813327', 'product_id': '0k8mzr1ajxzvj5ar', 'product_name': 'WIFI HT', 'sub': False, 'time_zone': '-06:00', 'update_time': 1688795358, 'uuid': 'cdf1b10a41e19d24'}, 'success': True, 't': 1688795778893, 'tid': '2870404a1d5411ee9fecaa50f188a4b0'}
Tuya Device states for outoor fence light
Tuya {'result': [{'code': 'switch_1', 'value': False}], 'success': True, 't': 1688795779057, 'tid': '2888bdb11d5411ee8c70fe98ebe72f12'}
Tuya Error Error in plugin execution runConcurrentThread:

File "plugin.py", line 85, in runConcurrentThread
File "plugin.py", line 193, in getReadings
type: list index out of range

Tuya Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)

Posted on
Sat Jul 08, 2023 4:11 am
racarter offline
User avatar
Posts: 479
Joined: Jun 18, 2016
Location: North Yorkshire, UK

Re: Smart plug added, but on / off doesn't work

Your plugs aren't reporting energy usage - either all of the time or some of the time. Plugin was expecting more data that it was getting.

New version in plugin store should fix.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests