smarthomej / addons

SmartHome/J addons for openHAB
Eclipse Public License 2.0
59 stars 23 forks source link

[Tuya] Exception handling for devices not adhering to standard #393

Closed kgoderis closed 1 year ago

kgoderis commented 1 year ago

I have a DUUX mobile airco that reports the following specifications:

{
  "result": {
    "category": "kt",
    "functions": [
      {
        "code": "windspeed",
        "type": "Enum",
        "values": "{\"range\":[\"1\",\"2\",\"3\" ]}"
      },
      {
        "code": "humidity_set",
        "type": "Integer",
        "values": "{\"min\":0,\"unit\":\"%\",\"scale\":0,\"max\":100,\"type\":\"value\",\"step\":1}"
      },
      {
        "code": "temp_set",
        "type": "Integer",
        "values": "{\"min\":16,\"unit\":\"℃\",\"scale\":0,\"max\":31,\"type\":\"value\",\"step\":1}"
      },
      {
        "code": "switch",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "mode",
        "type": "Enum",
        "values": "{\"range\":[\"auto\",\"cold\",\"hot\",\"wet\",\"wind\",\"eco\"]}"
      },
      {
        "code": "c_f",
        "type": "Enum",
        "values": "{\"range\":[\"C\",\"F\"]}"
      },
      {
        "code": "temp_set_f",
        "type": "Integer",
        "values": "{\"unit\":\"℉\",\"min\":62,\"max\":90,\"scale\":0,\"step\":1}"
      }
    ],
    "status": [
      {
        "code": "humidity_current",
        "type": "Integer",
        "values": "{\"min\":0,\"scale\":0,\"unit\":\"%\",\"max\":100,\"step\":1}"
      },
      {
        "code": "windspeed",
        "type": "Enum",
        "values": "{\"range\":[\"1\",\"2\",\"3\" ]}"
      },
      {
        "code": "humidity_set",
        "type": "Integer",
        "values": "{\"min\":0,\"unit\":\"%\",\"scale\":0,\"max\":100,\"type\":\"value\",\"step\":1}"
      },
      {
        "code": "temp_current",
        "type": "Integer",
        "values": "{\"min\":-20,\"scale\":0,\"unit\":\"℃\",\"max\":100,\"step\":1}"
      },
      {
        "code": "temp_set",
        "type": "Integer",
        "values": "{\"min\":16,\"unit\":\"℃\",\"scale\":0,\"max\":31,\"type\":\"value\",\"step\":1}"
      },
      {
        "code": "switch",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "mode",
        "type": "Enum",
        "values": "{\"range\":[\"auto\",\"cold\",\"hot\",\"wet\",\"wind\",\"eco\"]}"
      },
      {
        "code": "temp_current_f",
        "type": "Integer",
        "values": "{\"unit\":\"℉\",\"min\":32,\"max\":99,\"scale\":0,\"step\":1}"
      },
      {
        "code": "c_f",
        "type": "Enum",
        "values": "{\"range\":[\"C\",\"F\"]}"
      },
      {
        "code": "temp_set_f",
        "type": "Integer",
        "values": "{\"unit\":\"℉\",\"min\":62,\"max\":90,\"scale\":0,\"step\":1}"
      },
      {
        "code": "temp_current_f",
        "type": "Integer",
        "values": "{\"unit\":\"℉\",\"min\":32,\"max\":99,\"scale\":0,\"step\":1}"
      }
    ]
  },
  "success": true,
  "t": 1659960782894,
  "tid": "737f0eef171311ed9aca628099f16ede"
}

The device reports a status message like

15:14:17.958 [DEBUG] [.internal.local.handlers.TuyaDecoder] - 004625208cce4ee0b07c//192.168.0.148:6668: Received MessageWrapper{commandType=DP_QUERY, content='{1=true, 2=16.0, 3=21.0, 17=32.0, 20=0.0, 101=1, 103=false, 104=1, 105=1.0, 106=false, 109=false, 112=32.0}'}

which yields

15:14:17.959 [DEBUG] [a.internal.handler.TuyaDeviceHandler] - Could not find channel for dp '3' in thing 'tuya:tuyaDevice:004625208cce4ee0b07c'
15:14:17.960 [DEBUG] [a.internal.handler.TuyaDeviceHandler] - Could not find channel for dp '17' in thing 'tuya:tuyaDevice:004625208cce4ee0b07c'
15:14:17.960 [DEBUG] [a.internal.handler.TuyaDeviceHandler] - Could not find channel for dp '20' in thing 'tuya:tuyaDevice:004625208cce4ee0b07c'
15:14:17.960 [DEBUG] [a.internal.handler.TuyaDeviceHandler] - Could not find channel for dp '103' in thing 'tuya:tuyaDevice:004625208cce4ee0b07c'
15:14:17.960 [DEBUG] [a.internal.handler.TuyaDeviceHandler] - Could not find channel for dp '104' in thing 'tuya:tuyaDevice:004625208cce4ee0b07c'
15:14:17.960 [DEBUG] [a.internal.handler.TuyaDeviceHandler] - Could not find channel for dp '105' in thing 'tuya:tuyaDevice:004625208cce4ee0b07c'
15:14:17.960 [DEBUG] [a.internal.handler.TuyaDeviceHandler] - Could not find channel for dp '106' in thing 'tuya:tuyaDevice:004625208cce4ee0b07c'

also, it seems dp 109 corresponds to the "c_f" enum in the specs. The binding defines a "String" channel for type "enum". the value returned by gson after converting the status message is a Boolean, consequently causing

15:14:17.960 [WARN ] [rnal.local.handlers.UserEventHandler] - 004625208cce4ee0b07c/192.168.0.148:6668: class java.lang.ClassCastException caught, closing the channel
java.lang.ClassCastException: class java.lang.Boolean cannot be cast to class java.lang.String (java.lang.Boolean and java.lang.String are in module java.base of loader 'bootstrap')

IMO a check could be made to see if a status value falls within the provided possible "values" of that function, before it is further converted and pushed down the path?

kgoderis commented 1 year ago

@J-N-K Ok, AFAI can see, it seems that channels are only created for reported functions, and not status fields, and so, only those dp's common in functions and status are working. This might explain the "could not find channel" errors. The DiscoveryService is only storing the functions, and not the status set in the storage service

J-N-K commented 1 year ago

The "Could not find channel" messages can be ignored. There are a lot of undocumented dps reported by a lot of devices, which currently does not hurt. That's why they are DEBUG level messages.

Judging from the dp-spec you send by mail dp 109 is indeed an enum (this is also in the spec above). So it seems that the device is reporting something different than it should be and I doubt we can fix that in the binding.

I agree that this needs to be handled better by the code. I'll check that. Thanks for reporting.

kgoderis commented 1 year ago

Mmmh... it is not that these are undocumented, they seem to be status fields which are ignored all together, and some of them do contain very relevant information IMHO.

Can the error be (quick) fixed by catching the exception and then log an error pls?

On 8 Aug 2022, at 16:42, J-N-K @.***> wrote:

The "Could not find channel" messages can be ignored. There are a lot of undocumented dps reported by a lot of devices, which currently does not hurt. That's why they are DEBUG level messages.

Judging from the dp-spec you send by mail dp 109 is indeed an enum (this is also in the spec above). So it seems that the device is reporting something different than it should be and I doubt we can fix that in the binding.

I agree that this needs to be handled better by the code. I'll check that. Thanks for reporting.

— Reply to this email directly, view it on GitHub https://github.com/smarthomej/addons/issues/393#issuecomment-1208221509, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJUY5QRCNF4JCCLP5HKR43VYEMFDANCNFSM555EERVA. You are receiving this because you authored the thread.

J-N-K commented 1 year ago

Hi Karel,

Can you confirm the status messages are now working?

Am 08.08.2022 um 17:33 schrieb Karel Goderis @.***>:

Mmmh... it is not that these are undocumented, they seem to be status fields which are ignored all together, and some of them do contain very relevant information IMHO.

Can the error be (quick) fixed by catching the exception and then log an error pls?

On 8 Aug 2022, at 16:42, J-N-K @.***> wrote:

The "Could not find channel" messages can be ignored. There are a lot of undocumented dps reported by a lot of devices, which currently does not hurt. That's why they are DEBUG level messages.

Judging from the dp-spec you send by mail dp 109 is indeed an enum (this is also in the spec above). So it seems that the device is reporting something different than it should be and I doubt we can fix that in the binding.

I agree that this needs to be handled better by the code. I'll check that. Thanks for reporting.

— Reply to this email directly, view it on GitHub https://github.com/smarthomej/addons/issues/393#issuecomment-1208221509, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJUY5QRCNF4JCCLP5HKR43VYEMFDANCNFSM555EERVA. You are receiving this because you authored the thread.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.

J-N-K commented 1 year ago

I believe all has been done here.

kgoderis commented 1 year ago

@J-N-K I thing we have to re-open this one I am afraid.

I got this today after an upgrade of OH:

tuya:tuyaDevice:004625208cce4ee0b07c (Type=Thing, Status=UNINITIALIZED (HANDLER_INITIALIZING_ERROR): Duplicate key windspeed (attempted merging values org.smarthomej.binding.tuya.internal.util.SchemaDp@39e16843 and org.smarthomej.binding.tuya.internal.util.SchemaDp@49f15c33), Label=Generic Tuya Device, Bridge=null)

which I relate back to a schema in the jsondb

  "004625208cce4ee0b07c": {
    "class": "java.lang.String",
    "value": "[{\"id\":0,\"code\":\"windspeed\",\"type\":\"enum\",\"range\":[\"1\",\"2\",\"3\"]},{\"id\":0,\"code\":\"humidity_set\",\"type\":\"value\",\"min\":0.0,\"max\":100.0},{\"id\":2,\"code\":\"temp_set\",\"type\":\"value\",\"min\":16.0,\"max\":31.0},{\"id\":1,\"code\":\"switch\",\"type\":\"bool\"},{\"id\":101,\"code\":\"mode\",\"type\":\"enum\",\"range\":[\"auto\",\"cold\",\"hot\",\"wet\",\"wind\",\"eco\"]},{\"id\":109,\"code\":\"c_f\",\"type\":\"enum\",\"range\":[\"C\",\"F\"]},{\"id\":110,\"code\":\"temp_set_f\",\"type\":\"value\",\"min\":62.0,\"max\":90.0},{\"id\":112,\"code\":\"humidity_current\",\"type\":\"value\",\"min\":0.0,\"max\":100.0},{\"id\":104,\"code\":\"windspeed\",\"type\":\"enum\",\"range\":[\"1\",\"2\",\"3\"]},{\"id\":17,\"code\":\"humidity_set\",\"type\":\"value\",\"min\":0.0,\"max\":100.0},{\"id\":3,\"code\":\"temp_current\",\"type\":\"value\",\"min\":-20.0,\"max\":100.0},{\"id\":111,\"code\":\"temp_current_f\",\"type\":\"value\",\"min\":32.0,\"max\":99.0},{\"id\":111,\"code\":\"temp_current_f\",\"type\":\"value\",\"min\":32.0,\"max\":99.0}]"
  },

It seems that somewhere in the binding you are using the "code" field as a key, instead of the id ? Also, do you notice that there is twice code 111 in the json? Then again, there is also twice code 0, but these fields seem to be different all together

J-N-K commented 1 year ago

Can you please set the binding to TRACE logging and re-discover the device (probably you need to delete it before). You should see the response from a call to "/v1.1/devices/" + deviceId + "/specifications". Can you send that one to me? Thanks.

kgoderis commented 1 year ago

@J-N-K

This is the error itself

2022-08-27 10:06:59.441 [ERROR] [hab.core.internal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.smarthomej.binding.tuya.internal.handler.TuyaDeviceHandler@2e7a6a1b': Duplicate key windspeed (attempted merging values org.smarthomej.binding.tuya.internal.util.SchemaDp@219b9bba and org.smarthomej.binding.tuya.internal.util.SchemaDp@649911ed)
java.lang.IllegalStateException: Duplicate key windspeed (attempted merging values org.smarthomej.binding.tuya.internal.util.SchemaDp@219b9bba and org.smarthomej.binding.tuya.internal.util.SchemaDp@649911ed)
    at java.util.stream.Collectors.duplicateKeyException(Collectors.java:133) ~[?:?]
    at java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:180) ~[?:?]
    at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) ~[?:?]
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655) ~[?:?]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?]
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[?:?]
    at org.smarthomej.binding.tuya.internal.handler.TuyaDeviceHandler.initialize(TuyaDeviceHandler.java:301) ~[?:?]
    at jdk.internal.reflect.GeneratedMethodAccessor116.invoke(Unknown Source) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
    at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
    at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
    at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
    at java.lang.Thread.run(Thread.java:834) [?:?]
2022-08-27 10:06:59.444 [ERROR] [org.openhab.core.thing.internal.ThingManagerImpl  ] - Exception occurred while initializing handler of thing 'tuya:tuyaDevice:004625208cce4ee0b07c': Duplicate key windspeed (attempted merging values org.smarthomej.binding.tuya.internal.util.SchemaDp@219b9bba and org.smarthomej.binding.tuya.internal.util.SchemaDp@649911ed)
java.lang.IllegalStateException: Duplicate key windspeed (attempted merging values org.smarthomej.binding.tuya.internal.util.SchemaDp@219b9bba and org.smarthomej.binding.tuya.internal.util.SchemaDp@649911ed)
    at java.util.stream.Collectors.duplicateKeyException(Collectors.java:133) ~[?:?]
    at java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:180) ~[?:?]
    at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) ~[?:?]
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655) ~[?:?]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?]
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[?:?]
    at org.smarthomej.binding.tuya.internal.handler.TuyaDeviceHandler.initialize(TuyaDeviceHandler.java:301) ~[?:?]
    at jdk.internal.reflect.GeneratedMethodAccessor116.invoke(Unknown Source) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
    at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
    at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
    at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
    at java.lang.Thread.run(Thread.java:834) [?:?]

and here is a trace after initiating a discovery from the OH console

2022-08-27 10:06:08.436 [TRACE] [smarthomej.binding.tuya.internal.cloud.TuyaOpenAPI] - Sending to 'https://openapi.tuyaeu.com/v1.0/users/eu1659957434287ip4mX/devices?from=&page_no=1&page_size=100': Method = {GET}, Headers = {Accept-Encoding: gzip, User-Agent: Jetty/9.4.46.v20220331, client_id: ********************, t: 1661587568435, Signature-Headers: client_id, sign_method: HMAC-SHA256, access_token: ********************************, sign: 8FF2ACF6DC87E52C866B6923BA8C02B1E215DF26C6E2C3B7FB6E2D2D58EF69B7}, Content = {null}
2022-08-27 10:06:08.544 [TRACE] [ej.binding.tuya.internal.cloud.TuyaContentListener] - Received from 'https://openapi.tuyaeu.com/v1.0/users/eu1659957434287ip4mX/devices?from=&page_no=1&page_size=100': Code = {200}, Headers = {Content-Type: application/json;charset=UTF-8, Transfer-Encoding: chunked, Connection: keep-alive, Server: Tuya-Sec, Date: Sat, 27 Aug 2022 08:06:08 GMT, Vary: Accept-Encoding, Access-Control-Allow-Credentials: true, Access-Control-Allow-Headers: , Access-Control-Allow-Headers: access_token,Content-Type, Access-Control-Allow-Methods: POST, Access-Control-Allow-Methods: OPTIONS, Access-Control-Allow-Methods: GET, Access-Control-Allow-Methods: DELETE, Access-Control-Allow-Methods: PUT, Access-Control-Allow-Origin: https://iot.tuya.com, Gateway-Info: highway, Content-Encoding: gzip, Strict-Transport-Security: max-age=31536000}, Content = {{"result":[{"active_time":1661508873,"biz_type":18,"category":"fs","create_time":1661281159,"icon":"smart/icon/001441070657466AAETE/a3de89a299843127e4d716cd35e5fd4e.png","id":"bf61ce1ab1ab9ea33bbpkt","ip":"94.224.141.100","lat":"50.8468","local_key":"13cb0b7510197725","lon":"4.2713","model":"DXCF14/15","name":"Whisper Flex Ultimate - Leontine","online":true,"owner_id":"63071847","product_id":"cjsa4k7tqbpuyq3l","product_name":"Whisper Flex Ultimate","status":[{"code":"switch","value":false},{"code":"fan_speed_percent","value":30},{"code":"temp","value":17}],"sub":false,"time_zone":"+02:00","uid":"eu1659957434287ip4mX","update_time":1661508875,"uuid":"c2eabc94948ae747"},{"active_time":1659957537,"biz_type":18,"category":"kt","create_time":1659951967,"icon":"smart/icon/ay1536760473930cDk1Q/6181e45dd89b8fe3c3feb38e8e9dee69.png","id":"004625208cce4ee0b07c","ip":"94.224.141.100","lat":"50.8468","local_key":"6fbc2e44ca1a0f7c","lon":"4.2713","model":"DXMA10/11/12/13","name":"North 1","online":true,"owner_id":"63071847","product_id":"uym25ctpiq6rjtmv","product_name":"","status":[{"code":"switch","value":false},{"code":"temp_set","value":16},{"code":"temp_current","value":23},{"code":"humidity_set","value":32},{"code":"mode","value":"cold"},{"code":"windspeed","value":"1"},{"code":"c_f","value":"C"},{"code":"temp_set_f","value":62},{"code":"temp_current_f","value":32},{"code":"humidity_current","value":32}],"sub":false,"time_zone":"+01:00","uid":"eu1659957434287ip4mX","update_time":1661508859,"uuid":"004625208cce4ee0b07c"},{"active_time":1661282053,"biz_type":18,"category":"fs","create_time":1661282053,"icon":"smart/icon/001441070657466AAETE/a3de89a299843127e4d716cd35e5fd4e.png","id":"bffdf3209d379d2fc7nknm","ip":"94.224.141.100","lat":"50.8468","local_key":"8bc062afc2414523","lon":"4.2713","model":"DXCF14/15","name":"Whisper Flex Ultimate - Master","online":true,"owner_id":"63071847","product_id":"cjsa4k7tqbpuyq3l","product_name":"Whisper Flex Ultimate","status":[{"code":"switch","value":false},{"code":"fan_speed_percent","value":2},{"code":"temp","value":17}],"sub":false,"time_zone":"+02:00","uid":"eu1659957434287ip4mX","update_time":1661508859,"uuid":"6246a44dbf97654b"},{"active_time":1661279936,"biz_type":18,"category":"fs","create_time":1661279936,"icon":"smart/icon/001441070657466AAETE/a3de89a299843127e4d716cd35e5fd4e.png","id":"bfb5d7cf6a3156ad2fugbf","ip":"94.224.141.100","lat":"50.8468","local_key":"1a6564ebfa4782b7","lon":"4.2713","model":"DXCF14/15","name":"Whisper Flex Ultimate - Georges ","online":true,"owner_id":"63071847","product_id":"cjsa4k7tqbpuyq3l","product_name":"Whisper Flex Ultimate","status":[{"code":"switch","value":true},{"code":"fan_speed_percent","value":13},{"code":"temp","value":17}],"sub":false,"time_zone":"+02:00","uid":"eu1659957434287ip4mX","update_time":1661508857,"uuid":"b7fad909f98ad7d3"},{"active_time":1661275667,"biz_type":18,"category":"fs","create_time":1661275667,"icon":"smart/icon/001441070657466AAETE/a3de89a299843127e4d716cd35e5fd4e.png","id":"bfce69db8935ad00425bjo","ip":"94.224.141.100","lat":"50.8468","local_key":"b78affa2445fad61","lon":"4.2713","model":"DXCF14/15","name":"Whisper Flex Ultimate - Alexander","online":true,"owner_id":"63071847","product_id":"cjsa4k7tqbpuyq3l","product_name":"Whisper Flex Ultimate","status":[{"code":"switch","value":true},{"code":"fan_speed_percent","value":30},{"code":"temp","value":17}],"sub":false,"time_zone":"+02:00","uid":"eu1659957434287ip4mX","update_time":1661508855,"uuid":"db128b88765f9948"}],"success":true,"t":1661587568531,"tid":"1b50b52025df11ed86c3bed3cc205f4d"}}
2022-08-27 10:06:08.545 [TRACE] [smarthomej.binding.tuya.internal.cloud.TuyaOpenAPI] - Sending to 'https://openapi.tuyaeu.com/v1.0/iot-03/devices/factory-infos?device_ids=bf61ce1ab1ab9ea33bbpkt': Method = {GET}, Headers = {Accept-Encoding: gzip, User-Agent: Jetty/9.4.46.v20220331, client_id: ********************, t: 1661587568545, Signature-Headers: client_id, sign_method: HMAC-SHA256, access_token: ********************************, sign: E90F3B5A47F634688C7E6B6A845BC09176E1269B9F07101B2DA413A548502112}, Content = {null}
2022-08-27 10:06:08.545 [TRACE] [smarthomej.binding.tuya.internal.cloud.TuyaOpenAPI] - Sending to 'https://openapi.tuyaeu.com/v1.0/iot-03/devices/factory-infos?device_ids=004625208cce4ee0b07c': Method = {GET}, Headers = {Accept-Encoding: gzip, User-Agent: Jetty/9.4.46.v20220331, client_id: ********************, t: 1661587568545, Signature-Headers: client_id, sign_method: HMAC-SHA256, access_token: ********************************, sign: 31C5200AF3288523F5582AFE9FA5BF62742EBE16ACD59EA34C76B3186031D806}, Content = {null}
2022-08-27 10:06:08.546 [TRACE] [smarthomej.binding.tuya.internal.cloud.TuyaOpenAPI] - Sending to 'https://openapi.tuyaeu.com/v1.0/iot-03/devices/factory-infos?device_ids=bffdf3209d379d2fc7nknm': Method = {GET}, Headers = {Accept-Encoding: gzip, User-Agent: Jetty/9.4.46.v20220331, client_id: ********************, t: 1661587568546, Signature-Headers: client_id, sign_method: HMAC-SHA256, access_token: ********************************, sign: 0FA54FE57586604563C613E1E7FBDD9F95CBC30F68903B8250CDAA323B62829F}, Content = {null}
2022-08-27 10:06:08.546 [TRACE] [smarthomej.binding.tuya.internal.cloud.TuyaOpenAPI] - Sending to 'https://openapi.tuyaeu.com/v1.0/iot-03/devices/factory-infos?device_ids=bfb5d7cf6a3156ad2fugbf': Method = {GET}, Headers = {Accept-Encoding: gzip, User-Agent: Jetty/9.4.46.v20220331, client_id: ********************, t: 1661587568546, Signature-Headers: client_id, sign_method: HMAC-SHA256, access_token: ********************************, sign: CF7756BD2F06F4526F20D0573E8DFE369B608070623695B6A5790F96EA059334}, Content = {null}
2022-08-27 10:06:08.547 [TRACE] [smarthomej.binding.tuya.internal.cloud.TuyaOpenAPI] - Sending to 'https://openapi.tuyaeu.com/v1.0/iot-03/devices/factory-infos?device_ids=bfce69db8935ad00425bjo': Method = {GET}, Headers = {Accept-Encoding: gzip, User-Agent: Jetty/9.4.46.v20220331, client_id: ********************, t: 1661587568547, Signature-Headers: client_id, sign_method: HMAC-SHA256, access_token: ********************************, sign: 8DD9C9906437445D105212C997A3AC6B47F2C883EA68C7AFAC5E1B95EA90A645}, Content = {null}
2022-08-27 10:06:08.599 [TRACE] [ej.binding.tuya.internal.cloud.TuyaContentListener] - Received from 'https://openapi.tuyaeu.com/v1.0/iot-03/devices/factory-infos?device_ids=bf61ce1ab1ab9ea33bbpkt': Code = {200}, Headers = {Content-Type: application/json;charset=UTF-8, Content-Length: 187, Connection: keep-alive, Server: Tuya-Sec, Date: Sat, 27 Aug 2022 08:06:08 GMT, Access-Control-Allow-Credentials: true, Access-Control-Allow-Headers: , Access-Control-Allow-Headers: access_token,Content-Type, Access-Control-Allow-Methods: POST, Access-Control-Allow-Methods: OPTIONS, Access-Control-Allow-Methods: GET, Access-Control-Allow-Methods: DELETE, Access-Control-Allow-Methods: PUT, Access-Control-Allow-Origin: https://iot.tuya.com, Gateway-Info: highway, Strict-Transport-Security: max-age=31536000}, Content = {{"result":[{"id":"bf61ce1ab1ab9ea33bbpkt","mac":"10d5617e5f2a","sn":"10002993200EBD","uuid":"c2eabc94948ae747"}],"success":true,"t":1661587568589,"tid":"1b61742025df11eda34c0af93703ddff"}}
2022-08-27 10:06:08.600 [TRACE] [smarthomej.binding.tuya.internal.cloud.TuyaOpenAPI] - Sending to 'https://openapi.tuyaeu.com/v1.1/devices/bf61ce1ab1ab9ea33bbpkt/specifications': Method = {GET}, Headers = {Accept-Encoding: gzip, User-Agent: Jetty/9.4.46.v20220331, client_id: ********************, t: 1661587568600, Signature-Headers: client_id, sign_method: HMAC-SHA256, access_token: ********************************, sign: 1B6318CC659B12A831DD0CD3D90FB1BE5B9FDE4F5E731DE04C753E50CE963827}, Content = {null}
2022-08-27 10:06:08.605 [TRACE] [ej.binding.tuya.internal.cloud.TuyaContentListener] - Received from 'https://openapi.tuyaeu.com/v1.0/iot-03/devices/factory-infos?device_ids=004625208cce4ee0b07c': Code = {200}, Headers = {Content-Type: application/json;charset=UTF-8, Content-Length: 189, Connection: keep-alive, Server: Tuya-Sec, Date: Sat, 27 Aug 2022 08:06:08 GMT, Access-Control-Allow-Credentials: true, Access-Control-Allow-Headers: , Access-Control-Allow-Headers: access_token,Content-Type, Access-Control-Allow-Methods: POST, Access-Control-Allow-Methods: OPTIONS, Access-Control-Allow-Methods: GET, Access-Control-Allow-Methods: DELETE, Access-Control-Allow-Methods: PUT, Access-Control-Allow-Origin: https://iot.tuya.com, Gateway-Info: highway, Strict-Transport-Security: max-age=31536000}, Content = {{"result":[{"id":"004625208cce4ee0b07c","mac":"8cce4ee0b07c","sn":"100024669009F2","uuid":"004625208cce4ee0b07c"}],"success":true,"t":1661587568595,"tid":"1b622e8a25df11ed86c3bed3cc205f4d"}}
2022-08-27 10:06:08.606 [TRACE] [smarthomej.binding.tuya.internal.cloud.TuyaOpenAPI] - Sending to 'https://openapi.tuyaeu.com/v1.1/devices/004625208cce4ee0b07c/specifications': Method = {GET}, Headers = {Accept-Encoding: gzip, User-Agent: Jetty/9.4.46.v20220331, client_id: ********************, t: 1661587568606, Signature-Headers: client_id, sign_method: HMAC-SHA256, access_token: ********************************, sign: 4E084C2E4D9D4BEBDE4C746852C20D1795AF444EBCD70F22BC742C21B5D2AF70}, Content = {null}
2022-08-27 10:06:08.652 [TRACE] [ej.binding.tuya.internal.cloud.TuyaContentListener] - Received from 'https://openapi.tuyaeu.com/v1.0/iot-03/devices/factory-infos?device_ids=bffdf3209d379d2fc7nknm': Code = {200}, Headers = {Content-Type: application/json;charset=UTF-8, Content-Length: 187, Connection: keep-alive, Server: Tuya-Sec, Date: Sat, 27 Aug 2022 08:06:08 GMT, Access-Control-Allow-Credentials: true, Access-Control-Allow-Headers: , Access-Control-Allow-Headers: access_token,Content-Type, Access-Control-Allow-Methods: POST, Access-Control-Allow-Methods: OPTIONS, Access-Control-Allow-Methods: GET, Access-Control-Allow-Methods: DELETE, Access-Control-Allow-Methods: PUT, Access-Control-Allow-Origin: https://iot.tuya.com, Gateway-Info: highway, Strict-Transport-Security: max-age=31536000}, Content = {{"result":[{"id":"bffdf3209d379d2fc7nknm","mac":"10d5617e5cf4","sn":"10002993200E2A","uuid":"6246a44dbf97654b"}],"success":true,"t":1661587568642,"tid":"1b69a20725df11ed806ab61200188eab"}}
2022-08-27 10:06:08.652 [TRACE] [ej.binding.tuya.internal.cloud.TuyaContentListener] - Received from 'https://openapi.tuyaeu.com/v1.0/iot-03/devices/factory-infos?device_ids=bfb5d7cf6a3156ad2fugbf': Code = {200}, Headers = {Content-Type: application/json;charset=UTF-8, Content-Length: 187, Connection: keep-alive, Server: Tuya-Sec, Date: Sat, 27 Aug 2022 08:06:08 GMT, Access-Control-Allow-Credentials: true, Access-Control-Allow-Headers: , Access-Control-Allow-Headers: access_token,Content-Type, Access-Control-Allow-Methods: POST, Access-Control-Allow-Methods: OPTIONS, Access-Control-Allow-Methods: GET, Access-Control-Allow-Methods: DELETE, Access-Control-Allow-Methods: PUT, Access-Control-Allow-Origin: https://iot.tuya.com, Gateway-Info: highway, Strict-Transport-Security: max-age=31536000}, Content = {{"result":[{"id":"bfb5d7cf6a3156ad2fugbf","mac":"10d5617e6361","sn":"100029932016C1","uuid":"b7fad909f98ad7d3"}],"success":true,"t":1661587568642,"tid":"1b6a34fc25df11eda34c0af93703ddff"}}
2022-08-27 10:06:08.653 [TRACE] [smarthomej.binding.tuya.internal.cloud.TuyaOpenAPI] - Sending to 'https://openapi.tuyaeu.com/v1.1/devices/bffdf3209d379d2fc7nknm/specifications': Method = {GET}, Headers = {Accept-Encoding: gzip, User-Agent: Jetty/9.4.46.v20220331, client_id: ********************, t: 1661587568652, Signature-Headers: client_id, sign_method: HMAC-SHA256, access_token: ********************************, sign: A1AFC13C00B43E6A9B7F4A8D4B6459C9A0B0E9D4DBFEDAD47064BFB4907DFD98}, Content = {null}
2022-08-27 10:06:08.653 [TRACE] [smarthomej.binding.tuya.internal.cloud.TuyaOpenAPI] - Sending to 'https://openapi.tuyaeu.com/v1.1/devices/bfb5d7cf6a3156ad2fugbf/specifications': Method = {GET}, Headers = {Accept-Encoding: gzip, User-Agent: Jetty/9.4.46.v20220331, client_id: ********************, t: 1661587568653, Signature-Headers: client_id, sign_method: HMAC-SHA256, access_token: ********************************, sign: 2071303C1877BB229E98A11937D731E5A2C3B17C4DBC71827C490BBD3D62F9DB}, Content = {null}
2022-08-27 10:06:08.692 [TRACE] [ej.binding.tuya.internal.cloud.TuyaContentListener] - Received from 'https://openapi.tuyaeu.com/v1.1/devices/bf61ce1ab1ab9ea33bbpkt/specifications': Code = {200}, Headers = {Content-Type: application/json;charset=UTF-8, Transfer-Encoding: chunked, Connection: keep-alive, Server: Tuya-Sec, Date: Sat, 27 Aug 2022 08:06:08 GMT, Vary: Accept-Encoding, Access-Control-Allow-Credentials: true, Access-Control-Allow-Headers: , Access-Control-Allow-Headers: access_token,Content-Type, Access-Control-Allow-Methods: POST, Access-Control-Allow-Methods: OPTIONS, Access-Control-Allow-Methods: GET, Access-Control-Allow-Methods: DELETE, Access-Control-Allow-Methods: PUT, Access-Control-Allow-Origin: https://iot.tuya.com, Gateway-Info: highway, Content-Encoding: gzip, Strict-Transport-Security: max-age=31536000}, Content = {{"result":{"category":"fs","functions":[{"code":"switch","dp_id":1,"type":"Boolean","values":"null"},{"code":"fan_speed_percent","dp_id":3,"type":"Integer","values":"{\"min\":\"1\",\"max\":\"30\",\"scale\":\"0\",\"step\":\"1\"}"},{"code":"temp","dp_id":20,"type":"Integer","values":"{\"unit\":\"℃\",\"min\":\"17\",\"max\":\"28\",\"scale\":\"0\",\"step\":\"1\"}"}],"status":[{"code":"switch","dp_id":1,"type":"Boolean","values":"null"},{"code":"fan_speed_percent","dp_id":3,"type":"Integer","values":"{\"min\":\"1\",\"max\":\"30\",\"scale\":\"0\",\"step\":\"1\"}"},{"code":"temp","dp_id":20,"type":"Integer","values":"{\"unit\":\"℃\",\"min\":\"17\",\"max\":\"28\",\"scale\":\"0\",\"step\":\"1\"}"}]},"success":true,"t":1661587568682,"tid":"1b7138a525df11eda34c0af93703ddff"}}
2022-08-27 10:06:08.701 [TRACE] [ej.binding.tuya.internal.cloud.TuyaContentListener] - Received from 'https://openapi.tuyaeu.com/v1.0/iot-03/devices/factory-infos?device_ids=bfce69db8935ad00425bjo': Code = {200}, Headers = {Content-Type: application/json;charset=UTF-8, Content-Length: 187, Connection: keep-alive, Server: Tuya-Sec, Date: Sat, 27 Aug 2022 08:06:08 GMT, Access-Control-Allow-Credentials: true, Access-Control-Allow-Headers: , Access-Control-Allow-Headers: access_token,Content-Type, Access-Control-Allow-Methods: POST, Access-Control-Allow-Methods: OPTIONS, Access-Control-Allow-Methods: GET, Access-Control-Allow-Methods: DELETE, Access-Control-Allow-Methods: PUT, Access-Control-Allow-Origin: https://iot.tuya.com, Gateway-Info: highway, Strict-Transport-Security: max-age=31536000}, Content = {{"result":[{"id":"bfce69db8935ad00425bjo","mac":"10d5617e625c","sn":"10002993202914","uuid":"db128b88765f9948"}],"success":true,"t":1661587568690,"tid":"1b7153fa25df11ed806ab61200188eab"}}
2022-08-27 10:06:08.702 [TRACE] [smarthomej.binding.tuya.internal.cloud.TuyaOpenAPI] - Sending to 'https://openapi.tuyaeu.com/v1.1/devices/bfce69db8935ad00425bjo/specifications': Method = {GET}, Headers = {Accept-Encoding: gzip, User-Agent: Jetty/9.4.46.v20220331, client_id: ********************, t: 1661587568701, Signature-Headers: client_id, sign_method: HMAC-SHA256, access_token: ********************************, sign: 893E487AAF2CDC62061DE1F97C8C57B70F5BD827930F7C40B94A055BC65C9B20}, Content = {null}
2022-08-27 10:06:08.739 [TRACE] [ej.binding.tuya.internal.cloud.TuyaContentListener] - Received from 'https://openapi.tuyaeu.com/v1.1/devices/004625208cce4ee0b07c/specifications': Code = {200}, Headers = {Content-Type: application/json;charset=UTF-8, Transfer-Encoding: chunked, Connection: keep-alive, Server: Tuya-Sec, Date: Sat, 27 Aug 2022 08:06:08 GMT, Vary: Accept-Encoding, Access-Control-Allow-Credentials: true, Access-Control-Allow-Headers: , Access-Control-Allow-Headers: access_token,Content-Type, Access-Control-Allow-Methods: POST, Access-Control-Allow-Methods: OPTIONS, Access-Control-Allow-Methods: GET, Access-Control-Allow-Methods: DELETE, Access-Control-Allow-Methods: PUT, Access-Control-Allow-Origin: https://iot.tuya.com, Gateway-Info: highway, Content-Encoding: gzip, Strict-Transport-Security: max-age=31536000}, Content = {{"result":{"category":"kt","functions":[{"code":"windspeed","type":"Enum","values":"{\"range\":[\"1\",\"2\",\"3\" ]}"},{"code":"humidity_set","type":"Integer","values":"{\"min\":0,\"unit\":\"%\",\"scale\":0,\"max\":100,\"type\":\"value\",\"step\":1}"},{"code":"temp_set","dp_id":2,"type":"Integer","values":"{\"min\":16,\"unit\":\"℃\",\"scale\":0,\"max\":31,\"type\":\"value\",\"step\":1}"},{"code":"switch","dp_id":1,"type":"Boolean","values":"null"},{"code":"mode","dp_id":101,"type":"Enum","values":"{\"range\":[\"auto\",\"cold\",\"hot\",\"wet\",\"wind\",\"eco\"]}"},{"code":"c_f","dp_id":109,"type":"Enum","values":"{\"range\":[\"C\",\"F\"]}"},{"code":"temp_set_f","dp_id":110,"type":"Integer","values":"{\"unit\":\"℉\",\"min\":62,\"max\":90,\"scale\":0,\"step\":1}"}],"status":[{"code":"humidity_current","dp_id":112,"type":"Integer","values":"{\"min\":0,\"scale\":0,\"unit\":\"%\",\"max\":100,\"step\":1}"},{"code":"windspeed","dp_id":104,"type":"Enum","values":"{\"range\":[\"1\",\"2\",\"3\" ]}"},{"code":"humidity_set","dp_id":17,"type":"Integer","values":"{\"min\":0,\"unit\":\"%\",\"scale\":0,\"max\":100,\"type\":\"value\",\"step\":1}"},{"code":"temp_current","dp_id":3,"type":"Integer","values":"{\"min\":-20,\"scale\":0,\"unit\":\"℃\",\"max\":100,\"step\":1}"},{"code":"temp_set","dp_id":2,"type":"Integer","values":"{\"min\":16,\"unit\":\"℃\",\"scale\":0,\"max\":31,\"type\":\"value\",\"step\":1}"},{"code":"switch","dp_id":1,"type":"Boolean","values":"null"},{"code":"mode","dp_id":101,"type":"Enum","values":"{\"range\":[\"auto\",\"cold\",\"hot\",\"wet\",\"wind\",\"eco\"]}"},{"code":"temp_current_f","dp_id":111,"type":"Integer","values":"{\"unit\":\"℉\",\"min\":32,\"max\":99,\"scale\":0,\"step\":1}"},{"code":"c_f","dp_id":109,"type":"Enum","values":"{\"range\":[\"C\",\"F\"]}"},{"code":"temp_set_f","dp_id":110,"type":"Integer","values":"{\"unit\":\"℉\",\"min\":62,\"max\":90,\"scale\":0,\"step\":1}"},{"code":"temp_current_f","dp_id":111,"type":"Integer","values":"{\"unit\":\"℉\",\"min\":32,\"max\":99,\"scale\":0,\"step\":1}"}]},"success":true,"t":1661587568728,"tid":"1b77716025df11ed86c3bed3cc205f4d"}}
2022-08-27 10:06:08.741 [TRACE] [ej.binding.tuya.internal.cloud.TuyaContentListener] - Received from 'https://openapi.tuyaeu.com/v1.1/devices/bffdf3209d379d2fc7nknm/specifications': Code = {200}, Headers = {Content-Type: application/json;charset=UTF-8, Transfer-Encoding: chunked, Connection: keep-alive, Server: Tuya-Sec, Date: Sat, 27 Aug 2022 08:06:08 GMT, Vary: Accept-Encoding, Access-Control-Allow-Credentials: true, Access-Control-Allow-Headers: , Access-Control-Allow-Headers: access_token,Content-Type, Access-Control-Allow-Methods: POST, Access-Control-Allow-Methods: OPTIONS, Access-Control-Allow-Methods: GET, Access-Control-Allow-Methods: DELETE, Access-Control-Allow-Methods: PUT, Access-Control-Allow-Origin: https://iot.tuya.com, Gateway-Info: highway, Content-Encoding: gzip, Strict-Transport-Security: max-age=31536000}, Content = {{"result":{"category":"fs","functions":[{"code":"switch","dp_id":1,"type":"Boolean","values":"null"},{"code":"fan_speed_percent","dp_id":3,"type":"Integer","values":"{\"min\":\"1\",\"max\":\"30\",\"scale\":\"0\",\"step\":\"1\"}"},{"code":"temp","dp_id":20,"type":"Integer","values":"{\"unit\":\"℃\",\"min\":\"17\",\"max\":\"28\",\"scale\":\"0\",\"step\":\"1\"}"}],"status":[{"code":"switch","dp_id":1,"type":"Boolean","values":"null"},{"code":"fan_speed_percent","dp_id":3,"type":"Integer","values":"{\"min\":\"1\",\"max\":\"30\",\"scale\":\"0\",\"step\":\"1\"}"},{"code":"temp","dp_id":20,"type":"Integer","values":"{\"unit\":\"℃\",\"min\":\"17\",\"max\":\"28\",\"scale\":\"0\",\"step\":\"1\"}"}]},"success":true,"t":1661587568730,"tid":"1b786b6325df11eda34c0af93703ddff"}}
2022-08-27 10:06:08.761 [TRACE] [j.binding.tuya.internal.local.handlers.TuyaDecoder] - udpListener: Received encoded '000055AA00000000000000130000009C0000000023D01E5FEF56833314CEF60FB086ED33025CACFD042A63D2AE33DB830CA894D0019F8BF94E62DE1ECB4C029A68B80A0CA012E71E506FD1511299866A5BFFEE077256F992EF0BB3C9946F6CA8E2E148532E0DBC9A92C3317286EBF238BE5797866AADEAFDEC3D2F5901C84C888D5DCDA7B04A82876F98E334B84197EFF80B263D7A23E3B2249F5ADF48A714F851AAF43955D7E9A40000AA55'
2022-08-27 10:06:08.762 [TRACE] [j.binding.tuya.internal.local.handlers.TuyaDecoder] - udpListener/: Decoded raw payload: {"ip":"192.168.0.215","gwId":"bfce69db8935ad00425bjo","active":2,"ablilty":0,"encrypt":true,"productKey":"cjsa4k7tqbpuyq3l","version":"3.3"}
2022-08-27 10:06:08.762 [DEBUG] [j.binding.tuya.internal.local.handlers.TuyaDecoder] - udpListener/: Received MessageWrapper{commandType=UDP_NEW, content='DiscoveryMessage{ip='192.168.0.215', deviceId='bfce69db8935ad00425bjo', active=2, ability=0, mode=0, encrypt=true, productKey='cjsa4k7tqbpuyq3l', version='3.3'}'}
2022-08-27 10:06:08.788 [TRACE] [ej.binding.tuya.internal.cloud.TuyaContentListener] - Received from 'https://openapi.tuyaeu.com/v1.1/devices/bfb5d7cf6a3156ad2fugbf/specifications': Code = {200}, Headers = {Content-Type: application/json;charset=UTF-8, Transfer-Encoding: chunked, Connection: keep-alive, Server: Tuya-Sec, Date: Sat, 27 Aug 2022 08:06:08 GMT, Vary: Accept-Encoding, Access-Control-Allow-Credentials: true, Access-Control-Allow-Headers: , Access-Control-Allow-Headers: access_token,Content-Type, Access-Control-Allow-Methods: POST, Access-Control-Allow-Methods: OPTIONS, Access-Control-Allow-Methods: GET, Access-Control-Allow-Methods: DELETE, Access-Control-Allow-Methods: PUT, Access-Control-Allow-Origin: https://iot.tuya.com, Gateway-Info: highway, Content-Encoding: gzip, Strict-Transport-Security: max-age=31536000}, Content = {{"result":{"category":"fs","functions":[{"code":"switch","dp_id":1,"type":"Boolean","values":"null"},{"code":"fan_speed_percent","dp_id":3,"type":"Integer","values":"{\"min\":\"1\",\"max\":\"30\",\"scale\":\"0\",\"step\":\"1\"}"},{"code":"temp","dp_id":20,"type":"Integer","values":"{\"unit\":\"℃\",\"min\":\"17\",\"max\":\"28\",\"scale\":\"0\",\"step\":\"1\"}"}],"status":[{"code":"switch","dp_id":1,"type":"Boolean","values":"null"},{"code":"fan_speed_percent","dp_id":3,"type":"Integer","values":"{\"min\":\"1\",\"max\":\"30\",\"scale\":\"0\",\"step\":\"1\"}"},{"code":"temp","dp_id":20,"type":"Integer","values":"{\"unit\":\"℃\",\"min\":\"17\",\"max\":\"28\",\"scale\":\"0\",\"step\":\"1\"}"}]},"success":true,"t":1661587568778,"tid":"1b7f1d8325df11eda34c0af93703ddff"}}
2022-08-27 10:06:08.798 [TRACE] [ej.binding.tuya.internal.cloud.TuyaContentListener] - Received from 'https://openapi.tuyaeu.com/v1.1/devices/bfce69db8935ad00425bjo/specifications': Code = {200}, Headers = {Content-Type: application/json;charset=UTF-8, Transfer-Encoding: chunked, Connection: keep-alive, Server: Tuya-Sec, Date: Sat, 27 Aug 2022 08:06:08 GMT, Vary: Accept-Encoding, Access-Control-Allow-Credentials: true, Access-Control-Allow-Headers: , Access-Control-Allow-Headers: access_token,Content-Type, Access-Control-Allow-Methods: POST, Access-Control-Allow-Methods: OPTIONS, Access-Control-Allow-Methods: GET, Access-Control-Allow-Methods: DELETE, Access-Control-Allow-Methods: PUT, Access-Control-Allow-Origin: https://iot.tuya.com, Gateway-Info: highway, Content-Encoding: gzip, Strict-Transport-Security: max-age=31536000}, Content = {{"result":{"category":"fs","functions":[{"code":"switch","dp_id":1,"type":"Boolean","values":"null"},{"code":"fan_speed_percent","dp_id":3,"type":"Integer","values":"{\"min\":\"1\",\"max\":\"30\",\"scale\":\"0\",\"step\":\"1\"}"},{"code":"temp","dp_id":20,"type":"Integer","values":"{\"unit\":\"℃\",\"min\":\"17\",\"max\":\"28\",\"scale\":\"0\",\"step\":\"1\"}"}],"status":[{"code":"switch","dp_id":1,"type":"Boolean","values":"null"},{"code":"fan_speed_percent","dp_id":3,"type":"Integer","values":"{\"min\":\"1\",\"max\":\"30\",\"scale\":\"0\",\"step\":\"1\"}"},{"code":"temp","dp_id":20,"type":"Integer","values":"{\"unit\":\"℃\",\"min\":\"17\",\"max\":\"28\",\"scale\":\"0\",\"step\":\"1\"}"}]},"success":true,"t":1661587568788,"tid":"1b7f29df25df11ed806ab61200188eab"}}
J-N-K commented 1 year ago

Very intereting. I extracted the specification part:

{
  "result": {
    "category": "kt",
    "functions": [
      {
        "code": "windspeed",
        "type": "Enum",
        "values": "{\"range\":[\"1\",\"2\",\"3\" ]}"
      },
      {
        "code": "humidity_set",
        "type": "Integer",
        "values": "{\"min\":0,\"unit\":\"%\",\"scale\":0,\"max\":100,\"type\":\"value\",\"step\":1}"
      },
      {
        "code": "temp_set",
        "dp_id": 2,
        "type": "Integer",
        "values": "{\"min\":16,\"unit\":\"℃\",\"scale\":0,\"max\":31,\"type\":\"value\",\"step\":1}"
      },
      {
        "code": "switch",
        "dp_id": 1,
        "type": "Boolean",
        "values": "null"
      },
      {
        "code": "mode",
        "dp_id": 101,
        "type": "Enum",
        "values": "{\"range\":[\"auto\",\"cold\",\"hot\",\"wet\",\"wind\",\"eco\"]}"
      },
      {
        "code": "c_f",
        "dp_id": 109,
        "type": "Enum",
        "values": "{\"range\":[\"C\",\"F\"]}"
      },
      {
        "code": "temp_set_f",
        "dp_id": 110,
        "type": "Integer",
        "values": "{\"unit\":\"℉\",\"min\":62,\"max\":90,\"scale\":0,\"step\":1}"
      }
    ],
    "status": [
      {
        "code": "humidity_current",
        "dp_id": 112,
        "type": "Integer",
        "values": "{\"min\":0,\"scale\":0,\"unit\":\"%\",\"max\":100,\"step\":1}"
      },
      {
        "code": "windspeed",
        "dp_id": 104,
        "type": "Enum",
        "values": "{\"range\":[\"1\",\"2\",\"3\" ]}"
      },
      {
        "code": "humidity_set",
        "dp_id": 17,
        "type": "Integer",
        "values": "{\"min\":0,\"unit\":\"%\",\"scale\":0,\"max\":100,\"type\":\"value\",\"step\":1}"
      },
      {
        "code": "temp_current",
        "dp_id": 3,
        "type": "Integer",
        "values": "{\"min\":-20,\"scale\":0,\"unit\":\"℃\",\"max\":100,\"step\":1}"
      },
      {
        "code": "temp_set",
        "dp_id": 2,
        "type": "Integer",
        "values": "{\"min\":16,\"unit\":\"℃\",\"scale\":0,\"max\":31,\"type\":\"value\",\"step\":1}"
      },
      {
        "code": "switch",
        "dp_id": 1,
        "type": "Boolean",
        "values": "null"
      },
      {
        "code": "mode",
        "dp_id": 101,
        "type": "Enum",
        "values": "{\"range\":[\"auto\",\"cold\",\"hot\",\"wet\",\"wind\",\"eco\"]}"
      },
      {
        "code": "temp_current_f",
        "dp_id": 111,
        "type": "Integer",
        "values": "{\"unit\":\"℉\",\"min\":32,\"max\":99,\"scale\":0,\"step\":1}"
      },
      {
        "code": "c_f",
        "dp_id": 109,
        "type": "Enum",
        "values": "{\"range\":[\"C\",\"F\"]}"
      },
      {
        "code": "temp_set_f",
        "dp_id": 110,
        "type": "Integer",
        "values": "{\"unit\":\"℉\",\"min\":62,\"max\":90,\"scale\":0,\"step\":1}"
      },
      {
        "code": "temp_current_f",
        "dp_id": 111,
        "type": "Integer",
        "values": "{\"unit\":\"℉\",\"min\":32,\"max\":99,\"scale\":0,\"step\":1}"
      }
    ]
  },
  "success": true,
  "t": 1661587568728,
  "tid": "1b77716025df11ed86c3bed3cc205f4d"
}

and it seems that the windspeed definition is present in both, functions and status but does not contain a dp for the function. Since the status is only processed when the function is not present, this fails.

Can you please update to the development version? I added a fix for that. I guess you need to delete and re-add the thing to get the fixed schema.

kgoderis commented 1 year ago

Will give it a go. BTW, when no dp Is present, you do store a "0" in the jsondb. That's intentional, because if multiple id are missing you end up with duplicate ids in the jsondb

J-N-K commented 1 year ago

That's exactly the issue. 0 is used if no dp is present. These entries need to be filtered.

kgoderis commented 1 year ago

It is not working yet. This time the error is on another code

19.389 [ERROR] [hab.core.internal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.smarthomej.binding.tuya.internal.handler.TuyaDeviceHandler@6a70e009': Duplicate key temp_current_f (attempted merging values org.smarthomej.binding.tuya.internal.util.SchemaDp@2912cba8 and org.smarthomej.binding.tuya.internal.util.SchemaDp@2bb4f2d9)
java.lang.IllegalStateException: Duplicate key temp_current_f (attempted merging values org.smarthomej.binding.tuya.internal.util.SchemaDp@2912cba8 and org.smarthomej.binding.tuya.internal.util.SchemaDp@2bb4f2d9)
    at java.util.stream.Collectors.duplicateKeyException(Collectors.java:133) ~[?:?]
    at java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:180) ~[?:?]
    at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) ~[?:?]
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655) ~[?:?]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?]
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[?:?]
    at org.smarthomej.binding.tuya.internal.handler.TuyaDeviceHandler.initialize(TuyaDeviceHandler.java:329) ~[?:?]
    at jdk.internal.reflect.GeneratedMethodAccessor116.invoke(Unknown Source) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
    at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
    at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
    at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
    at java.lang.Thread.run(Thread.java:834) [?:?]
2022-08-27 17:32:19.391 [ERROR] [org.openhab.core.thing.internal.ThingManagerImpl  ] - Exception occurred while initializing handler of thing 'tuya:tuyaDevice:004625208cce4ee0b07c': Duplicate key temp_current_f (attempted merging values org.smarthomej.binding.tuya.internal.util.SchemaDp@2912cba8 and org.smarthomej.binding.tuya.internal.util.SchemaDp@2bb4f2d9)
java.lang.IllegalStateException: Duplicate key temp_current_f (attempted merging values org.smarthomej.binding.tuya.internal.util.SchemaDp@2912cba8 and org.smarthomej.binding.tuya.internal.util.SchemaDp@2bb4f2d9)
    at java.util.stream.Collectors.duplicateKeyException(Collectors.java:133) ~[?:?]
    at java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:180) ~[?:?]
    at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) ~[?:?]
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655) ~[?:?]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?]
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[?:?]
    at org.smarthomej.binding.tuya.internal.handler.TuyaDeviceHandler.initialize(TuyaDeviceHandler.java:329) ~[?:?]
    at jdk.internal.reflect.GeneratedMethodAccessor116.invoke(Unknown Source) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
    at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
    at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
    at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
    at java.lang.Thread.run(Thread.java:834) [?:?]
J-N-K commented 1 year ago

Can you please try again? I reworked the complete remote schema parsing.

kgoderis commented 1 year ago

Did you bump the version to 3.2.16 because it is still showing 3.2.15 after uninstall/install (307 │ Active │ 80 │ 3.2.15.202208271606 │ org.smarthomej.binding.tuya)?

J-N-K commented 1 year ago

No, just the timestamp changed. The version looks good.

kgoderis commented 1 year ago

@J-N-K It seems to work, the Thing comes online. Tx!

kgoderis commented 1 year ago

Hi Jan Will confirm when I get back from my annual leave K

Sent from my iPhone

On 14 Aug 2022, at 14:56, J-N-K @.***> wrote:

 Hi Karel,

Can you confirm the status messages are now working?

Am 08.08.2022 um 17:33 schrieb Karel Goderis @.***>:

Mmmh... it is not that these are undocumented, they seem to be status fields which are ignored all together, and some of them do contain very relevant information IMHO.

Can the error be (quick) fixed by catching the exception and then log an error pls?

On 8 Aug 2022, at 16:42, J-N-K @.***> wrote:

The "Could not find channel" messages can be ignored. There are a lot of undocumented dps reported by a lot of devices, which currently does not hurt. That's why they are DEBUG level messages.

Judging from the dp-spec you send by mail dp 109 is indeed an enum (this is also in the spec above). So it seems that the device is reporting something different than it should be and I doubt we can fix that in the binding.

I agree that this needs to be handled better by the code. I'll check that. Thanks for reporting.

— Reply to this email directly, view it on GitHub https://github.com/smarthomej/addons/issues/393#issuecomment-1208221509, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJUY5QRCNF4JCCLP5HKR43VYEMFDANCNFSM555EERVA. You are receiving this because you authored the thread.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.