0x5e / homebridge-tuya-platform

Make homebridge-tuya-platform great again.
MIT License
216 stars 67 forks source link

Add support for Tuya Camera #48

Closed hotbird1970 closed 1 year ago

hotbird1970 commented 1 year ago

If possible, please add support for Tuya Camera with Flood light, currently it is showing as "unsupported device". Since it may not be possible to get the camera feed, please try to expose the camera as a light switch to turn on / off camera flood light or set up automations based on spotlight being triggered.

Device details { "result": { "active_time": 1667665196, "category": "sp", "category_name": "Smart Camera", "create_time": 1667665196, "gateway_id": "", "icon": "smart/icon/ay1568808812161OlPJW/e9205fad2bce1aea35ae057cd6e5c311.png", "id": "", "lat": "", "lon": "", "model": "", "name": "Wireless-IPC ", "online": true, "owner_id": "", "product_id": "5fuyai0la8slgmnj", "product_name": "Wireless-IPC ", "sub": false, "time_zone": "-04:00", "update_time": 1667665214, "uuid": "hhws91a486885c5f6caa"

Device log 2022-11-05, 12:20:56 p.m.] [@0x5e/homebridge-tuya-platform] [TuyaDeviceManager] Unhandled mqtt message: bizCode = p2pSignal, bizData = { msg: { close_reason_local: 0, close_reason: 5 }, header: { path: 'mqtt', trace_id: 'ipc_p2p_ios_ebe4878e8496df5ee8zusg_1667665211383', sub_dev_id: '', from: 'ebe4878e8496df5ee8zusg', moto_id: '', to: 'az1662311846569oo7J8', sessionid: 'ebe4878e8496df5ee8zusg16676652119M8lWySb', type: 'disconnect' } }

0x5e commented 1 year ago

Yes the light switch can be supported. Please following https://github.com/0x5e/homebridge-tuya-platform#troubleshooting to get device infomation with specifications.

The video stream may not be supported because:

  1. Camera video stream HTTP API is not free. I'm not working for tuya anymore, just using my spare time and nonprofit, so I think it should be done by tuya.
  2. I'm not very familiar at video stream related things.
hotbird1970 commented 1 year ago

Thank you for your prompt response, If you can support the light switch and / or motion sensor, that would be great. Please see below log, hope this is what you are looking for

[2022-11-05, 2:40:23 p.m.] [@0x5e/homebridge-tuya-platform] Loading accessory from cache: Wireless-IPC

[2022-11-05, 2:40:23 p.m.] [@0x5e/homebridge-tuya-platform] Executed didFinishLaunching callback [2022-11-05, 2:40:23 p.m.] [@0x5e/homebridge-tuya-platform] Log in to Tuya Cloud. [2022-11-05, 2:40:23 p.m.] [@0x5e/homebridge-tuya-platform] [TuyaOpenAPI] request: method = post endpoint = https://openapi.tuyaus.com path = /v1.0/iot-01/associated-users/actions/authorized-login query = null [2022-11-05, 2:40:30 p.m.] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] connecting to: ssl://m1.tuyaus.com:8883 [2022-11-05, 2:40:30 p.m.] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] connected [2022-11-05, 2:40:31 p.m.] [@0x5e/homebridge-tuya-platform] [TuyaOpenAPI] response: path = /v1.0/homes/46091357/devices data = { "result": [ { "active_time": 1667665196, "biz_type": 18, "category": "sp", "create_time": 1667665196, "ip": "", "lat": "", "local_key": "", "lon": "", "model": "", "name": "Wireless-IPC ", "online": true, "owner_id": "", "product_id": "5fuyai0la8slgmnj", "product_name": "Wireless-IPC ", "status": [ { "code": "basic_flip", "value": true }, { "code": "basic_osd", "value": true }, { "code": "basic_private", "value": false }, { "code": "motion_sensitivity", "value": "1" }, { "code": "sd_storge", "value": "0|0|0" }, { "code": "sd_status", "value": 3 }, { "code": "sd_format", "value": false }, { "code": "motion_timer_setting", "value": "" }, { "code": "movement_detect_pic", "value": "$" }, { "code": "ptz_stop", "value": true }, { "code": "sd_format_state", "value": 0 }, { "code": "ptz_control", "value": "7" }, { "code": "nightvision_mode", "value": "auto" }, { "code": "motion_switch", "value": true }, { "code": "record_switch", "value": false }, { "code": "record_mode", "value": "1" }, { "code": "motion_tracking", "value": false }, { "code": "device_restart", "value": false }, { "code": "zoom_control", "value": "0" }, { "code": "zoom_stop", "value": false }, { "code": "humanoid_filter", "value": true }, { "code": "alarm_message", "value":

0x5e commented 1 year ago

I need device schema from TuyaDeviceList.{uid}.json, please upload that file thanks.

hotbird1970 commented 1 year ago

Thank you for all your efforts in maintaining the plugin. Copied and pasted from Tuyadevice list. Please let me know if this is helpful. [ { "active_time": 1667665196, "biz_type": 18, "category": "sp", "create_time": 1667665196, "icon": "smart/icon/ay1568808812161OlPJW/e9205fad2bce1aea35ae057cd6e5c311.png", "id": "", "ip": "", "lat": "", "local_key": "", "lon": "", "model": "", "name": "Wireless-IPC ", "online": true, "owner_id": "", "product_id": "5fuyai0la8slgmnj", "product_name": "Wireless-IPC ", "status": [ { "code": "basic_flip", "value": true }, { "code": "basic_osd", "value": true }, { "code": "basic_private", "value": false }, { "code": "motion_sensitivity", "value": "1" }, { "code": "sd_storge", "value": "0|0|0" }, { "code": "sd_status", "value": 3 }, { "code": "sd_format", "value": false }, { "code": "motion_timer_setting", "value": "" }, { "code": "movement_detect_pic", "value": "$" }, { "code": "ptz_stop", "value": true }, { "code": "sd_format_state", "value": 0 }, { "code": "ptz_control", "value": "7" }, { "code": "nightvision_mode", "value": "auto" }, { "code": "motion_switch", "value": true }, { "code": "record_switch", "value": false }, { "code": "record_mode", "value": "1" }, { "code": "motion_tracking", "value": false }, { "code": "device_restart", "value": false }, { "code": "zoom_control", "value": "0" }, { "code": "zoom_stop", "value": false }, { "code": "humanoid_filter", "value": true }, { "code": "alarm_message", "value": "" } ], "sub": false, "time_zone": "", "uid": "", "update_time": 1667665214, "uuid": "", "schema": [ { "code": "basic_flip", "mode": "rw", "type": "Boolean", "values": "{}", "property": {} }, { "code": "basic_osd", "mode": "rw", "type": "Boolean", "values": "{}", "property": {} }, { "code": "basic_private", "mode": "rw", "type": "Boolean", "values": "{}", "property": {} }, { "code": "motion_sensitivity", "mode": "rw", "type": "Enum", "values": "{\"range\":[\"0\",\"1\",\"2\"]}", "property": { "range": [ "0", "1", "2" ] } }, { "code": "sd_storge", "mode": "ro", "type": "String", "values": "{\"maxlen\":255}", "property": { "maxlen": 255 } }, { "code": "sd_status", "mode": "ro", "type": "Integer", "values": "{\"unit\":\"\",\"min\":1,\"max\":5,\"scale\":1,\"step\":1}", "property": { "unit": "", "min": 1, "max": 5, "scale": 1, "step": 1 } }, { "code": "sd_format", "mode": "rw", "type": "Boolean", "values": "{}", "property": {} }, { "code": "motion_timer_setting", "mode": "rw", "type": "String", "values": "{\"maxlen\":255}", "property": { "maxlen": 255 } }, { "code": "movement_detect_pic", "mode": "ro", "type": "Raw", "values": "{}", "property": {} }, { "code": "ptz_stop", "mode": "rw", "type": "Boolean", "values": "{}", "property": {} }, { "code": "sd_format_state", "mode": "ro", "type": "Integer", "values": "{\"unit\":\"\",\"min\":-20000,\"max\":20000,\"scale\":1,\"step\":1}", "property": { "unit": "", "min": -20000, "max": 20000, "scale": 1, "step": 1 } }, { "code": "ptz_control", "mode": "rw", "type": "Enum", "values": "{\"range\":[\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"0\"]}", "property": { "range": [ "1", "2", "3", "4", "5", "6", "7", "0" ] } }, { "code": "nightvision_mode", "mode": "rw", "type": "Enum", "values": "{\"range\":[\"auto\",\"ir_mode\",\"color_mode\"]}", "property": { "range": [ "auto", "ir_mode", "color_mode" ] } }, { "code": "motion_switch", "mode": "rw", "type": "Boolean", "values": "{}", "property": {} }, { "code": "record_switch", "mode": "rw", "type": "Boolean", "values": "{}", "property": {} }, { "code": "record_mode", "mode": "rw", "type": "Enum", "values": "{\"range\":[\"1\",\"2\"]}", "property": { "range": [ "1", "2" ] } }, { "code": "motion_tracking", "mode": "rw", "type": "Boolean", "values": "{}", "property": {} }, { "code": "device_restart", "mode": "rw", "type": "Boolean", "values": "{}", "property": {} }, { "code": "zoom_control", "mode": "rw", "type": "Enum", "values": "{\"range\":[\"0\",\"1\"]}", "property": { "range": [ "0", "1" ] } }, { "code": "zoom_stop", "mode": "rw", "type": "Boolean", "values": "{}", "property": {} }, { "code": "humanoid_filter", "mode": "rw", "type": "Boolean", "values": "{}", "property": {} }, { "code": "alarm_message", "mode": "ro", "type": "String", "values": "{}", "property": {} } ] }, {

0x5e commented 1 year ago

Yes that's enough. Because camera's core function (video stream) is not supported, so I may not mark camera as supported in the future. Instead, in 1.7.0, I will add an generic accessory for all the unsupported devices to show all the switches and enums.

hotbird1970 commented 1 year ago

Many thanks

Thijsjuh92 commented 1 year ago

Hello, I have the camera rtsp stream working via "Camera.ui", with buttons (as triggers) to activate doorbel and motion in Apple Homekit. I'm trying to find a way to have a motion event from the doorbel in homekit to activate the doorbel trigger in Camera.ui.

Please at the Doorbell motion trigger events to your plugin. It will fix for me all the headhack this process till now costs me... haha

I already have an event in my homebridge logs, when pressing the doorbell:

[30-11-2022 01:31:36] [TuyaPlatform] [TuyaDeviceManager] Unhandled mqtt message: bizCode = event_notify, bizData = { devId: 'bf36b2aa66****', edata: 'c9a1**8299', etype: 'doorbell'

Maybe this will help with an simple motion event in the already "unsupported" shown Doorbell accessory in my Apple Homekit.

Thank you in advance, great work you already did!

0x5e commented 1 year ago

Hi @Thijsjuh92 I may not clearly understand you, did you mean:

  1. You have a non-tuya rtsp stream camera, working via "homebridge-camera-ui"
  2. A Tuya Doorbell shown as "unsupported"

I haven't using camera and doorbell yet, could you have more explanation about this? And also I need the doorbell's information, category code, schemas, etc.

Thijsjuh92 commented 1 year ago

Hi @0x5e

I managed to get the RTSP stream from the BAZZ/LSC Doorbell, this doorbell is connected via SmartLife (Tuya) app. In this app, i turned on the "ONVIF" setting. This setting will let you know, which local-IP is used by the camera.

With this information you can setup the below config.json in Camera-UI. and you have a local stream to your homekit. When you push the virtual trigger buttons(picture3) in Homekit, the doorbell will ring and you'll get a preview of the doorbell stream (live). HSV also possible. With an other camera i managed it. Not managed to get this feature with the doorbel, but will look later to it. Its a Camera.ui thing.

This all I have from: https://www.youtube.com/watch?v=YU8aOUHRsN0

Some small errors in the log, but it works great, I will investigate the errors on a later moment, this due to the fact first want to have the button press working.

This is the config i now use:


{
  "logLevel": "info",
  "port": 8081,
  "atHomeSwitch": false,
  "options": {
    "videoProcessor": "/usr/local/lib/node_modules/homebridge-camera-ui/node_modules/ffmpeg-for-homebridge/ffmpeg"
  },
  "ssl": {
    "active": false
  },
  "http": {
    "active": false,
    "port": 7272,
    "localhttp": false
  },
  "smtp": {
    "active": false,
    "port": 2727,
    "space_replace": "+"
  },
  "ftp": {
    "active": false,
    "useFile": false,
    "port": 5050
  },
  "mqtt": {
    "active": false,
    "tls": false,
    "port": 1883
  },
  "cameras": [
    {
      "name": "Deurbel",
      "manufacturer": "LSC Smart Connect",
      "model": "Smart Doorbell",
      "serialNumber": "*********",
      "motion": true,
      "doorbell": true,
      "switches": true,
      "motionTimeout": 10,
      "hsv": true,
      "prebuffering": true,
      "prebufferLength": 5,
      "unbridge": true,
      "videoConfig": {
        "source": "-rtsp_transport tcp -i rtsp://admin:admin@***.***.***.***:8554/Streaming/Channels/101",
        "subSource": "-rtsp_transport tcp -i rtsp://admin:admin@***.***.***.***:8554/Streaming/Channels/101",
        "stillImageSource": "-rtsp_transport tcp -i rtsp://admin:admin@***.***.***.***:8554/Streaming/Channels/101",
        "debug": true,
        "debugReturn": true,
        "maxFPS": 15,
        "vcodec": "copy",
        "acodec": "libfdk_aac",
        "audio": true
      },
      "smtp": {
        "email": "Deurbel"
      },
      "videoanalysis": {
        "active": false
      },
      "mqtt": {}
    }
  ]
}

When Video analysis is set on true, the Camera.UI plugin will trigger motion event in Homebridge and works. But think the motion and button event from Tuya API will work better!

The last part is to fix the button push event from the doorbell. I installed your app and unfortunatelly the log told me the "Deurbell" is an unsupported device in the logs, but it pops up in Homekit. I dont need the API-rtsp-streams. Only the button push event and motion event.

I found the below option for the official Tuya app, but as you know many more bugs in this app. and can't get this working properly: https://www.reddit.com/r/homebridge/comments/szhbmz/successful_integration_on_tuya_video_doorbell/ Your plugin has an other type of index.js file.

Another thing: With your plugin, when the button is pushed on the doorbell, i receive below mqtt message in the homebridge log: (Picture5) [TuyaPlatform][TuyaDeviceManager] Unhandled mqtt message: bizCode = event_notify, bizData = devId: 'bf36b2aa66*************', edata: 'c9a1788b1669879778', etype: 'doorbell' [TuyaPlatform][TuyaOpenMQ] Message received with wrong order. [TuyaPlatform][TuyaOpenMQ] LastMessage: dataId = undefined, t = 1669879778344 [TuyaPlatform][TuyaOpenMQ] CurrentMessage: dataId = 42719d22-57b7-4030-8e8b-2a30117c9fa3, t = 1669879780 [[TuyaPlatform][TuyaOpenMQ] Fallback to use API fetching the latest device status.

I'm almost there, everything works almost.

If your app can get a generic device (as you mentioned on a post above) with these events, i'm satisfied :-)

Homeview Homekit (every 10sec preview update) image

Camera view, after 3/4sec buffering perfect rtsp stream! image

Button(triggers)created by Camera.ui image

Some logs: image

image

Thijsjuh92 commented 1 year ago

Here is the device information:

Product Name: LSC-Bell 8S(AKV300_8M)
Device ID: bf36b2a**************
Product Category: sp
Device Status: Online
Association: ap-*************************
Data Center: Central Europe Data Center

Control Device with Standard Instruction Set: (JSON.EDITOR)

[
  {
    "code": "basic_indicator",
    "value": true
  },
  {
    "code": "basic_flip",
    "value": false
  },
  {
    "code": "basic_osd",
    "value": true
  },
  {
    "code": "motion_sensitivity",
    "value": "1"
  },
  {
    "code": "basic_nightvision",
    "value": "0"
  },
  {
    "code": "sd_format",
    "value": true
  },
  {
    "code": "motion_switch",
    "value": false
  },
  {
    "code": "record_switch",
    "value": false
  },
  {
    "code": "record_mode",
    "value": "2"
  },
  {
    "code": "doorbell_ring_exist",
    "value": "0"
  },
  {
    "code": "chime_ring_tune",
    "value": "2"
  },
  {
    "code": "chime_ring_volume",
    "value": 100
  },
  {
    "code": "basic_device_volume",
    "value": 1
  },
  {
    "code": "chime_settings",
    "value": "2"
  },
  {
    "code": "motion_area_switch",
    "value": false
  },
  {
    "code": "motion_area",
    "value": ""
  }
]

Standard Status Set: (status needed for motion and buttonpress?)

Code Type Values
basic_indicator Boolean "{true,false}"
basic_flip Boolean "{true,false}"
basic_osd Boolean "{true,false}"
motion_sensitivity Enum { "range": [ "0", "1", "2" ] }
basic_nightvision Enum { "range": [ "0", "1", "2" ] }
sd_storge String { "maxlen": 255 }
sd_status Integer { "unit": "", "min": 1, "max": 5, "scale": 1, "step": 1 }
sd_format Boolean "{true,false}"
movement_detect_pic Raw {}
sd_format_state Integer { "unit": "", "min": -20000, "max": 20000, "scale": 1, "step": 1 }
motion_switch Boolean "{true,false}"
doorbell_active String { "maxlen": 255 }
record_switch Boolean "{true,false}"
record_mode Enum { "range": [ "1", "2" ] }
doorbell_pic Raw {}
doorbell_ring_exist Enum { "range": [ "0", "1" ] }
chime_ring_tune Enum { "range": [ "1", "2", "3", "4" ] }
chime_ring_volume Integer { "unit": "", "min": 0, "max": 100, "scale": 1, "step": 1 }
basic_device_volume Integer { "min": 1, "max": 10, "scale": 0, "step": 1 }
chime_settings Enum { "range": [ "0", "2", "3" ] }
motion_area_switch Boolean "{true,false}"
motion_area String { "maxlen": 255 }
alarm_message String {}

**Standard Instruction Set**
basic_indicator Boolean Values
basic_flip Boolean "{true,false}"
basic_osd Boolean "{true,false}"
motion_sensitivity Enum { "range": [ "0", "1", "2" ] }
basic_nightvision Enum { "range": [ "0", "1", "2" ] }
sd_format Boolean "{true,false}"
motion_switch Boolean "{true,false}"
record_switch Boolean "{true,false}"
record_mode Enum { "range": [ "1", "2" ] }
doorbell_ring_exist Enum { "range": [ "0", "1" ] }
chime_ring_tune Enum { "range": [ "1", "2", "3", "4" ] }
chime_ring_volume Integer { "unit": "", "min": 0, "max": 100, "scale": 1, "step": 1 }
basic_device_volume Integer { "min": 1, "max": 10, "scale": 0, "step": 1 }
chime_settings Enum { "range": [ "0", "2", "3" ] }
motion_area_switch Boolean "{true,false}"
motion_area String { "maxlen": 255 }
0x5e commented 1 year ago

@Thijsjuh92 Thanks for the detail information! Of course we can handle the "unhandled mqtt message" for the camera, please give me more time to digest the large number of sentences in english :) I think this requirement is meaningful.

I have no experience processing the homekit events and don't have apple tv / homepod to support homekit scene/automation. I will borrow one later and have some test.

Thijsjuh92 commented 1 year ago

@0x5e Your Welcome!

Hopefully you can add these two events in the now unsupported doorbell accessory, with the information i provided above.

Thank you. Great work!

0x5e commented 1 year ago

@Thijsjuh92 First we need to know whether the camera have doorbell button or motion detect feature before add MotionSensor and Doorbell Services into Accessory. This should be told from Standard Status Set or Standard Instruction Set.

From documentation: https://developer.tuya.com/cn/docs/iot/s?id=K9gf48qapbl1n Is it okay to use motion_switch and doorbell_ring_exist ? But I didn't find the doorbell related instruction/status set in the document so I don't know which one would be better.

And when motion event triggered, what is the status value received from mqtt?

PS: I'm also curious about the value of movement_detect_pic.

Thijsjuh92 commented 1 year ago

@0x5e I think the motion and button "events" can't be told from the Standard Instruction Set nor the Standard Status Set...

I think these are all configuration triggers, all named and linked to the settings within the SmartLife app and the config.json inside the camera.

For example:

I have verified this by editing a setting in the SmartLife app and the value changed on the Debug Section online at Tuya IoT. And vice versa to...

Only this one I can't find in the config.json file or app:alarm_message

I checked the device logs online on the Developer page at Tuya IoT and this are my readings when: Real-life button Doorbell press: (2 times pressed) image doorbel_active with id + someone ring doorbell with string maxlen{255} don't exist in the Standard Sets I think an encrypted event including the snap shot photo..?

Real-life motion: (last line is when motion_switch is set true) image motion_detect = encrypted message..?

I can't find a mqtt value for motion event in the Homebridge log. Can you help me where to find the mqtt messages online on Tuya IoT?

I also can't find a value for movement_detect_pic.

I found this online, but I don't know if this helps us out to the wright direction..:

PS: In the 1.7 update you mentioned all devices will been shown supported. This doorbell is still shown as unsupported

0x5e commented 1 year ago

Yes I guess the value of Motion Detect is the base64 url of the photo. If you can't get any logs of motion event in homebridge log, try #111 switch to "DP Instruction" mode. But when you are in "DP Instruction" mode, your dp code may incompatible with others, you may receive mqtt log but I may hard to compatible yours and other people's camera motion event together. Anyway just have a try.

0x5e commented 1 year ago

And 1.7 is just started and under development, not finished yet :)

Thijsjuh92 commented 1 year ago

@0x5e I changed the setting to "DP Instruction mode", only don't know what to edit in the config file?

For now, still no mqtt message in Homebridge log.

Please let me know what i need to edit in config, if so.

0x5e commented 1 year ago

There's no config needed. Have you opened the homebridge debug mode? If not, please change back to "Standard Instruction mode" before collecting the debug logs.

I need the mqtt logs to tell me which two codes I need to listen, and which values means "motion event started / ended", "doorbell event started / ended". If there's no "motion event ended" or "doorbell event ended" mqtt message, please tell me the default timeout of these to events on the apps.

PS: I've seen the code from reddit, it helps me know the process, but the code may not generic because the doorbell ring code '185' is a magic code not for all the cameras, and it need to hardcode the device id which I need to remove.

Thijsjuh92 commented 1 year ago

@0x5e My logs are spammed by an other plugin in debug mode, within Homebridge.

Is there a way to see specific tuya plugin logs?

0x5e commented 1 year ago

@Thijsjuh92 You can try cat /path/to/logfile | grep "TuyaPlaftorm" or cat /path/to/logfile | grep "homebridge-tuya-platform".

Oh and please confirm have you subscribe the "Device Status Notification"?

Thijsjuh92 commented 1 year ago

Underneath all the message service cloud subscriptions, do you mean these?: image

I tried the 2 above mentioned path's, but terminal tells me location and/or file doesn't exist..

0x5e commented 1 year ago

Underneath all the message service cloud subscriptions, do you mean these?: image

I tried the 2 above mentioned path's, but terminal tells me location and/or file doesn't exist..

Please see readme config section, just have a check. I'm not in front of the computer, hard to explain :)

Thijsjuh92 commented 1 year ago

Underneath all the message service cloud subscriptions, do you mean these?: image

I tried the 2 above mentioned path's, but terminal tells me location and/or file doesn't exist..

Please see readme config section, just have a check. I'm not in front of the computer, hard to explain :)

@0x5e
Oh this lol, yes al done! Expiration date 29/12/2022.

i'm almost there to give you the motion event mqtt messages from the device(sp). Only my logs are spammend by an other plugin. And cant see the specific mqtt readings..

0x5e commented 1 year ago

@Thijsjuh92

If there's difficult get the logs, it's okay, just wait a moment and try the new beta version later. @ErrorErrorError is supporting Camera with video stream these days, and floorlight, motion sensor, doorbell will be supportd too :)

137 #141

Thijsjuh92 commented 1 year ago

@0x5e @ErrorErrorError

Debug logs Homebridge:

LSC-Bell 8S(AKV300_8M)

Motion detected:

[11-12-2022 01:12:06] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/586cf0**********************
protocol = 4
message = {
  "dataId": "77851c3b-f013-476f-a50f-4ed339687a30",
  "devId": "bf36b2*************",
  "productKey": "***",
  "status": [
    {
      "115": "eyJ2IjoiMy4wIiwiYnVja2V0IjoidHktZXUtc3RvcmFnZTMwLXBpYyIsImZpbGVzIjpbWyIvNWY3ZjYwLTEyMzQ4MzQyLXBwMDFjZmNjYWQ3ZmQ2NTRlZDExL2RldGVjdC8xNjcwNzE3NTI5LmpwZWciLCI4ZDMzNGU3MDliOWQ0YjNmIl1dfQ==",
      "code": "movement_detect_pic",
      "t": "1670717530",
      "value": "eyJidWNrZXQiOiJ0eS1ldS1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi81ZjdmNjAtMTIzNDgzNDItcHAwMWNmY2NhZDdmZDY1NGVkMTEvZGV0ZWN0LzE2NzA3MTc1MjkuanBlZz9wYXJhbT1id2Y5ZlkvVElTakFPUm1aUGF4S05GV3psa0hsQnFXZjJEZy9DREQxeXVBPSIsIiJdXSwidiI6IjMuMCJ9"
    }
  ]
}

Motion detected, 5 minutes later:

[11-12-2022 01:17:04] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/586cf0e0bb**************
protocol = 4
message = {
  "dataId": "5017df70-9bd0-45d3-acbc-8146fd2a0b06",
  "devId": "bf36b2a*************",
  "productKey": "****",
  "status": [
    {
      "115": "eyJ2IjoiMy4wIiwiYnVja2V0IjoidHktZXUtc3RvcmFnZTMwLXBpYyIsImZpbGVzIjpbWyIvNWY3ZjYwLTEyMzQ4MzQyLXBwMDFjZmNjYWQ3ZmQ2NTRlZDExL2RldGVjdC8xNjcwNzE3ODI2LmpwZWciLCI1M2Y3N2I3MDBmMWNmZmZkIl1dfQ==",
      "code": "movement_detect_pic",
      "t": "1670717828",
      "value": "eyJidWNrZXQiOiJ0eS1ldS1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi81ZjdmNjAtMTIzNDgzNDItcHAwMWNmY2NhZDdmZDY1NGVkMTEvZGV0ZWN0LzE2NzA3MTc4MjYuanBlZz9wYXJhbT1JSWZCVGZ5T1R5M3B5cWZJS2MvekZhekdNZ1kvMmo5ME04WHZHNEluRHVNPSIsIiJdXSwidiI6IjMuMCJ9"
    }
  ]
}

Doorbell pressed

[11-12-2022 01:18:40] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/586cf0***************
protocol = 4
message = {
  "dataId": "5f76cf4e-d887-4c54-af68-d15e170c725a",
  "devId": "bf36b2***************",
  "productKey": "***",
  "status": [
    {
      "136": "1670717924",
      "code": "doorbell_active",
      "t": "1670717924",
      "value": "1670717924"
    }
  ]
}
[11-12-2022 01:18:41] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/586cf0e0******************
protocol = 20
message = {
  "bizCode": "event_notify",
  "bizData": {
    "devId": "bf36b2a**************",
    "edata": "c9a1788b1670717924",
    "etype": "doorbell"
  },
  "devId": "bf36b2a*************",
  "productKey": "***",
  "ts": 1670717921039,
  "uuid": "pp01cfccad**************"
}
[11-12-2022 01:18:41] [@0x5e/homebridge-tuya-platform] [TuyaDeviceManager] Unhandled mqtt message: bizCode = event_notify, bizData = {
  devId: 'bf36b2a********************',
  edata: 'c9a1788b1670717924',
  etype: 'doorbell'
}
[11-12-2022 01:18:42] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/586cf0e0bbe75****************
protocol = 4
message = {
  "dataId": "eff3b5b8-d44b-45e5-9e73-314b40842138",
  "devId": "bf36b************",
  "productKey": "***",
  "status": [
    {
      "154": "aHR0cHM6Ly90eS1ldS1zdG9yYWdlMzAtcGljLnMzLmV1LWNlbnRyYWwtMS5hbWF6b25hd3MuY29tLzVmN2Y2MC0xMjM0ODM0Mi1wcDAxY2ZjY2FkN2ZkNjU0ZWQxMS9kZXRlY3QvMTY3MDcxNzkyNC5qcGVnP1gtQW16LVNlY3VyaXR5LVRva2VuPUZ3b0daWEl2WVhkekVHb2FETGEyUzllR3lLZzN5MlB4enlLRkFqeEpjZ0lNeDZCQzlpR0J6N2NuMm9ocVc4RVJlc1gwQlllSjQ3aE9ua3VqcFVNUzElMkJvUjFOYmE3MFhhMEdkSkRKRDBGMXpSYWFtYVd5UDJyT0szejE5OFlJYlo5andBZHFNcGJhYVhnOU82NVdEdXdFZWhEOVJzUldLTkRqbUlKbmU4MU1KVzJKR1VDQjVIJTJCTEdUdDlnWFcwbWNCSFNkU0lNdnB6M1o3clFkSGclMkI1RkN1bXIycWZ6MEd3JTJCdmR2NHJrRCUyRjgyRWlsWDRrY0RqU3V4czA4Wm82RWhyUnRtN3Y5NDN4Nkd1eG5MU0NIeTFLdGI3UWptc003VXNUb1VJeklIYVo1WTlXODAwbkI1JTJCSDFRS0tEbFphcGh6dFp5NjlJSlIwQmdmSVUwYkxtTWxGY21INk5EUkFsdEw1QjRuaVR5bEtHR2RNOXpwaFA1cmViS2NoeHJHYVolMkJUdmlqTXZkU2NCaklwNTRxOUNjTzRqZjBIRVl6MUd0ZW1OelltYzQlMkJJcmFvM0w4b3I5Snd5S2t0YVBiSzVZVFlBdHJjJTNEJlgtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QVNJQVVUUE1VSkpKN0tGU0FMRjclMkYyMDIyMTIxMSUyRmV1LWNlbnRyYWwtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyMjEyMTFUMDAxODQ1WiZYLUFtei1FeHBpcmVzPTYwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZidWNrZXQ9dHktZXUtc3RvcmFnZTMwLXBpYyZ2PTEuMCZYLUFtei1TaWduYXR1cmU9MDU5ZDA2MGQ4ZjEzYTNmNWZmMjEzMTgxZjhjOTM2ZTkwYzdmYjRjOWYwZGJhOTJkN2NkMzcxZjRhMTA2YzM2NA==",
      "code": "doorbell_pic",
      "t": "1670717925",
      "value": "aHR0cHM6Ly90eS1ldS1zdG9yYWdlMzAtcGljLnMzLmV1LWNlbnRyYWwtMS5hbWF6b25hd3MuY29tLzVmN2Y2MC0xMjM0ODM0Mi1wcDAxY2ZjY2FkN2ZkNjU0ZWQxMS9kZXRlY3QvMTY3MDcxNzkyNC5qcGVnP1gtQW16LVNlY3VyaXR5LVRva2VuPUZ3b0daWEl2WVhkekVHb2FETGEyUzllR3lLZzN5MlB4enlLRkFqeEpjZ0lNeDZCQzlpR0J6N2NuMm9ocVc4RVJlc1gwQlllSjQ3aE9ua3VqcFVNUzElMkJvUjFOYmE3MFhhMEdkSkRKRDBGMXpSYWFtYVd5UDJyT0szejE5OFlJYlo5andBZHFNcGJhYVhnOU82NVdEdXdFZWhEOVJzUldLTkRqbUlKbmU4MU1KVzJKR1VDQjVIJTJCTEdUdDlnWFcwbWNCSFNkU0lNdnB6M1o3clFkSGclMkI1RkN1bXIycWZ6MEd3JTJCdmR2NHJrRCUyRjgyRWlsWDRrY0RqU3V4czA4Wm82RWhyUnRtN3Y5NDN4Nkd1eG5MU0NIeTFLdGI3UWptc003VXNUb1VJeklIYVo1WTlXODAwbkI1JTJCSDFRS0tEbFphcGh6dFp5NjlJSlIwQmdmSVUwYkxtTWxGY21INk5EUkFsdEw1QjRuaVR5bEtHR2RNOXpwaFA1cmViS2NoeHJHYVolMkJUdmlqTXZkU2NCaklwNTRxOUNjTzRqZjBIRVl6MUd0ZW1OelltYzQlMkJJcmFvM0w4b3I5Snd5S2t0YVBiSzVZVFlBdHJjJTNEJlgtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QVNJQVVUUE1VSkpKN0tGU0FMRjclMkYyMDIyMTIxMSUyRmV1LWNlbnRyYWwtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyMjEyMTFUMDAxODQ1WiZYLUFtei1FeHBpcmVzPTYwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZidWNrZXQ9dHktZXUtc3RvcmFnZTMwLXBpYyZ2PTEuMCZYLUFtei1TaWduYXR1cmU9MDU5ZDA2MGQ4ZjEzYTNmNWZmMjEzMTgxZjhjOTM2ZTkwYzdmYjRjOWYwZGJhOTJkN2NkMzcxZjRhMTA2YzM2NA=="
    }
  ]
}
[11-12-2022 01:18:42] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] Message received with wrong order.
[11-12-2022 01:18:42] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1670717921039
[11-12-2022 01:18:42] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] CurrentMessage: dataId = eff3b5b8-d44b-45e5-9e73-314b40842138, t = 1670717925
[11-12-2022 01:18:42] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[11-12-2022 01:18:42] [@0x5e/homebridge-tuya-platform] [TuyaOpenAPI] Request:
method = get
endpoint = https://openapi.tuyaeu.com
path = /v1.0/iot-03/devices/bf36b2aa6***********/status
query = undefined
headers = {
  "t": "1670717922091",
  "client_id": "sdvunmqp3**************",
  "nonce": "154fe953-2b3c-4c84-85c0-ce05************",
  "Signature-Headers": "client_id",
  "sign": "C30860FB0A9D018629FBBBE07****************",
  "sign_method": "HMAC-SHA256",
  "access_token": "c778ef81ae8c261*************",
  "lang": "en",
  "dev_lang": "javascript",
  "dev_channel": "homebridge",
  "devVersion": "1.7.0-beta.4"
}
body = null
[11-12-2022 01:18:42] [@0x5e/homebridge-tuya-platform] [TuyaOpenAPI] Response:
path = /v1.0/iot-03/devices/bf36b2************/status
data = {
  "result": [
    {
      "code": "basic_indicator",
      "value": true
    },
    {
      "code": "basic_flip",
      "value": false
    },
    {
      "code": "basic_osd",
      "value": true
    },
    {
      "code": "motion_sensitivity",
      "value": "1"
    },
    {
      "code": "basic_nightvision",
      "value": "0"
    },
    {
      "code": "sd_storge",
      "value": "61867008|16108544|45758464"
    },
    {
      "code": "sd_status",
      "value": 1
    },
    {
      "code": "sd_format",
      "value": true
    },
    {
      "code": "movement_detect_pic",
      "value": "eyJidWNrZXQiOiJ0eS1ldS1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi81ZjdmNjAtMTIzNDgzNDItcHAwMWNmY2NhZDdmZDY1NGVkMTEvZGV0ZWN0LzE2NzA3MTc4MjYuanBlZz9wYXJhbT1JSWZCVGZ5T1R5M3B5cWZJS2MvekZhekdNZ1kvMmo5ME04WHZHNEluRHVNPSIsIiJdXSwidiI6IjMuMCJ9"
    },
    {
      "code": "sd_format_state",
      "value": 100
    },
    {
      "code": "motion_switch",
      "value": true
    },
    {
      "code": "doorbell_active",
      "value": "1670717924"
    },
    {
      "code": "record_switch",
      "value": true
    },
    {
      "code": "record_mode",
      "value": "2"
    },
    {
      "code": "doorbell_pic",
      "value": ""
    },
    {
      "code": "doorbell_ring_exist",
      "value": "1"
    },
    {
      "code": "chime_ring_tune",
      "value": "1"
    },
    {
      "code": "chime_ring_volume",
      "value": 100
    },
    {
      "code": "basic_device_volume",
      "value": 1
    },
    {
      "code": "chime_settings",
      "value": "3"
    },
    {
      "code": "motion_area_switch",
      "value": false
    },
    {
      "code": "motion_area",
      "value": ""
    },
    {
      "code": "alarm_message",
      "value": ""
    }
  ],
  "success": true,
  "t": 1670717922475,
  "tid": "5e45f4c778e911ed9486ea4e8069378d"
}
[11-12-2022 01:18:45] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/586cf0e0bbe75ec8e***************
protocol = 4
message = {
  "dataId": "e1477dfa-79d1-4de5-aa1a-6ba83b4cb466",
  "devId": "bf36b2aa6***********",
  "productKey": "***",
  "status": [
    {
      "115": "eyJ2IjoiMy4wIiwiYnVja2V0IjoidHktZXUtc3RvcmFnZTMwLXBpYyIsImZpbGVzIjpbWyIvNWY3ZjYwLTEyMzQ4MzQyLXBwMDFjZmNjYWQ3ZmQ2NTRlZDExL2RldGVjdC8xNjcwNzE3OTI4LmpwZWciLCI3NmNlZmFlNGIzODM0YzBkIl1dfQ==",
      "code": "movement_detect_pic",
      "t": "1670717929",
      "value": "eyJidWNrZXQiOiJ0eS1ldS1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi81ZjdmNjAtMTIzNDgzNDItcHAwMWNmY2NhZDdmZDY1NGVkMTEvZGV0ZWN0LzE2NzA3MTc5MjguanBlZz9wYXJhbT1seitkZERkOWdFOTF5M0RLYnEzTGRhekdNZ1kvMmo5ME04WHZHNEluRHVNPSIsIiJdXSwidiI6IjMuMCJ9"
    }
  ]
}

When I go live in the device app (Smart life): Maybe suitable info for two way talk integration and/or HKSV.

[11-12-2022 01:25:57] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/586cf0e0bbe********
protocol = 20
message = {
  "bizCode": "p2pSignal",
  "bizData": {
    "msg": {
      "tcp_token": {
        "urls": [
          "tcp4:3.69.54.194:1443"
        ],
        "credential": "gH8zE9bF5GPo5VV************=",
        "domain": "wework-2-eu.stream.iot-11.com",
        "sessionId": "bf36b2aa6650***************x",
        "username": "16707*******************"
..... +100 more lines... when intressted let me know.

Local working RTSP stream: "-rtsp_transport tcp -i rtsp://admin:admin@***.***.***.***:8554/Streaming/Channels/101"

Thank you both for your work! Hopefully with the beta update, my device will support

Thijsjuh92 commented 1 year ago

Hello @0x5e @ErrorErrorError

Unfortunatelly with the new beta update, the Tuya plugin crashes. see the below normal Homebridge log.

When i have grabbed the debug loggs, i'll forward these.

[14-12-2022 21:07:42] [@0x5e/homebridge-tuya-platform] Restarting Process...
[14-12-2022 21:07:45] [@0x5e/homebridge-tuya-platform] Launched child bridge with PID 31323
[14-12-2022 21:07:47] Registering platform '@0x5e/homebridge-tuya-platform.TuyaPlatform'
[14-12-2022 21:07:47] [@0x5e/homebridge-tuya-platform] Loaded @0x5e/homebridge-tuya-platform v1.7.0-beta.7 child bridge successfully
[14-12-2022 21:07:47] Loaded 9 cached accessories from cachedAccessories.*************.
[14-12-2022 21:07:47] [@0x5e/homebridge-tuya-platform] Loading accessory from cache: Deurbel 
[14-12-2022 21:07:47] [@0x5e/homebridge-tuya-platform] Log in to Tuya Cloud.
[14-12-2022 21:07:47] Homebridge v1.6.0 (HAP v0.11.0) (@0x5e/homebridge-tuya-platform) is running on port 43752.
[14-12-2022 21:07:47] [@0x5e/homebridge-tuya-platform] Start MQTT connection.
[14-12-2022 21:07:47] [@0x5e/homebridge-tuya-platform] Fetching home list.
[14-12-2022 21:07:47] [@0x5e/homebridge-tuya-platform] Got home_id=***********, name=******************
[14-12-2022 21:07:49] [@0x5e/homebridge-tuya-platform] Restoring existing accessory from cache: Deurbel 
AssertionError [ERR_ASSERTION]: props cannot be undefined when setting props
    at ProgrammableSwitchEvent.Characteristic.setProps (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1867:11)
    at configureProgrammableSwitchEvent (/usr/local/lib/node_modules/@0x5e/homebridge-tuya-platform/src/accessory/characteristic/ProgrammableSwitchEvent.ts:27:6)
    at CameraAccessory.configureDoorbell (/usr/local/lib/node_modules/@0x5e/homebridge-tuya-platform/src/accessory/CameraAccessory.ts:83:37)
    at CameraAccessory.configureServices (/usr/local/lib/node_modules/@0x5e/homebridge-tuya-platform/src/accessory/CameraAccessory.ts:26:10)
    at Function.createAccessory (/usr/local/lib/node_modules/@0x5e/homebridge-tuya-platform/src/accessory/AccessoryFactory.ts:152:55)
    at TuyaPlatform.addAccessory (/usr/local/lib/node_modules/@0x5e/homebridge-tuya-platform/src/platform.ts:337:40)
    at TuyaPlatform.initDevices (/usr/local/lib/node_modules/@0x5e/homebridge-tuya-platform/src/platform.ts:116:12)
    at HomebridgeAPI.<anonymous> (/usr/local/lib/node_modules/@0x5e/homebridge-tuya-platform/src/platform.ts:71:7)
[14-12-2022 21:07:50] [@0x5e/homebridge-tuya-platform] Child bridge process ended
[14-12-2022 21:07:50] [@0x5e/homebridge-tuya-platform] Process Ended. Code: 1, Signal: null
donavanbecker commented 1 year ago

@Thijsjuh92, can you also post your config?

ErrorErrorError commented 1 year ago

I think the issue is here is the way we set values for the programable switch is returning an empty prop. I'll submit a pull request later today.

0x5e commented 1 year ago

@Thijsjuh92 Mostly doorbell_ring_exist is a boolean value but your's is enum with range ['0', '1'], I've submit a fix #150, should be working now.

sadanro100 commented 1 year ago

Hi there, thank you very much for taking your time to put this together, I'd almost lost my hope since this plugin was abandoned by tuya.

I just tried it (v1.7.0-beta.8) and there are a couple of things to report.

1 - The camera feed makes a crackling noise which is not present when streaming using Home Assistant plugin. 2 - When I press the doorbell button I don't get any notifications in iOS, but a do get something in Homebridge's log:

[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671163946
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 3e4196e8-d432-4ed9-8904-595f36f5df64, t = 1671163944
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671163946
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 424098b4-d748-494f-ac6d-97a26e2e567c, t = 1671163944
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671163946
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 138d5630-06d8-4dcb-b61b-f5ad42c778d1, t = 1671163944
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671163946
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 5a559b1e-61f4-4675-8cae-b95c7518827a, t = 1671163944
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671163946
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = c21996d4-7b29-44d4-8c5c-beb46e48bddf, t = 1671163944
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671163946
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 36b0f737-0603-45be-8223-3b1500f8726f, t = 1671163944
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671163946
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 56ec8779-ee5c-4137-964b-c81a965ea3f3, t = 1671163944
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671163946
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 38dbfa7b-80cb-409f-afe5-8dd350316cc5, t = 1671163944
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671163946
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = dfb2f4c4-3563-47a0-8865-33b8c3f3bfac, t = 1671163944
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671163946
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = eceb3672-8b09-44cb-969e-9645aeabcf98, t = 1671163944
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671163946
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = e93a9483-da78-4626-a0b4-2b2b124bfbb6, t = 1671163944
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaDeviceManager] Unhandled mqtt message: bizCode = event_notify, bizData = {
  devId: 'eb5cf3d97be677ad8feh9u',
  edata: 'edbc67071671163944',
  etype: 'ac_doorbell'
}
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671163947240
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = f221c217-e834-4216-bf90-9cc219e5f00e, t = 1671163946
[16/12/2022, 01:12:27] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 01:12:28] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 01:12:28] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671163947240
[16/12/2022, 01:12:28] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 2564bde7-b2ad-4ee9-829f-da9f2e53ed1b, t = 1671163947
[16/12/2022, 01:12:28] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 01:12:28] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 01:12:28] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671163947240
[16/12/2022, 01:12:28] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = fde3029a-30fa-4737-909f-922a0a13419d, t = 1671163947
[16/12/2022, 01:12:28] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 01:12:28] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 01:12:28] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671163947240
[16/12/2022, 01:12:28] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 180479a8-8fba-43b6-9117-f0289a483787, t = 1671163947
[16/12/2022, 01:12:28] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 01:12:29] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 01:12:29] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671163947240
[16/12/2022, 01:12:29] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = dd06bb31-81a4-4d63-b3d8-fc78131f9101, t = 1671163948
[16/12/2022, 01:12:29] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 01:12:38] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 01:12:38] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671163947240
[16/12/2022, 01:12:38] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 48ccf066-ec65-4d7c-a625-eccbcf2a9c15, t = 1671163958
[16/12/2022, 01:12:38] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.

Let me know if I can help debugging.

0x5e commented 1 year ago

@sadanro100 please enable the debug mode, I'm not using event_notify because it's not easy to relate the camera's doorbell dp code. Thanks :)

The crackling noise, did you mean the noise repeatly every 15 seconds, same as the period that homekit fetch the snapshot?

ErrorErrorError commented 1 year ago

The crackling noise, did you mean the noise repeatly every 15 seconds, same as the period that homekit fetch the snapshot?

The crackling noise they are referring to is the noise on the stream, not on the device itself I assume. Might be a audio codec issue.

sadanro100 commented 1 year ago

@0x5e the noise I'm referring to is on the stream as @ErrorErrorError pointed out, I can record a sample if you like, but it's most likely related to codec, probably something to do with ffmpeg.

When I ring the bell with debug mode enabled, this is what I get:

[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 20
message = {
  "bizCode": "online",
  "bizData": {
    "time": 1671203781
  },
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "ts": 0
}
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "6955eb15-4236-4744-9208-8dd212c09877",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "101": true,
      "code": "basic_indicator",
      "t": "1671203779",
      "value": true
    }
  ]
}
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671203781
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 6955eb15-4236-4744-9208-8dd212c09877, t = 1671203779
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenAPI] Request:
method = get
endpoint = https://openapi.tuyaus.com
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
query = undefined
headers = {
  "t": "1671203781904",
  "client_id": "dr98r5um9jeasjp378wc",
  "nonce": "61e28e65-2684-4259-8b12-4d301f6a6da5",
  "Signature-Headers": "client_id",
  "sign": "45FB9A04DC995CAE9D517A83613D1847DCC82995DFE64CD3D5C33F6B8BC31672",
  "sign_method": "HMAC-SHA256",
  "access_token": "b384197d6b508dbda38236a0561bda5d",
  "lang": "en",
  "dev_lang": "javascript",
  "dev_channel": "homebridge",
  "devVersion": "1.7.0-beta.8"
}
body = null
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "2728b6f9-40b3-4498-ac37-2fea1e577e1f",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "103": false,
      "code": "basic_flip",
      "t": "1671203779",
      "value": false
    }
  ]
}
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671203781
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 2728b6f9-40b3-4498-ac37-2fea1e577e1f, t = 1671203779
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenAPI] Request:
method = get
endpoint = https://openapi.tuyaus.com
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
query = undefined
headers = {
  "t": "1671203781925",
  "client_id": "dr98r5um9jeasjp378wc",
  "nonce": "4a1116ad-3a4a-49df-85b5-0cb271f2223c",
  "Signature-Headers": "client_id",
  "sign": "524F7B74F45A94B3DE3F0B27C7BB7FDBB743AA4AA431AE811A8F0969D325699F",
  "sign_method": "HMAC-SHA256",
  "access_token": "b384197d6b508dbda38236a0561bda5d",
  "lang": "en",
  "dev_lang": "javascript",
  "dev_channel": "homebridge",
  "devVersion": "1.7.0-beta.8"
}
body = null
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "42288c6e-e027-4ccf-8593-17b3022ea140",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "168": true,
      "code": "motion_area_switch",
      "t": "1671203779",
      "value": true
    }
  ]
}
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671203781
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 42288c6e-e027-4ccf-8593-17b3022ea140, t = 1671203779
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenAPI] Request:
method = get
endpoint = https://openapi.tuyaus.com
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
query = undefined
headers = {
  "t": "1671203781944",
  "client_id": "dr98r5um9jeasjp378wc",
  "nonce": "7ffc3e1c-06a5-4a5f-bb54-4982802199b9",
  "Signature-Headers": "client_id",
  "sign": "C4CDFF2FC855870F93DB93748658CB2DE5EBA6879BFC0AF3013D42BE7D3676EF",
  "sign_method": "HMAC-SHA256",
  "access_token": "b384197d6b508dbda38236a0561bda5d",
  "lang": "en",
  "dev_lang": "javascript",
  "dev_channel": "homebridge",
  "devVersion": "1.7.0-beta.8"
}
body = null
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "61d420cd-3441-428b-b291-ba14dfd1c06c",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "104": true,
      "code": "basic_osd",
      "t": "1671203779",
      "value": true
    }
  ]
}
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671203781
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 61d420cd-3441-428b-b291-ba14dfd1c06c, t = 1671203779
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenAPI] Request:
method = get
endpoint = https://openapi.tuyaus.com
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
query = undefined
headers = {
  "t": "1671203781965",
  "client_id": "dr98r5um9jeasjp378wc",
  "nonce": "478689c8-f897-4e92-9d63-3b0bf1b9d477",
  "Signature-Headers": "client_id",
  "sign": "5CE37799D32FFC21773F7455DDAC7F1C654E8B57B31313A72F596FB11528CB8E",
  "sign_method": "HMAC-SHA256",
  "access_token": "b384197d6b508dbda38236a0561bda5d",
  "lang": "en",
  "dev_lang": "javascript",
  "dev_channel": "homebridge",
  "devVersion": "1.7.0-beta.8"
}
body = null
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "8e6b53eb-19c5-450d-92e6-2c827794ea48",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "152": "1",
      "code": "pir_switch",
      "t": "1671203779",
      "value": "1"
    }
  ]
}
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671203781
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 8e6b53eb-19c5-450d-92e6-2c827794ea48, t = 1671203779
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenAPI] Request:
method = get
endpoint = https://openapi.tuyaus.com
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
query = undefined
headers = {
  "t": "1671203781984",
  "client_id": "dr98r5um9jeasjp378wc",
  "nonce": "668cec67-965f-4db8-b0b0-d1b913762a56",
  "Signature-Headers": "client_id",
  "sign": "CD352C328CF686D4E14901F3361D30F59FF4949A979F1DAF19D6841B27CFB343",
  "sign_method": "HMAC-SHA256",
  "access_token": "b384197d6b508dbda38236a0561bda5d",
  "lang": "en",
  "dev_lang": "javascript",
  "dev_channel": "homebridge",
  "devVersion": "1.7.0-beta.8"
}
body = null
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "4f77d7d2-d10f-45af-99dd-ff8d83830e59",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "108": "0",
      "code": "basic_nightvision",
      "t": "1671203779",
      "value": "0"
    }
  ]
}
[16/12/2022, 12:16:22] [TuyaPlatform] [TuyaOpenAPI] Request:
method = get
endpoint = https://openapi.tuyaus.com
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
query = undefined
headers = {
  "t": "1671203781999",
  "client_id": "dr98r5um9jeasjp378wc",
  "nonce": "bdc2f58f-243e-4f05-a587-f52769542fca",
  "Signature-Headers": "client_id",
  "sign": "946287309D0A2595C037508BFEE4765DA2BC51678DE904ABBBBD44997F299635",
  "sign_method": "HMAC-SHA256",
  "access_token": "b384197d6b508dbda38236a0561bda5d",
  "lang": "en",
  "dev_lang": "javascript",
  "dev_channel": "homebridge",
  "devVersion": "1.7.0-beta.8"
}
body = null
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671203781
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 4f77d7d2-d10f-45af-99dd-ff8d83830e59, t = 1671203779
[16/12/2022, 12:16:21] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 12:16:22] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "fb60b6b8-afc5-4eac-964e-5a768fc6092e",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "169": "",
      "code": "motion_area",
      "t": "1671203779",
      "value": ""
    }
  ]
}
[16/12/2022, 12:16:22] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 12:16:22] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671203781
[16/12/2022, 12:16:22] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = fb60b6b8-afc5-4eac-964e-5a768fc6092e, t = 1671203779
[16/12/2022, 12:16:22] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 12:16:22] [TuyaPlatform] [TuyaOpenAPI] Request:
method = get
endpoint = https://openapi.tuyaus.com
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
query = undefined
headers = {
  "t": "1671203782019",
  "client_id": "dr98r5um9jeasjp378wc",
  "nonce": "da88d045-697c-4c5e-8018-b1d5459e454b",
  "Signature-Headers": "client_id",
  "sign": "49332D6700BF45F4388B5938B3AB82DD9F65280AA09F3A5434B15FC61ABBB91F",
  "sign_method": "HMAC-SHA256",
  "access_token": "b384197d6b508dbda38236a0561bda5d",
  "lang": "en",
  "dev_lang": "javascript",
  "dev_channel": "homebridge",
  "devVersion": "1.7.0-beta.8"
}
body = null
[16/12/2022, 12:16:22] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 20
message = {
  "bizCode": "event_notify",
  "bizData": {
    "devId": "eb5cf3d97be677ad8feh9u",
    "edata": "edbc67071671203779",
    "etype": "ac_doorbell"
  },
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "ts": 1671203781894,
  "uuid": "hsljada3c4f2107552fd"
}
[16/12/2022, 12:16:22] [TuyaPlatform] [TuyaDeviceManager] Unhandled mqtt message: bizCode = event_notify, bizData = {
  devId: 'eb5cf3d97be677ad8feh9u',
  edata: 'edbc67071671203779',
  etype: 'ac_doorbell'
}
[16/12/2022, 12:16:22] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "56936b34-cd4e-4695-afe4-069e55a3fa9a",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "146": "0",
      "code": "wireless_powermode",
      "t": "1671203781",
      "value": "0"
    }
  ]
}
[16/12/2022, 12:16:22] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 12:16:22] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671203781894
[16/12/2022, 12:16:22] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 56936b34-cd4e-4695-afe4-069e55a3fa9a, t = 1671203781
[16/12/2022, 12:16:22] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 12:16:22] [TuyaPlatform] [TuyaOpenAPI] Request:
method = get
endpoint = https://openapi.tuyaus.com
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
query = undefined
headers = {
  "t": "1671203782187",
  "client_id": "dr98r5um9jeasjp378wc",
  "nonce": "211b77b3-f81e-4518-b0c9-9ed02cf0e2ab",
  "Signature-Headers": "client_id",
  "sign": "8703033977CA3471862068EB8702E4DA447906B5A9443731F582A12B77112FCF",
  "sign_method": "HMAC-SHA256",
  "access_token": "b384197d6b508dbda38236a0561bda5d",
  "lang": "en",
  "dev_lang": "javascript",
  "dev_channel": "homebridge",
  "devVersion": "1.7.0-beta.8"
}
body = null
[16/12/2022, 12:16:22] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "21827dfa-4da0-4dc0-aed0-27090ec8294c",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "145": 78,
      "code": "wireless_electricity",
      "t": "1671203781",
      "value": 78
    }
  ]
}
[16/12/2022, 12:16:22] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 12:16:22] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671203781894
[16/12/2022, 12:16:22] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 21827dfa-4da0-4dc0-aed0-27090ec8294c, t = 1671203781
[16/12/2022, 12:16:22] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 12:16:22] [TuyaPlatform] [TuyaOpenAPI] Request:
method = get
endpoint = https://openapi.tuyaus.com
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
query = undefined
headers = {
  "t": "1671203782211",
  "client_id": "dr98r5um9jeasjp378wc",
  "nonce": "c2dfffbc-6e18-4d4a-9b21-392b24607714",
  "Signature-Headers": "client_id",
  "sign": "A72BC8649E07DC5F21882E222C06196DF50B3BA90DB9B6895CD944C36C477B6C",
  "sign_method": "HMAC-SHA256",
  "access_token": "b384197d6b508dbda38236a0561bda5d",
  "lang": "en",
  "dev_lang": "javascript",
  "dev_channel": "homebridge",
  "devVersion": "1.7.0-beta.8"
}
body = null
[16/12/2022, 12:16:22] [TuyaPlatform] [TuyaOpenAPI] Response:
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
data = {
  "result": [
    {
      "code": "basic_indicator",
      "value": true
    },
    {
      "code": "basic_flip",
      "value": false
    },
    {
      "code": "basic_osd",
      "value": true
    },
    {
      "code": "basic_nightvision",
      "value": "0"
    },
    {
      "code": "sd_storge",
      "value": "15540224|1515520|14024704"
    },
    {
      "code": "sd_status",
      "value": 1
    },
    {
      "code": "sd_format",
      "value": false
    },
    {
      "code": "movement_detect_pic",
      "value": "eyJidWNrZXQiOiJ0eS11cy1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi9mNWE5NTEtNzA1MDMyMjItaHNsamFkYTNjNGYyMTA3NTUyZmQvZGV0ZWN0LzE2NzEyMDE5ODMuanBlZz9wYXJhbT00RTNZYzltZTg3T1JIUWE1d292UDJjODZnNGVrcGFUTkQ0L3hPdDR0eHUwPSIsIiJdXSwidiI6IjMuMCJ9"
    },
    {
      "code": "sd_format_state",
      "value": -20000
    },
    {
      "code": "doorbell_active",
      "value": ""
    },
    {
      "code": "wireless_electricity",
      "value": 78
    },
    {
      "code": "wireless_powermode",
      "value": "0"
    },
    {
      "code": "wireless_lowpower",
      "value": 10
    },
    {
      "code": "wireless_awake",
      "value": false
    },
    {
      "code": "record_switch",
      "value": true
    },
    {
      "code": "record_mode",
      "value": "2"
    },
    {
      "code": "pir_switch",
      "value": "1"
    },
    {
      "code": "doorbell_pic",
      "value": ""
    },
    {
      "code": "device_restart",
      "value": false
    },
    {
      "code": "motion_area_switch",
      "value": true
    },
    {
      "code": "motion_area",
      "value": ""
    },
    {
      "code": "alarm_message",
      "value": "eyJ2IjoiMy4wIiwiZmlsZXMiOlt7ImRhdGEiOiI0NDllOGYwZWY4MGZhODg5NjJlYjY4YmIxMmYwZjE5NzNjZmI1N2I1NTMyZDQyZTE1Mzk1MzVlYjE4MTg3YTU1ODkwNzQzODZiNTEzYjA3ZTk4OTcwNzA5YWM5YjQ4ODk2ZjAzN2ExYmM0MDBhMjFkNTc0ZmU2NDVlYzg1N2MzZjE0MjVkNWUyMzI4M2ZmOGEwMWY3OTJiY2UwYzA3OGE2ZThjMjlhNDhlODEwM2YzZTg1YTY2ODdlZGIzOTg5ZDY4YjYzMmU3NTY5YmExMjQ3NjkwZDE4MmRmMjY4NWY5YyIsImtleUlkIjoiZGVmYXVsdCIsIml2IjoiZjgyMTQ0MTA0MGQzN2NhYjRhZjUyNjUxYjFiMjg5ODQifV0sImNtZCI6ImlwY19kb29yYmVsbCIsInR5cGUiOiJpbWFnZSJ9"
    }
  ],
  "success": true,
  "t": 1671203782852,
  "tid": "99b60d867d5411ed8864c6843b9bc2ab"
}
[16/12/2022, 12:16:22] [TuyaPlatform] [Video Campainha AGL ] Motion event: {"bucket":"ty-us-storage30-pic","files":[["/f5a951-70503222-hsljada3c4f2107552fd/detect/1671201983.jpeg?param=4E3Yc9me87ORHQa5wovP2c86g4ekpaTND4/xOt4txu0=",""]],"v":"3.0"}
[16/12/2022, 12:16:22] [TuyaPlatform] [TuyaOpenAPI] Response:
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
data = {
  "result": [
    {
      "code": "basic_indicator",
      "value": true
    },
    {
      "code": "basic_flip",
      "value": false
    },
    {
      "code": "basic_osd",
      "value": true
    },
    {
      "code": "basic_nightvision",
      "value": "0"
    },
    {
      "code": "sd_storge",
      "value": "15540224|1515520|14024704"
    },
    {
      "code": "sd_status",
      "value": 1
    },
    {
      "code": "sd_format",
      "value": false
    },
    {
      "code": "movement_detect_pic",
      "value": "eyJidWNrZXQiOiJ0eS11cy1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi9mNWE5NTEtNzA1MDMyMjItaHNsamFkYTNjNGYyMTA3NTUyZmQvZGV0ZWN0LzE2NzEyMDE5ODMuanBlZz9wYXJhbT00RTNZYzltZTg3T1JIUWE1d292UDJjODZnNGVrcGFUTkQ0L3hPdDR0eHUwPSIsIiJdXSwidiI6IjMuMCJ9"
    },
    {
      "code": "sd_format_state",
      "value": -20000
    },
    {
      "code": "doorbell_active",
      "value": ""
    },
    {
      "code": "wireless_electricity",
      "value": 78
    },
    {
      "code": "wireless_powermode",
      "value": "0"
    },
    {
      "code": "wireless_lowpower",
      "value": 10
    },
    {
      "code": "wireless_awake",
      "value": false
    },
    {
      "code": "record_switch",
      "value": true
    },
    {
      "code": "record_mode",
      "value": "2"
    },
    {
      "code": "pir_switch",
      "value": "1"
    },
    {
      "code": "doorbell_pic",
      "value": ""
    },
    {
      "code": "device_restart",
      "value": false
    },
    {
      "code": "motion_area_switch",
      "value": true
    },
    {
      "code": "motion_area",
      "value": ""
    },
    {
      "code": "alarm_message",
      "value": "eyJ2IjoiMy4wIiwiZmlsZXMiOlt7ImRhdGEiOiI4MTM5MDllMzE5MWE0MjA1ZTUwY2Q0M2U3YTM1YTQ2ZTcyYWRhNzg3YzIwZTg0YWNkZDVjZWZhOTI5ODliMDI1YmVhMzQzNzJjMmZmZTM0MDc3MGE3YTg4OTgzMjNkNGUxNjJiZTRiYTYxNmYyYzc0MGI0MjY1NDI2N2ZkMmRiMjBkN2IxM2ExYjkyNzk4MmE4YjVmZDUzYmJkYjI4MDA1Y2VlOTRjYzFkZTE3NGU1NmZhYTlhY2RmZTMzYmRjYjEyMjc2ZDE1NTc3NjIyMmU5ZjlhZjdkNjFmODU3ZWU3MiIsImtleUlkIjoiZGVmYXVsdCIsIml2IjoiMDg5ZDI1OTk2M2Q1NGI3ZTBhOTRjODZkZWI0ZTY5YzQifV0sImNtZCI6ImlwY19kb29yYmVsbCIsInR5cGUiOiJpbWFnZSJ9"
    }
  ],
  "success": true,
  "t": 1671203782853,
  "tid": "99bac0c07d5411ed8864c6843b9bc2ab"
}
[16/12/2022, 12:16:22] [TuyaPlatform] [Video Campainha AGL ] Motion event: {"bucket":"ty-us-storage30-pic","files":[["/f5a951-70503222-hsljada3c4f2107552fd/detect/1671201983.jpeg?param=4E3Yc9me87ORHQa5wovP2c86g4ekpaTND4/xOt4txu0=",""]],"v":"3.0"}
[16/12/2022, 12:16:22] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "6e241256-7d2b-4003-8e93-2d039936edd0",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "149": true,
      "code": "wireless_awake",
      "t": "1671203781",
      "value": true
    }
  ]
}
[16/12/2022, 12:16:23] [TuyaPlatform] [TuyaOpenAPI] Response:
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
data = {
  "result": [
    {
      "code": "basic_indicator",
      "value": true
    },
    {
      "code": "basic_flip",
      "value": false
    },
    {
      "code": "basic_osd",
      "value": true
    },
    {
      "code": "basic_nightvision",
      "value": "0"
    },
    {
      "code": "sd_storge",
      "value": "15540224|1515520|14024704"
    },
    {
      "code": "sd_status",
      "value": 1
    },
    {
      "code": "sd_format",
      "value": false
    },
    {
      "code": "movement_detect_pic",
      "value": "eyJidWNrZXQiOiJ0eS11cy1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi9mNWE5NTEtNzA1MDMyMjItaHNsamFkYTNjNGYyMTA3NTUyZmQvZGV0ZWN0LzE2NzEyMDE5ODMuanBlZz9wYXJhbT00RTNZYzltZTg3T1JIUWE1d292UDJjODZnNGVrcGFUTkQ0L3hPdDR0eHUwPSIsIiJdXSwidiI6IjMuMCJ9"
    },
    {
      "code": "sd_format_state",
      "value": -20000
    },
    {
      "code": "doorbell_active",
      "value": ""
    },
    {
      "code": "wireless_electricity",
      "value": 78
    },
    {
      "code": "wireless_powermode",
      "value": "0"
    },
    {
      "code": "wireless_lowpower",
      "value": 10
    },
    {
      "code": "wireless_awake",
      "value": false
    },
    {
      "code": "record_switch",
      "value": true
    },
    {
      "code": "record_mode",
      "value": "2"
    },
    {
      "code": "pir_switch",
      "value": "1"
    },
    {
      "code": "doorbell_pic",
      "value": ""
    },
    {
      "code": "device_restart",
      "value": false
    },
    {
      "code": "motion_area_switch",
      "value": true
    },
    {
      "code": "motion_area",
      "value": ""
    },
    {
      "code": "alarm_message",
      "value": "eyJ2IjoiMy4wIiwiZmlsZXMiOlt7ImRhdGEiOiJjMTFlNDk1MzQ1MjkyZmVhM2RmYWZjZWIwN2YxNmZjYTE2NDM1NDkyZWU5NTI4YTc2ODRiZjE4NmU2YmViYjdlYTk1NTMxNzhjYzM4NmFkYzljOGE1NDRlOTBhMDRkNWRmNmFkYzRhN2U1MGM4OTYxMjc5ZjNhODYwZWUzMjgxYTIxOGU4M2RkMmZjNDk4NzhhMTI0MWE2YmM5MDNjYzhkNGRkMWM5NzVjMmQzZTc0ODJhOGY5OTc2ZWZhNjIwMTc0NTg5YjRjYjlkMTdlNWJiNDQ0MzRiMDFiZmVkNDBlZiIsImtleUlkIjoiZGVmYXVsdCIsIml2IjoiNmI5YTE0OGQzYWVlOWIyZTQ2ZDAwZmQ3NmY5ZTA3YmIifV0sImNtZCI6ImlwY19kb29yYmVsbCIsInR5cGUiOiJpbWFnZSJ9"
    }
  ],
  "success": true,
  "t": 1671203782896,
  "tid": "99c0012f7d5411ed8864c6843b9bc2ab"
}
[16/12/2022, 12:16:23] [TuyaPlatform] [Video Campainha AGL ] Motion event: {"bucket":"ty-us-storage30-pic","files":[["/f5a951-70503222-hsljada3c4f2107552fd/detect/1671201983.jpeg?param=4E3Yc9me87ORHQa5wovP2c86g4ekpaTND4/xOt4txu0=",""]],"v":"3.0"}
[16/12/2022, 12:16:23] [TuyaPlatform] [TuyaOpenAPI] Response:
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
data = {
  "result": [
    {
      "code": "basic_indicator",
      "value": true
    },
    {
      "code": "basic_flip",
      "value": false
    },
    {
      "code": "basic_osd",
      "value": true
    },
    {
      "code": "basic_nightvision",
      "value": "0"
    },
    {
      "code": "sd_storge",
      "value": "15540224|1515520|14024704"
    },
    {
      "code": "sd_status",
      "value": 1
    },
    {
      "code": "sd_format",
      "value": false
    },
    {
      "code": "movement_detect_pic",
      "value": "eyJidWNrZXQiOiJ0eS11cy1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi9mNWE5NTEtNzA1MDMyMjItaHNsamFkYTNjNGYyMTA3NTUyZmQvZGV0ZWN0LzE2NzEyMDE5ODMuanBlZz9wYXJhbT00RTNZYzltZTg3T1JIUWE1d292UDJjODZnNGVrcGFUTkQ0L3hPdDR0eHUwPSIsIiJdXSwidiI6IjMuMCJ9"
    },
    {
      "code": "sd_format_state",
      "value": -20000
    },
    {
      "code": "doorbell_active",
      "value": ""
    },
    {
      "code": "wireless_electricity",
      "value": 78
    },
    {
      "code": "wireless_powermode",
      "value": "0"
    },
    {
      "code": "wireless_lowpower",
      "value": 10
    },
    {
      "code": "wireless_awake",
      "value": false
    },
    {
      "code": "record_switch",
      "value": true
    },
    {
      "code": "record_mode",
      "value": "2"
    },
    {
      "code": "pir_switch",
      "value": "1"
    },
    {
      "code": "doorbell_pic",
      "value": ""
    },
    {
      "code": "device_restart",
      "value": false
    },
    {
      "code": "motion_area_switch",
      "value": true
    },
    {
      "code": "motion_area",
      "value": ""
    },
    {
      "code": "alarm_message",
      "value": "eyJ2IjoiMy4wIiwiZmlsZXMiOlt7ImRhdGEiOiIyZTUwMGFkN2I4YWQ2YmZjOTRiNGIzZmNhMTI3OWMzZDBlZTdiODE5ZDgyMzc1YjlmZWRmZmQwNDQ1MmE0OGVhMjAzNDAxZWQxZWUyYzE4NWM3M2E4ZTkwZDUyNTBmNjE1YWM2NWEzOGZkZDE3NDg1NWQwOGVmMTU3Y2Q2OTM5ZjBiY2UzMWJjOWVmZmUxNzMxYjRmOTU3YjUxNGM1ZjBjYjBhMGFlOTVhMjYxODA3OWJmOTM2MjhkOGExZWJlODhlYjBhZThmZGUwYjM0NTYwNzhiYWI4M2QzZmM4MTQ2MiIsImtleUlkIjoiZGVmYXVsdCIsIml2IjoiZWRmNzg5ZjFjM2ExMDhlOTNiMDE0ZmYwYzI1YjNiYmMifV0sImNtZCI6ImlwY19kb29yYmVsbCIsInR5cGUiOiJpbWFnZSJ9"
    }
  ],
  "success": true,
  "t": 1671203782902,
  "tid": "99c2becc7d5411ed8864c6843b9bc2ab"
}
[16/12/2022, 12:16:23] [TuyaPlatform] [Video Campainha AGL ] Motion event: {"bucket":"ty-us-storage30-pic","files":[["/f5a951-70503222-hsljada3c4f2107552fd/detect/1671201983.jpeg?param=4E3Yc9me87ORHQa5wovP2c86g4ekpaTND4/xOt4txu0=",""]],"v":"3.0"}
[16/12/2022, 12:16:23] [TuyaPlatform] [TuyaOpenAPI] Response:
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
data = {
  "result": [
    {
      "code": "basic_indicator",
      "value": true
    },
    {
      "code": "basic_flip",
      "value": false
    },
    {
      "code": "basic_osd",
      "value": true
    },
    {
      "code": "basic_nightvision",
      "value": "0"
    },
    {
      "code": "sd_storge",
      "value": "15540224|1515520|14024704"
    },
    {
      "code": "sd_status",
      "value": 1
    },
    {
      "code": "sd_format",
      "value": false
    },
    {
      "code": "movement_detect_pic",
      "value": "eyJidWNrZXQiOiJ0eS11cy1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi9mNWE5NTEtNzA1MDMyMjItaHNsamFkYTNjNGYyMTA3NTUyZmQvZGV0ZWN0LzE2NzEyMDE5ODMuanBlZz9wYXJhbT00RTNZYzltZTg3T1JIUWE1d292UDJjODZnNGVrcGFUTkQ0L3hPdDR0eHUwPSIsIiJdXSwidiI6IjMuMCJ9"
    },
    {
      "code": "sd_format_state",
      "value": -20000
    },
    {
      "code": "doorbell_active",
      "value": ""
    },
    {
      "code": "wireless_electricity",
      "value": 78
    },
    {
      "code": "wireless_powermode",
      "value": "0"
    },
    {
      "code": "wireless_lowpower",
      "value": 10
    },
    {
      "code": "wireless_awake",
      "value": true
    },
    {
      "code": "record_switch",
      "value": true
    },
    {
      "code": "record_mode",
      "value": "2"
    },
    {
      "code": "pir_switch",
      "value": "1"
    },
    {
      "code": "doorbell_pic",
      "value": ""
    },
    {
      "code": "device_restart",
      "value": false
    },
    {
      "code": "motion_area_switch",
      "value": true
    },
    {
      "code": "motion_area",
      "value": ""
    },
    {
      "code": "alarm_message",
      "value": "eyJ2IjoiMy4wIiwiZmlsZXMiOlt7ImRhdGEiOiIzNGI4NTA1OWQwYmI3N2UwZTQzYTk2YTg3NzYxMjdlNWNlYzg5ZTQyMDEzNjdjNzBhMzBiYjkwMGY1NTk3OGNhNGZhMmFiM2IxMTg0MjkxNDIzZTczMTFjMjNiOTY0Yjc0NjA2MTdlMTVlMDJhOGEzMGYzNGY5OGViY2YzNmY3ZTg2YzM2ZTdmNGU0YzEzN2MyMTkxMmY4OTQ2OTFiMmM4MWMwYmJlNzY3YzQxMjI2YzAzOGIwMmMzNGMzN2Q0MDIzYzMwMzZjMTJiMTA5MjU5M2NkNTcxZDhlNWFlNWY0MSIsImtleUlkIjoiZGVmYXVsdCIsIml2IjoiYmQ5YTAzZGJhMTAxMTlkODQwYTVmYTZkNDI0ZTE3MzAifV0sImNtZCI6ImlwY19kb29yYmVsbCIsInR5cGUiOiJpbWFnZSJ9"
    }
  ],
  "success": true,
  "t": 1671203782927,
  "tid": "99c629317d5411ed87ecb6f336d87174"
}
[16/12/2022, 12:16:23] [TuyaPlatform] [Video Campainha AGL ] Motion event: {"bucket":"ty-us-storage30-pic","files":[["/f5a951-70503222-hsljada3c4f2107552fd/detect/1671201983.jpeg?param=4E3Yc9me87ORHQa5wovP2c86g4ekpaTND4/xOt4txu0=",""]],"v":"3.0"}
[16/12/2022, 12:16:23] [TuyaPlatform] [TuyaOpenAPI] Response:
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
data = {
  "result": [
    {
      "code": "basic_indicator",
      "value": true
    },
    {
      "code": "basic_flip",
      "value": false
    },
    {
      "code": "basic_osd",
      "value": true
    },
    {
      "code": "basic_nightvision",
      "value": "0"
    },
    {
      "code": "sd_storge",
      "value": "15540224|1515520|14024704"
    },
    {
      "code": "sd_status",
      "value": 1
    },
    {
      "code": "sd_format",
      "value": false
    },
    {
      "code": "movement_detect_pic",
      "value": "eyJidWNrZXQiOiJ0eS11cy1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi9mNWE5NTEtNzA1MDMyMjItaHNsamFkYTNjNGYyMTA3NTUyZmQvZGV0ZWN0LzE2NzEyMDE5ODMuanBlZz9wYXJhbT00RTNZYzltZTg3T1JIUWE1d292UDJjODZnNGVrcGFUTkQ0L3hPdDR0eHUwPSIsIiJdXSwidiI6IjMuMCJ9"
    },
    {
      "code": "sd_format_state",
      "value": -20000
    },
    {
      "code": "doorbell_active",
      "value": ""
    },
    {
      "code": "wireless_electricity",
      "value": 78
    },
    {
      "code": "wireless_powermode",
      "value": "0"
    },
    {
      "code": "wireless_lowpower",
      "value": 10
    },
    {
      "code": "wireless_awake",
      "value": true
    },
    {
      "code": "record_switch",
      "value": true
    },
    {
      "code": "record_mode",
      "value": "2"
    },
    {
      "code": "pir_switch",
      "value": "1"
    },
    {
      "code": "doorbell_pic",
      "value": ""
    },
    {
      "code": "device_restart",
      "value": false
    },
    {
      "code": "motion_area_switch",
      "value": true
    },
    {
      "code": "motion_area",
      "value": ""
    },
    {
      "code": "alarm_message",
      "value": "eyJ2IjoiMy4wIiwiZmlsZXMiOlt7ImRhdGEiOiJlZmNiMjc1YjI4ZjM2OTM5NDY1NTI5Y2FjZjU1M2U1NmQ5NWQzODE2MTJkOTNkZDI1MjZhZmMzYjQ0YTBkMDg1NTdiOGZmMzZmM2QxYTA3MWJmZTY4NmVjN2VkNWMxMjBiODA3OTAyMWIxYTZjNmIwNTBiMGQ4MThkM2ViMDEzMzljMzIwYWFjODI0YTliOGMzYzQwZTkxYjg1ZDdkZWE1ZGYyNjYzNWVlMDUwZDM5MjVmNWJkNDFiYWVlNWFmODk2NDIzMjNjMmE5MWQxNmMwMjE4YTBjZjJkZGU1ZmIxYyIsImtleUlkIjoiZGVmYXVsdCIsIml2IjoiM2Q4ZmY4YTBhMzZmYjM1NjIwYjU3N2MxMjlkODA3YjEifV0sImNtZCI6ImlwY19kb29yYmVsbCIsInR5cGUiOiJpbWFnZSJ9"
    }
  ],
  "success": true,
  "t": 1671203782960,
  "tid": "99cbd72f7d5411ed87ecb6f336d87174"
}
[16/12/2022, 12:16:23] [TuyaPlatform] [Video Campainha AGL ] Motion event: {"bucket":"ty-us-storage30-pic","files":[["/f5a951-70503222-hsljada3c4f2107552fd/detect/1671201983.jpeg?param=4E3Yc9me87ORHQa5wovP2c86g4ekpaTND4/xOt4txu0=",""]],"v":"3.0"}
[16/12/2022, 12:16:23] [TuyaPlatform] [TuyaOpenAPI] Response:
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
data = {
  "result": [
    {
      "code": "basic_indicator",
      "value": true
    },
    {
      "code": "basic_flip",
      "value": false
    },
    {
      "code": "basic_osd",
      "value": true
    },
    {
      "code": "basic_nightvision",
      "value": "0"
    },
    {
      "code": "sd_storge",
      "value": "15540224|1515520|14024704"
    },
    {
      "code": "sd_status",
      "value": 1
    },
    {
      "code": "sd_format",
      "value": false
    },
    {
      "code": "movement_detect_pic",
      "value": "eyJidWNrZXQiOiJ0eS11cy1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi9mNWE5NTEtNzA1MDMyMjItaHNsamFkYTNjNGYyMTA3NTUyZmQvZGV0ZWN0LzE2NzEyMDE5ODMuanBlZz9wYXJhbT00RTNZYzltZTg3T1JIUWE1d292UDJjODZnNGVrcGFUTkQ0L3hPdDR0eHUwPSIsIiJdXSwidiI6IjMuMCJ9"
    },
    {
      "code": "sd_format_state",
      "value": -20000
    },
    {
      "code": "doorbell_active",
      "value": ""
    },
    {
      "code": "wireless_electricity",
      "value": 78
    },
    {
      "code": "wireless_powermode",
      "value": "0"
    },
    {
      "code": "wireless_lowpower",
      "value": 10
    },
    {
      "code": "wireless_awake",
      "value": true
    },
    {
      "code": "record_switch",
      "value": true
    },
    {
      "code": "record_mode",
      "value": "2"
    },
    {
      "code": "pir_switch",
      "value": "1"
    },
    {
      "code": "doorbell_pic",
      "value": ""
    },
    {
      "code": "device_restart",
      "value": false
    },
    {
      "code": "motion_area_switch",
      "value": true
    },
    {
      "code": "motion_area",
      "value": ""
    },
    {
      "code": "alarm_message",
      "value": "eyJ2IjoiMy4wIiwiZmlsZXMiOlt7ImRhdGEiOiJkMzY0Zjg5Yjg0YTI3ZGY1MzdmZGUzMGUxMjcyNzUyZDE4ZmJhNWY0ODNjZGQzMmY1MzFlZWEzZDVhNTQ0OGUzMDVhOWZkYzZlMmUwZjE0YjczYjJkYTNiOTllYTE4OTJkZThiZjlhMTViOTgzN2FlODMxYzY5OTIyNjNhMTliOTZmN2Y0NTVhNmU3OWZkMTVjNGU4N2Y2YmUzNDRkNThhM2M2OWRiZGY4YzEyYjQ5YjczYjMyMzRmNGJkMmZiYTk4OGRiYTcxMDU1MTdiYmZkODA4MDVlZDhiMzc5ZWNhNSIsImtleUlkIjoiZGVmYXVsdCIsIml2IjoiNjk3YmVmNGZmZWQ2YTIyYjFmNmNkYmY4ZThkNDE5ZWIifV0sImNtZCI6ImlwY19kb29yYmVsbCIsInR5cGUiOiJpbWFnZSJ9"
    }
  ],
  "success": true,
  "t": 1671203782996,
  "tid": "99d047fc7d5411ed8b31260268243644"
}
[16/12/2022, 12:16:23] [TuyaPlatform] [Video Campainha AGL ] Motion event: {"bucket":"ty-us-storage30-pic","files":[["/f5a951-70503222-hsljada3c4f2107552fd/detect/1671201983.jpeg?param=4E3Yc9me87ORHQa5wovP2c86g4ekpaTND4/xOt4txu0=",""]],"v":"3.0"}
[16/12/2022, 12:16:23] [TuyaPlatform] [TuyaOpenAPI] Response:
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
data = {
  "result": [
    {
      "code": "basic_indicator",
      "value": true
    },
    {
      "code": "basic_flip",
      "value": false
    },
    {
      "code": "basic_osd",
      "value": true
    },
    {
      "code": "basic_nightvision",
      "value": "0"
    },
    {
      "code": "sd_storge",
      "value": "15540224|1515520|14024704"
    },
    {
      "code": "sd_status",
      "value": 1
    },
    {
      "code": "sd_format",
      "value": false
    },
    {
      "code": "movement_detect_pic",
      "value": "eyJidWNrZXQiOiJ0eS11cy1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi9mNWE5NTEtNzA1MDMyMjItaHNsamFkYTNjNGYyMTA3NTUyZmQvZGV0ZWN0LzE2NzEyMDE5ODMuanBlZz9wYXJhbT00RTNZYzltZTg3T1JIUWE1d292UDJjODZnNGVrcGFUTkQ0L3hPdDR0eHUwPSIsIiJdXSwidiI6IjMuMCJ9"
    },
    {
      "code": "sd_format_state",
      "value": -20000
    },
    {
      "code": "doorbell_active",
      "value": ""
    },
    {
      "code": "wireless_electricity",
      "value": 78
    },
    {
      "code": "wireless_powermode",
      "value": "0"
    },
    {
      "code": "wireless_lowpower",
      "value": 10
    },
    {
      "code": "wireless_awake",
      "value": true
    },
    {
      "code": "record_switch",
      "value": true
    },
    {
      "code": "record_mode",
      "value": "2"
    },
    {
      "code": "pir_switch",
      "value": "1"
    },
    {
      "code": "doorbell_pic",
      "value": ""
    },
    {
      "code": "device_restart",
      "value": false
    },
    {
      "code": "motion_area_switch",
      "value": true
    },
    {
      "code": "motion_area",
      "value": ""
    },
    {
      "code": "alarm_message",
      "value": "eyJ2IjoiMy4wIiwiZmlsZXMiOlt7ImRhdGEiOiI0YjE1ZDRmMjNiYmY4M2RiZTVmYjBhZDNjOTAyNzZjOTI2NDNiNjc4MDNmNThiNjg5NjU1NjNmY2I5Y2RkNTQ3MTg5MTFiMDA0OWFkOTIyZWY2ZWE0OGI5MmFlNmZhMmYzODdlMjhmMDVmNTBkOGZjZTdlMTJhYTNmNjFjMWU1MmVkY2EwNmU2NzM4YzQ0NmY5M2NmZmQ4OTQzMzQ5YmE5ZTE5NTc3NmEwOTU0OTc2YmUxYjdjMWQ4YjAwNmRjODZiN2E3ZTIxZTkwMDk2MWY0MjMxMGViNWUxMzM5NjE5YSIsImtleUlkIjoiZGVmYXVsdCIsIml2IjoiMTg0NDA3OGFhYmViYTE1ZDg3MjNmMjY2NmFkYmE4OWIifV0sImNtZCI6ImlwY19kb29yYmVsbCIsInR5cGUiOiJpbWFnZSJ9"
    }
  ],
  "success": true,
  "t": 1671203782986,
  "tid": "99cf62627d5411ed87ecb6f336d87174"
}
[16/12/2022, 12:16:23] [TuyaPlatform] [Video Campainha AGL ] Motion event: {"bucket":"ty-us-storage30-pic","files":[["/f5a951-70503222-hsljada3c4f2107552fd/detect/1671201983.jpeg?param=4E3Yc9me87ORHQa5wovP2c86g4ekpaTND4/xOt4txu0=",""]],"v":"3.0"}
[16/12/2022, 12:16:23] [TuyaPlatform] [TuyaOpenAPI] Response:
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
data = {
  "result": [
    {
      "code": "basic_indicator",
      "value": true
    },
    {
      "code": "basic_flip",
      "value": false
    },
    {
      "code": "basic_osd",
      "value": true
    },
    {
      "code": "basic_nightvision",
      "value": "0"
    },
    {
      "code": "sd_storge",
      "value": "15540224|1515520|14024704"
    },
    {
      "code": "sd_status",
      "value": 1
    },
    {
      "code": "sd_format",
      "value": false
    },
    {
      "code": "movement_detect_pic",
      "value": "eyJidWNrZXQiOiJ0eS11cy1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi9mNWE5NTEtNzA1MDMyMjItaHNsamFkYTNjNGYyMTA3NTUyZmQvZGV0ZWN0LzE2NzEyMDE5ODMuanBlZz9wYXJhbT00RTNZYzltZTg3T1JIUWE1d292UDJjODZnNGVrcGFUTkQ0L3hPdDR0eHUwPSIsIiJdXSwidiI6IjMuMCJ9"
    },
    {
      "code": "sd_format_state",
      "value": -20000
    },
    {
      "code": "doorbell_active",
      "value": ""
    },
    {
      "code": "wireless_electricity",
      "value": 78
    },
    {
      "code": "wireless_powermode",
      "value": "0"
    },
    {
      "code": "wireless_lowpower",
      "value": 10
    },
    {
      "code": "wireless_awake",
      "value": true
    },
    {
      "code": "record_switch",
      "value": true
    },
    {
      "code": "record_mode",
      "value": "2"
    },
    {
      "code": "pir_switch",
      "value": "1"
    },
    {
      "code": "doorbell_pic",
      "value": ""
    },
    {
      "code": "device_restart",
      "value": false
    },
    {
      "code": "motion_area_switch",
      "value": true
    },
    {
      "code": "motion_area",
      "value": ""
    },
    {
      "code": "alarm_message",
      "value": "eyJ2IjoiMy4wIiwiZmlsZXMiOlt7ImRhdGEiOiIxNTk0ZDE4YTU3NmJlMGE4Y2IwOGJkZTJmNTU1ZjQ2YmI3NzY1MGRhNWI3NzdiN2Q2NTMyY2M4MWM0MTdjNWE0NWJmNDYzMGFmYThhNTI3YTcyMDdkOTQ4ZGE5MzM5OWQ5OWE5ZTYxOGZiODk4ZDQ5MGQ5MzE1YzUyOGY4YTNmNTBjZDM0MzRkNzE3YzEyN2FjODE3ZDgzODM0YWNiOTdkN2Y1MjY2NjVhM2E3N2I5MzBkYTRhNDQyMTQ0OGIzNDVjYTZmY2JkY2QwODcyNzEyZmZkODQ3ZTZmODZmZTQ0ZiIsImtleUlkIjoiZGVmYXVsdCIsIml2IjoiZWM3M2YyYjg2MDY2MDlmN2FiYzRjZmMxNjQyNWE1ZDMifV0sImNtZCI6ImlwY19kb29yYmVsbCIsInR5cGUiOiJpbWFnZSJ9"
    }
  ],
  "success": true,
  "t": 1671203783038,
  "tid": "99d7e65d7d5411ed8b31260268243644"
}
[16/12/2022, 12:16:23] [TuyaPlatform] [Video Campainha AGL ] Motion event: {"bucket":"ty-us-storage30-pic","files":[["/f5a951-70503222-hsljada3c4f2107552fd/detect/1671201983.jpeg?param=4E3Yc9me87ORHQa5wovP2c86g4ekpaTND4/xOt4txu0=",""]],"v":"3.0"}
[16/12/2022, 12:16:24] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "1a1f8899-752d-489e-9bd6-2aa3f73c9a93",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "110": 1,
      "code": "sd_status",
      "t": "1671203784",
      "value": 1
    }
  ]
}
[16/12/2022, 12:16:24] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "03f32888-51ef-4231-a18e-c6cc0826faa0",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "150": true,
      "code": "record_switch",
      "t": "1671203784",
      "value": true
    }
  ]
}
[16/12/2022, 12:16:24] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "8f90fde0-4f7f-40d6-ae0a-3c51e4e2419e",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "109": "15540224|1515520|14024704",
      "code": "sd_storge",
      "t": "1671203784",
      "value": "15540224|1515520|14024704"
    }
  ]
}
[16/12/2022, 12:16:24] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "5a0e0388-299b-4ce5-a207-1d33dc3d8ef0",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "110": 1,
      "code": "sd_status",
      "t": "1671203784",
      "value": 1
    }
  ]
}
[16/12/2022, 12:16:24] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "18502bda-1b09-42ca-818b-4ef8fd766ecc",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "151": "2",
      "code": "record_mode",
      "t": "1671203784",
      "value": "2"
    }
  ]
}
[16/12/2022, 12:16:26] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 20
message = {
  "bizCode": "online",
  "bizData": {
    "time": 1671203785
  },
  "devId": "07010311ecfabc66bfc9",
  "productKey": "cweu5xn5kod6piyo",
  "ts": 0
}
[16/12/2022, 12:16:30] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "eccf8413-b4fc-4204-babb-2eaa9025eb39",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "185": "eyJ2IjoiMy4wIiwiYnVja2V0IjoidHktdXMtc3RvcmFnZTMwLXBpYyIsImNtZCI6ImlwY19kb29yYmVsbCIsInR5cGUiOiJpbWFnZSIsIndpdGgiOiJyZXNvdXJjZXMiLCJmaWxlcyI6W1siL2Y1YTk1MS03MDUwMzIyMi1oc2xqYWRhM2M0ZjIxMDc1NTJmZC9kZXRlY3QvMTY3MTIwMzc4My5qcGVnIiwiOTc4MTk4MTEyMWNhODYyMCJdXX0=",
      "code": "alarm_message",
      "t": "1671203789",
      "value": "eyJ2IjoiMy4wIiwiZmlsZXMiOlt7ImRhdGEiOiJjMDUzYjBkYjFlOTczY2IwYWNmNDFkY2MyNmI5NzE0MjFkYmU1ODZkNTc0MjQyMjIwMGUyMzJlOTVhYTcxNGZmMTg4OTc5ZDVjZDk2YTQ2YTA2MWUyN2Y5ODg0Zjc2OTMwYmM3M2EzNGFhZWZlMzViMWIwM2IxMzA1MjcwZjRmOGQyZTQ5ZWE3MGMzOTA1ODliMWFkMjFlNGJmNWI0OTVkY2ExYzQwZWM4OGNlMzA0ZjI5MjIyMjdiZTRiMjQyNWJmNDg4NTQ0MWVmNjJhY2FkYTEyNGYxMmVkNzU5ODNhNiIsImtleUlkIjoiZGVmYXVsdCIsIml2IjoiYTg1ZDZkNThjNjhkODZkMDlmMTVmMDIyNTA3MDc3YzkifV0sImNtZCI6ImlwY19kb29yYmVsbCIsInR5cGUiOiJpbWFnZSJ9"
    }
  ]
}
[16/12/2022, 12:16:38] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "4f52fc09-dc99-4546-848d-b995c6938dbd",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "149": false,
      "code": "wireless_awake",
      "t": "1671203797",
      "value": false
    }
  ]
}
[16/12/2022, 12:16:38] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 20
message = {
  "bizCode": "online",
  "bizData": {
    "time": 1671203798
  },
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "ts": 0
}
[16/12/2022, 12:16:40] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 20
message = {
  "bizCode": "online",
  "bizData": {
    "time": 1671203800
  },
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "ts": 0
}
[16/12/2022, 12:17:42] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 20
message = {
  "bizCode": "online",
  "bizData": {
    "time": 1671203862
  },
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "ts": 0
}
[16/12/2022, 12:17:42] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "704f75e9-bc6c-4af4-9c6b-33d30095a72c",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "101": true,
      "code": "basic_indicator",
      "t": "1671203861",
      "value": true
    }
  ]
}
[16/12/2022, 12:17:42] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 12:17:42] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671203862
[16/12/2022, 12:17:42] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 704f75e9-bc6c-4af4-9c6b-33d30095a72c, t = 1671203861
[16/12/2022, 12:17:42] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 12:17:42] [TuyaPlatform] [TuyaOpenAPI] Request:
method = get
endpoint = https://openapi.tuyaus.com
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
query = undefined
headers = {
  "t": "1671203862609",
  "client_id": "dr98r5um9jeasjp378wc",
  "nonce": "b9265b8c-50dd-4f3a-a55b-4892b65f838e",
  "Signature-Headers": "client_id",
  "sign": "030620DE83B88C151B769ED1797ADD45525D56AEA9B9ABD48D6EA9BCB67075B3",
  "sign_method": "HMAC-SHA256",
  "access_token": "b384197d6b508dbda38236a0561bda5d",
  "lang": "en",
  "dev_lang": "javascript",
  "dev_channel": "homebridge",
  "devVersion": "1.7.0-beta.8"
}
body = null
[16/12/2022, 12:17:42] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "f03bd44c-be3b-4e91-8953-56fccff9616e",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "103": false,
      "code": "basic_flip",
      "t": "1671203861",
      "value": false
    }
  ]
}
[16/12/2022, 12:17:42] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 12:17:42] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671203862
[16/12/2022, 12:17:42] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = f03bd44c-be3b-4e91-8953-56fccff9616e, t = 1671203861
[16/12/2022, 12:17:42] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 12:17:42] [TuyaPlatform] [TuyaOpenAPI] Request:
method = get
endpoint = https://openapi.tuyaus.com
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
query = undefined
headers = {
  "t": "1671203862637",
  "client_id": "dr98r5um9jeasjp378wc",
  "nonce": "7d94fe9a-d86e-443c-831a-4389a102f14f",
  "Signature-Headers": "client_id",
  "sign": "FEE0D95CE1F66E6DCA09D36B321A968C6B45C96B7FC4FAB473DCC1FF8EC1325A",
  "sign_method": "HMAC-SHA256",
  "access_token": "b384197d6b508dbda38236a0561bda5d",
  "lang": "en",
  "dev_lang": "javascript",
  "dev_channel": "homebridge",
  "devVersion": "1.7.0-beta.8"
}
body = null
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "79d86b49-4738-4d5a-9de5-fa7caef2651f",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "104": true,
      "code": "basic_osd",
      "t": "1671203861",
      "value": true
    }
  ]
}
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671203862
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 79d86b49-4738-4d5a-9de5-fa7caef2651f, t = 1671203861
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenAPI] Request:
method = get
endpoint = https://openapi.tuyaus.com
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
query = undefined
headers = {
  "t": "1671203863214",
  "client_id": "dr98r5um9jeasjp378wc",
  "nonce": "a548e32b-f0d1-44ed-bee9-189b5bb9956f",
  "Signature-Headers": "client_id",
  "sign": "5158C7138816E2F36E3F105F48DAAA9483AF783C257286638EECB24FD74A5E68",
  "sign_method": "HMAC-SHA256",
  "access_token": "b384197d6b508dbda38236a0561bda5d",
  "lang": "en",
  "dev_lang": "javascript",
  "dev_channel": "homebridge",
  "devVersion": "1.7.0-beta.8"
}
body = null
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "4cc6a6bd-7740-4f9f-aeb9-54da4ab11662",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "168": true,
      "code": "motion_area_switch",
      "t": "1671203861",
      "value": true
    }
  ]
}
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671203862
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 4cc6a6bd-7740-4f9f-aeb9-54da4ab11662, t = 1671203861
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenAPI] Request:
method = get
endpoint = https://openapi.tuyaus.com
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
query = undefined
headers = {
  "t": "1671203863237",
  "client_id": "dr98r5um9jeasjp378wc",
  "nonce": "77b49bd1-8285-4eee-bd37-10e2be35193e",
  "Signature-Headers": "client_id",
  "sign": "56C12AEA460A90C0D75049C89FB0C363B5F27480757D8496C1BC93E3CCC372E0",
  "sign_method": "HMAC-SHA256",
  "access_token": "b384197d6b508dbda38236a0561bda5d",
  "lang": "en",
  "dev_lang": "javascript",
  "dev_channel": "homebridge",
  "devVersion": "1.7.0-beta.8"
}
body = null
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "1513f2f5-d10f-4006-b4f7-3e7f638aa0b5",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "108": "0",
      "code": "basic_nightvision",
      "t": "1671203861",
      "value": "0"
    }
  ]
}
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671203862
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 1513f2f5-d10f-4006-b4f7-3e7f638aa0b5, t = 1671203861
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenAPI] Request:
method = get
endpoint = https://openapi.tuyaus.com
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
query = undefined
headers = {
  "t": "1671203863261",
  "client_id": "dr98r5um9jeasjp378wc",
  "nonce": "1e806f97-6ec6-4c3c-975f-a7fd409d76a8",
  "Signature-Headers": "client_id",
  "sign": "DC9CDF686891FC2A948B98FDDE679EF7B6A16A2FCFF6083F0D80C67F0A85A6D8",
  "sign_method": "HMAC-SHA256",
  "access_token": "b384197d6b508dbda38236a0561bda5d",
  "lang": "en",
  "dev_lang": "javascript",
  "dev_channel": "homebridge",
  "devVersion": "1.7.0-beta.8"
}
body = null
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "6d010286-1808-405c-b926-2df4f43c07ec",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "152": "1",
      "code": "pir_switch",
      "t": "1671203861",
      "value": "1"
    }
  ]
}
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671203862
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 6d010286-1808-405c-b926-2df4f43c07ec, t = 1671203861
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenAPI] Request:
method = get
endpoint = https://openapi.tuyaus.com
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
query = undefined
headers = {
  "t": "1671203863284",
  "client_id": "dr98r5um9jeasjp378wc",
  "nonce": "3128e1d8-1469-4ec6-8e18-810010531de4",
  "Signature-Headers": "client_id",
  "sign": "FD2757869F98FB11B11B8086DEE7221602BC984DF6729E5AD979B6BCAC14D4E7",
  "sign_method": "HMAC-SHA256",
  "access_token": "b384197d6b508dbda38236a0561bda5d",
  "lang": "en",
  "dev_lang": "javascript",
  "dev_channel": "homebridge",
  "devVersion": "1.7.0-beta.8"
}
body = null
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "204157f4-3843-41b5-9f55-d480ae92e8e6",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "149": true,
      "code": "wireless_awake",
      "t": "1671203861",
      "value": true
    }
  ]
}
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671203862
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 204157f4-3843-41b5-9f55-d480ae92e8e6, t = 1671203861
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenAPI] Request:
method = get
endpoint = https://openapi.tuyaus.com
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
query = undefined
headers = {
  "t": "1671203863303",
  "client_id": "dr98r5um9jeasjp378wc",
  "nonce": "4b7a86bf-1687-442b-9e98-65905bcd1886",
  "Signature-Headers": "client_id",
  "sign": "A1CF3F4BD1B31BCFFFD434679D430628ECBCDFCE4E17279DFEDFE58798B4C3C1",
  "sign_method": "HMAC-SHA256",
  "access_token": "b384197d6b508dbda38236a0561bda5d",
  "lang": "en",
  "dev_lang": "javascript",
  "dev_channel": "homebridge",
  "devVersion": "1.7.0-beta.8"
}
body = null
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "fbce3171-340b-441e-9bf2-d9b26a5670dd",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "169": "",
      "code": "motion_area",
      "t": "1671203861",
      "value": ""
    }
  ]
}
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671203862
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = fbce3171-340b-441e-9bf2-d9b26a5670dd, t = 1671203861
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenAPI] Request:
method = get
endpoint = https://openapi.tuyaus.com
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
query = undefined
headers = {
  "t": "1671203863318",
  "client_id": "dr98r5um9jeasjp378wc",
  "nonce": "5496a7a9-6ec2-4e1f-a138-56d7321ad602",
  "Signature-Headers": "client_id",
  "sign": "1F06FB7302D6F4FC2C7A0AAA3140A2BE2D5FDFF44E67E0B7399E0A57788976CD",
  "sign_method": "HMAC-SHA256",
  "access_token": "b384197d6b508dbda38236a0561bda5d",
  "lang": "en",
  "dev_lang": "javascript",
  "dev_channel": "homebridge",
  "devVersion": "1.7.0-beta.8"
}
body = null
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "24f11a01-21b5-49ae-bd11-36451c14cbe2",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "146": "0",
      "code": "wireless_powermode",
      "t": "1671203861",
      "value": "0"
    }
  ]
}
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671203862
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 24f11a01-21b5-49ae-bd11-36451c14cbe2, t = 1671203861
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenAPI] Request:
method = get
endpoint = https://openapi.tuyaus.com
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
query = undefined
headers = {
  "t": "1671203863332",
  "client_id": "dr98r5um9jeasjp378wc",
  "nonce": "684306c7-bddc-4996-917b-8b3604521858",
  "Signature-Headers": "client_id",
  "sign": "90124C9127AFAE4DE3BA294FD222FD36B823C75B8E2CB6B85219627C3046F998",
  "sign_method": "HMAC-SHA256",
  "access_token": "b384197d6b508dbda38236a0561bda5d",
  "lang": "en",
  "dev_lang": "javascript",
  "dev_channel": "homebridge",
  "devVersion": "1.7.0-beta.8"
}
body = null
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "9fed583e-a48e-42d9-a14e-39b1616877b5",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "145": 78,
      "code": "wireless_electricity",
      "t": "1671203861",
      "value": 78
    }
  ]
}
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] Message received with wrong order.
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671203862
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] CurrentMessage: dataId = 9fed583e-a48e-42d9-a14e-39b1616877b5, t = 1671203861
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenAPI] Request:
method = get
endpoint = https://openapi.tuyaus.com
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
query = undefined
headers = {
  "t": "1671203863346",
  "client_id": "dr98r5um9jeasjp378wc",
  "nonce": "51be81ea-2a6a-4e00-8da7-edc43b6bed75",
  "Signature-Headers": "client_id",
  "sign": "16D5D3D750199D8BCE931421C742CFBD3C0D7E72408352DE073FF90E605A0A4E",
  "sign_method": "HMAC-SHA256",
  "access_token": "b384197d6b508dbda38236a0561bda5d",
  "lang": "en",
  "dev_lang": "javascript",
  "dev_channel": "homebridge",
  "devVersion": "1.7.0-beta.8"
}
body = null
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 20
message = {
  "bizCode": "event_notify",
  "bizData": {
    "devId": "eb5cf3d97be677ad8feh9u",
    "edata": "edbc67071671203861",
    "etype": "ac_doorbell"
  },
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "ts": 1671203863164,
  "uuid": "hsljada3c4f2107552fd"
}
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaDeviceManager] Unhandled mqtt message: bizCode = event_notify, bizData = {
  devId: 'eb5cf3d97be677ad8feh9u',
  edata: 'edbc67071671203861',
  etype: 'ac_doorbell'
}
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenAPI] Response:
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
data = {
  "result": [
    {
      "code": "basic_indicator",
      "value": true
    },
    {
      "code": "basic_flip",
      "value": false
    },
    {
      "code": "basic_osd",
      "value": true
    },
    {
      "code": "basic_nightvision",
      "value": "0"
    },
    {
      "code": "sd_storge",
      "value": "15540224|1515520|14024704"
    },
    {
      "code": "sd_status",
      "value": 1
    },
    {
      "code": "sd_format",
      "value": false
    },
    {
      "code": "movement_detect_pic",
      "value": "eyJidWNrZXQiOiJ0eS11cy1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi9mNWE5NTEtNzA1MDMyMjItaHNsamFkYTNjNGYyMTA3NTUyZmQvZGV0ZWN0LzE2NzEyMDE5ODMuanBlZz9wYXJhbT00RTNZYzltZTg3T1JIUWE1d292UDJjODZnNGVrcGFUTkQ0L3hPdDR0eHUwPSIsIiJdXSwidiI6IjMuMCJ9"
    },
    {
      "code": "sd_format_state",
      "value": -20000
    },
    {
      "code": "doorbell_active",
      "value": ""
    },
    {
      "code": "wireless_electricity",
      "value": 78
    },
    {
      "code": "wireless_powermode",
      "value": "0"
    },
    {
      "code": "wireless_lowpower",
      "value": 10
    },
    {
      "code": "wireless_awake",
      "value": true
    },
    {
      "code": "record_switch",
      "value": true
    },
    {
      "code": "record_mode",
      "value": "2"
    },
    {
      "code": "pir_switch",
      "value": "1"
    },
    {
      "code": "doorbell_pic",
      "value": ""
    },
    {
      "code": "device_restart",
      "value": false
    },
    {
      "code": "motion_area_switch",
      "value": true
    },
    {
      "code": "motion_area",
      "value": ""
    },
    {
      "code": "alarm_message",
      "value": "eyJ2IjoiMy4wIiwiZmlsZXMiOlt7ImRhdGEiOiI0YmRjMTA0MThmOThmNWJiYWUxMzZiYjEwODUzMWZmZDhlNTBiY2UxYWFkYjgyMDVlODY2MzcxN2NhMWU5OTY3MTlhZTg5MzhjMmZmYzM0MTNiOWNmMTZjMzU0N2Y0NWRlMGNmMTQ2YjI4N2IzM2Y1NTdhOTY4ZGEwZjQ0ZWM2Yzk0ZDQ5NGRiOTdiNzVlZWM4NmI1MjIyOWFjYjRhMjZjZjIwZmI3ZWE0ZjEzNDFlMThjOTFmYjAxYzZkOGQ2MjU1N2E0NzIwNGVlYzQ1ZmIwZTIwMGE1MzQwMzljNzQ4OCIsImtleUlkIjoiZGVmYXVsdCIsIml2IjoiNzAxMjZjYmEwZDc1NjM0MjEwM2FmMTEzMmI4NDkzOTAifV0sImNtZCI6ImlwY19kb29yYmVsbCIsInR5cGUiOiJpbWFnZSJ9"
    }
  ],
  "success": true,
  "t": 1671203863311,
  "tid": "c9ae245c7d5411ed8b31260268243644"
}
[16/12/2022, 12:17:43] [TuyaPlatform] [Video Campainha AGL ] Motion event: {"bucket":"ty-us-storage30-pic","files":[["/f5a951-70503222-hsljada3c4f2107552fd/detect/1671201983.jpeg?param=4E3Yc9me87ORHQa5wovP2c86g4ekpaTND4/xOt4txu0=",""]],"v":"3.0"}
[16/12/2022, 12:17:43] [TuyaPlatform] [TuyaOpenAPI] Response:
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
data = {
  "result": [
    {
      "code": "basic_indicator",
      "value": true
    },
    {
      "code": "basic_flip",
      "value": false
    },
    {
      "code": "basic_osd",
      "value": true
    },
    {
      "code": "basic_nightvision",
      "value": "0"
    },
    {
      "code": "sd_storge",
      "value": "15540224|1515520|14024704"
    },
    {
      "code": "sd_status",
      "value": 1
    },
    {
      "code": "sd_format",
      "value": false
    },
    {
      "code": "movement_detect_pic",
      "value": "eyJidWNrZXQiOiJ0eS11cy1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi9mNWE5NTEtNzA1MDMyMjItaHNsamFkYTNjNGYyMTA3NTUyZmQvZGV0ZWN0LzE2NzEyMDE5ODMuanBlZz9wYXJhbT00RTNZYzltZTg3T1JIUWE1d292UDJjODZnNGVrcGFUTkQ0L3hPdDR0eHUwPSIsIiJdXSwidiI6IjMuMCJ9"
    },
    {
      "code": "sd_format_state",
      "value": -20000
    },
    {
      "code": "doorbell_active",
      "value": ""
    },
    {
      "code": "wireless_electricity",
      "value": 78
    },
    {
      "code": "wireless_powermode",
      "value": "0"
    },
    {
      "code": "wireless_lowpower",
      "value": 10
    },
    {
      "code": "wireless_awake",
      "value": true
    },
    {
      "code": "record_switch",
      "value": true
    },
    {
      "code": "record_mode",
      "value": "2"
    },
    {
      "code": "pir_switch",
      "value": "1"
    },
    {
      "code": "doorbell_pic",
      "value": ""
    },
    {
      "code": "device_restart",
      "value": false
    },
    {
      "code": "motion_area_switch",
      "value": true
    },
    {
      "code": "motion_area",
      "value": ""
    },
    {
      "code": "alarm_message",
      "value": "eyJ2IjoiMy4wIiwiZmlsZXMiOlt7ImRhdGEiOiIzOTBhM2E3MmEzOGIzMjAwNGU3NTQwZjJlYTJhOWYzOWZmZWJkZjFhMDkyNTc3MmU4NTU3ZDVmMjQxZWRkNmM5NjZmMWE2OTYzOTYyMDUxMDc2N2QyNjE5N2JjOTdiYjc4MjRkZDg5ZjY0YTg2YjU1ZTFlOGQ2ZGViODEzMjU1MDVkMWQ1NWM4MDE2NGEyM2QyODk2ZDFlYjdmMTA5MGI0ZGRlN2I5ZGFiMDhjMzQ0MGZmNDhjYWNkZTA1OTBlMTI4ZGQ2YTFiMTM1ZmU3NmFkMjU1NjMxY2ZmZWNlZjliNyIsImtleUlkIjoiZGVmYXVsdCIsIml2IjoiMjdkYjE0YmViYmRlN2Y0NTQ0ODViZTkzNTgzMmFlYjgifV0sImNtZCI6ImlwY19kb29yYmVsbCIsInR5cGUiOiJpbWFnZSJ9"
    }
  ],
  "success": true,
  "t": 1671203863520,
  "tid": "c9cf259d7d5411ed8864c6843b9bc2ab"
}
[16/12/2022, 12:17:43] [TuyaPlatform] [Video Campainha AGL ] Motion event: {"bucket":"ty-us-storage30-pic","files":[["/f5a951-70503222-hsljada3c4f2107552fd/detect/1671201983.jpeg?param=4E3Yc9me87ORHQa5wovP2c86g4ekpaTND4/xOt4txu0=",""]],"v":"3.0"}
[16/12/2022, 12:17:44] [TuyaPlatform] [TuyaOpenAPI] Response:
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
data = {
  "result": [
    {
      "code": "basic_indicator",
      "value": true
    },
    {
      "code": "basic_flip",
      "value": false
    },
    {
      "code": "basic_osd",
      "value": true
    },
    {
      "code": "basic_nightvision",
      "value": "0"
    },
    {
      "code": "sd_storge",
      "value": "15540224|1515520|14024704"
    },
    {
      "code": "sd_status",
      "value": 1
    },
    {
      "code": "sd_format",
      "value": false
    },
    {
      "code": "movement_detect_pic",
      "value": "eyJidWNrZXQiOiJ0eS11cy1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi9mNWE5NTEtNzA1MDMyMjItaHNsamFkYTNjNGYyMTA3NTUyZmQvZGV0ZWN0LzE2NzEyMDE5ODMuanBlZz9wYXJhbT00RTNZYzltZTg3T1JIUWE1d292UDJjODZnNGVrcGFUTkQ0L3hPdDR0eHUwPSIsIiJdXSwidiI6IjMuMCJ9"
    },
    {
      "code": "sd_format_state",
      "value": -20000
    },
    {
      "code": "doorbell_active",
      "value": ""
    },
    {
      "code": "wireless_electricity",
      "value": 78
    },
    {
      "code": "wireless_powermode",
      "value": "0"
    },
    {
      "code": "wireless_lowpower",
      "value": 10
    },
    {
      "code": "wireless_awake",
      "value": true
    },
    {
      "code": "record_switch",
      "value": true
    },
    {
      "code": "record_mode",
      "value": "2"
    },
    {
      "code": "pir_switch",
      "value": "1"
    },
    {
      "code": "doorbell_pic",
      "value": ""
    },
    {
      "code": "device_restart",
      "value": false
    },
    {
      "code": "motion_area_switch",
      "value": true
    },
    {
      "code": "motion_area",
      "value": ""
    },
    {
      "code": "alarm_message",
      "value": "eyJ2IjoiMy4wIiwiZmlsZXMiOlt7ImRhdGEiOiI4NWFkNzg0MmE5ZTQxMjAzYjUxMWE5NjA5NzU0NTc2OTQxZjcwZjcyMDcwZWQwYTQxYjhjY2I5OGRmOGRiNGY2MTJhNmE3ZGZkMTkzOTNhNDA3M2JiMGQwNTcxMWE5NWIyNTdhMzVkZGY1YTMzYTVmM2Q0OWQzMGFkYWEzMDc5ZDIwMDU0YTc4ZDgzYzNiMjc0NmE4NTJjMzQyYWQyMjg5Njc5ZWYxYTlkZTRlMTBhMmU2MmQ1NTBiYTNiODA5ZjdiMDc5OGFiNjJkMWM0OWNiOGRkNDc1NWVhNzc0ZWQ0OCIsImtleUlkIjoiZGVmYXVsdCIsIml2IjoiOGRlMjM3NjRkNTA2MWJkZGU0ZjFkOGY4NjJiY2NkY2YifV0sImNtZCI6ImlwY19kb29yYmVsbCIsInR5cGUiOiJpbWFnZSJ9"
    }
  ],
  "success": true,
  "t": 1671203863934,
  "tid": "ca0ae0547d5411ed8b31260268243644"
}
[16/12/2022, 12:17:44] [TuyaPlatform] [Video Campainha AGL ] Motion event: {"bucket":"ty-us-storage30-pic","files":[["/f5a951-70503222-hsljada3c4f2107552fd/detect/1671201983.jpeg?param=4E3Yc9me87ORHQa5wovP2c86g4ekpaTND4/xOt4txu0=",""]],"v":"3.0"}
[16/12/2022, 12:17:44] [TuyaPlatform] [TuyaOpenAPI] Response:
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
data = {
  "result": [
    {
      "code": "basic_indicator",
      "value": true
    },
    {
      "code": "basic_flip",
      "value": false
    },
    {
      "code": "basic_osd",
      "value": true
    },
    {
      "code": "basic_nightvision",
      "value": "0"
    },
    {
      "code": "sd_storge",
      "value": "15540224|1515520|14024704"
    },
    {
      "code": "sd_status",
      "value": 1
    },
    {
      "code": "sd_format",
      "value": false
    },
    {
      "code": "movement_detect_pic",
      "value": "eyJidWNrZXQiOiJ0eS11cy1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi9mNWE5NTEtNzA1MDMyMjItaHNsamFkYTNjNGYyMTA3NTUyZmQvZGV0ZWN0LzE2NzEyMDE5ODMuanBlZz9wYXJhbT00RTNZYzltZTg3T1JIUWE1d292UDJjODZnNGVrcGFUTkQ0L3hPdDR0eHUwPSIsIiJdXSwidiI6IjMuMCJ9"
    },
    {
      "code": "sd_format_state",
      "value": -20000
    },
    {
      "code": "doorbell_active",
      "value": ""
    },
    {
      "code": "wireless_electricity",
      "value": 78
    },
    {
      "code": "wireless_powermode",
      "value": "0"
    },
    {
      "code": "wireless_lowpower",
      "value": 10
    },
    {
      "code": "wireless_awake",
      "value": true
    },
    {
      "code": "record_switch",
      "value": true
    },
    {
      "code": "record_mode",
      "value": "2"
    },
    {
      "code": "pir_switch",
      "value": "1"
    },
    {
      "code": "doorbell_pic",
      "value": ""
    },
    {
      "code": "device_restart",
      "value": false
    },
    {
      "code": "motion_area_switch",
      "value": true
    },
    {
      "code": "motion_area",
      "value": ""
    },
    {
      "code": "alarm_message",
      "value": "eyJ2IjoiMy4wIiwiZmlsZXMiOlt7ImRhdGEiOiJjNjQ1OGJlNjVkZWNlOTM2MmJiMDU5MjM4MTM2YzEyNzFmZmI2YTBhMWZiNWRmNDZiNWVkYTliNGJiNTQ0NjhlMTk4NGNhYzEwNDM2NGQzZjdmNzg1MzFjMjhlZDAxZjFjODIyMTUxM2Q5MGNmZTQ2NjNmNThmZTdkZjE0ZmQ2YjFjYjQzOTEwNjlmM2RmZTMzNmRkNWIzODc2Y2UyOGNiNWMwMzViMmJhNmQ1M2I5NGQ2NjEwZTIyZjAyMGUzYzJlYTRhOTMwMjUyNDgyYTVkNGY4NzE1ZDJlOWZhZDgxYSIsImtleUlkIjoiZGVmYXVsdCIsIml2IjoiZTcxNzY4NWYwYTM3ZWEyZjliNDllNzg0NjA3MDQ2MGUifV0sImNtZCI6ImlwY19kb29yYmVsbCIsInR5cGUiOiJpbWFnZSJ9"
    }
  ],
  "success": true,
  "t": 1671203863937,
  "tid": "ca0e0bd17d5411ed8864c6843b9bc2ab"
}
[16/12/2022, 12:17:44] [TuyaPlatform] [Video Campainha AGL ] Motion event: {"bucket":"ty-us-storage30-pic","files":[["/f5a951-70503222-hsljada3c4f2107552fd/detect/1671201983.jpeg?param=4E3Yc9me87ORHQa5wovP2c86g4ekpaTND4/xOt4txu0=",""]],"v":"3.0"}
[16/12/2022, 12:17:44] [TuyaPlatform] [TuyaOpenAPI] Response:
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
data = {
  "result": [
    {
      "code": "basic_indicator",
      "value": true
    },
    {
      "code": "basic_flip",
      "value": false
    },
    {
      "code": "basic_osd",
      "value": true
    },
    {
      "code": "basic_nightvision",
      "value": "0"
    },
    {
      "code": "sd_storge",
      "value": "15540224|1515520|14024704"
    },
    {
      "code": "sd_status",
      "value": 1
    },
    {
      "code": "sd_format",
      "value": false
    },
    {
      "code": "movement_detect_pic",
      "value": "eyJidWNrZXQiOiJ0eS11cy1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi9mNWE5NTEtNzA1MDMyMjItaHNsamFkYTNjNGYyMTA3NTUyZmQvZGV0ZWN0LzE2NzEyMDE5ODMuanBlZz9wYXJhbT00RTNZYzltZTg3T1JIUWE1d292UDJjODZnNGVrcGFUTkQ0L3hPdDR0eHUwPSIsIiJdXSwidiI6IjMuMCJ9"
    },
    {
      "code": "sd_format_state",
      "value": -20000
    },
    {
      "code": "doorbell_active",
      "value": ""
    },
    {
      "code": "wireless_electricity",
      "value": 78
    },
    {
      "code": "wireless_powermode",
      "value": "0"
    },
    {
      "code": "wireless_lowpower",
      "value": 10
    },
    {
      "code": "wireless_awake",
      "value": true
    },
    {
      "code": "record_switch",
      "value": true
    },
    {
      "code": "record_mode",
      "value": "2"
    },
    {
      "code": "pir_switch",
      "value": "1"
    },
    {
      "code": "doorbell_pic",
      "value": ""
    },
    {
      "code": "device_restart",
      "value": false
    },
    {
      "code": "motion_area_switch",
      "value": true
    },
    {
      "code": "motion_area",
      "value": ""
    },
    {
      "code": "alarm_message",
      "value": "eyJ2IjoiMy4wIiwiZmlsZXMiOlt7ImRhdGEiOiJjMTc3OWRkZDg2Y2EzYmEzNzdkMTQ5MmQ4ZjVlMDQ0Yjk4NjcxZDE5NGRkNTg4YzI3YThlNjMzYTg1ZjkwMGY2YjFkMzc3YTNiMmZlODAzYWIyOWY3ZmRlMTUwZGU0MDM3NTFlYTgzY2MxOTg3MzY4ODJkZjhmMDExNzgzOGQ4Y2M3ODBmNzVlZmM0ZjI3ZTlmZTliNWYzZGE4YWZhMTRiYTI3NmE2NDAzM2YyZGE4ZWY0NmVhYjFmNjUzNzZiZjNjNzcyZjQyNjlkNzhmMTAxNTIyYTdhMzllYjJjMDVjNSIsImtleUlkIjoiZGVmYXVsdCIsIml2IjoiZTY0N2ZjZTI2ZTM3ZmEwYzczN2MyZTU1ZTM0NzZlMWMifV0sImNtZCI6ImlwY19kb29yYmVsbCIsInR5cGUiOiJpbWFnZSJ9"
    }
  ],
  "success": true,
  "t": 1671203863966,
  "tid": "ca13271d7d5411ed8864c6843b9bc2ab"
}
[16/12/2022, 12:17:44] [TuyaPlatform] [Video Campainha AGL ] Motion event: {"bucket":"ty-us-storage30-pic","files":[["/f5a951-70503222-hsljada3c4f2107552fd/detect/1671201983.jpeg?param=4E3Yc9me87ORHQa5wovP2c86g4ekpaTND4/xOt4txu0=",""]],"v":"3.0"}
[16/12/2022, 12:17:44] [TuyaPlatform] [TuyaOpenAPI] Response:
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
data = {
  "result": [
    {
      "code": "basic_indicator",
      "value": true
    },
    {
      "code": "basic_flip",
      "value": false
    },
    {
      "code": "basic_osd",
      "value": true
    },
    {
      "code": "basic_nightvision",
      "value": "0"
    },
    {
      "code": "sd_storge",
      "value": "15540224|1515520|14024704"
    },
    {
      "code": "sd_status",
      "value": 1
    },
    {
      "code": "sd_format",
      "value": false
    },
    {
      "code": "movement_detect_pic",
      "value": "eyJidWNrZXQiOiJ0eS11cy1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi9mNWE5NTEtNzA1MDMyMjItaHNsamFkYTNjNGYyMTA3NTUyZmQvZGV0ZWN0LzE2NzEyMDE5ODMuanBlZz9wYXJhbT00RTNZYzltZTg3T1JIUWE1d292UDJjODZnNGVrcGFUTkQ0L3hPdDR0eHUwPSIsIiJdXSwidiI6IjMuMCJ9"
    },
    {
      "code": "sd_format_state",
      "value": -20000
    },
    {
      "code": "doorbell_active",
      "value": ""
    },
    {
      "code": "wireless_electricity",
      "value": 78
    },
    {
      "code": "wireless_powermode",
      "value": "0"
    },
    {
      "code": "wireless_lowpower",
      "value": 10
    },
    {
      "code": "wireless_awake",
      "value": true
    },
    {
      "code": "record_switch",
      "value": true
    },
    {
      "code": "record_mode",
      "value": "2"
    },
    {
      "code": "pir_switch",
      "value": "1"
    },
    {
      "code": "doorbell_pic",
      "value": ""
    },
    {
      "code": "device_restart",
      "value": false
    },
    {
      "code": "motion_area_switch",
      "value": true
    },
    {
      "code": "motion_area",
      "value": ""
    },
    {
      "code": "alarm_message",
      "value": "eyJ2IjoiMy4wIiwiZmlsZXMiOlt7ImRhdGEiOiJmZmQ0N2FhMmRiMGVhOWM3YTE5M2VjMjlkZThhZWI4NWI5ZmM2M2FjZmI3ODIzOThhNDRkMzUzYTBkMmE1YWRjODQzZTExNmFkNTgxMDA5OTVkZjJiYzBhNDFhNDY2YWQ5NTc4YjI5Zjg3NjY3ZTY0Yzk0ZDEwYjQ3MGJmZmZmODY1ZWU5ZTM1NDIwN2E5MzUwNzdhYWM1OGU1MTA3ZjE1NjdlNTM3ZWJhOTBiZWJkZTRhMTJlMGRhN2MxNDRlYzZlYTdkMzFlOWY0YzgwODNjN2RiYTMwMDNjY2QxYWQ0MyIsImtleUlkIjoiZGVmYXVsdCIsIml2IjoiODgwOWQxMmM2NmZmMzljNDcyN2M1NGFlNWI0ZjY1NjQifV0sImNtZCI6ImlwY19kb29yYmVsbCIsInR5cGUiOiJpbWFnZSJ9"
    }
  ],
  "success": true,
  "t": 1671203863965,
  "tid": "ca1389ee7d5411ed87ecb6f336d87174"
}
[16/12/2022, 12:17:44] [TuyaPlatform] [Video Campainha AGL ] Motion event: {"bucket":"ty-us-storage30-pic","files":[["/f5a951-70503222-hsljada3c4f2107552fd/detect/1671201983.jpeg?param=4E3Yc9me87ORHQa5wovP2c86g4ekpaTND4/xOt4txu0=",""]],"v":"3.0"}
[16/12/2022, 12:17:44] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "31e2900e-59cb-492c-b757-76f4ec19a356",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "110": 1,
      "code": "sd_status",
      "t": "1671203862",
      "value": 1
    }
  ]
}
[16/12/2022, 12:17:44] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "e77e795e-844a-441b-b0bb-f50cd7f44aff",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "150": true,
      "code": "record_switch",
      "t": "1671203862",
      "value": true
    }
  ]
}
[16/12/2022, 12:17:44] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "344e0b36-e8c3-4ead-a374-4e8ca4c7fd33",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "109": "15540224|1515520|14024704",
      "code": "sd_storge",
      "t": "1671203862",
      "value": "15540224|1515520|14024704"
    }
  ]
}
[16/12/2022, 12:17:44] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "e1614e6e-5fc6-40d0-aa40-b64cf423eb27",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "110": 1,
      "code": "sd_status",
      "t": "1671203862",
      "value": 1
    }
  ]
}
[16/12/2022, 12:17:44] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "03ec7206-3344-4c1c-9f88-c016a05e01f6",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "151": "2",
      "code": "record_mode",
      "t": "1671203862",
      "value": "2"
    }
  ]
}
[16/12/2022, 12:17:44] [TuyaPlatform] [TuyaOpenAPI] Response:
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
data = {
  "result": [
    {
      "code": "basic_indicator",
      "value": true
    },
    {
      "code": "basic_flip",
      "value": false
    },
    {
      "code": "basic_osd",
      "value": true
    },
    {
      "code": "basic_nightvision",
      "value": "0"
    },
    {
      "code": "sd_storge",
      "value": "15540224|1515520|14024704"
    },
    {
      "code": "sd_status",
      "value": 1
    },
    {
      "code": "sd_format",
      "value": false
    },
    {
      "code": "movement_detect_pic",
      "value": "eyJidWNrZXQiOiJ0eS11cy1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi9mNWE5NTEtNzA1MDMyMjItaHNsamFkYTNjNGYyMTA3NTUyZmQvZGV0ZWN0LzE2NzEyMDE5ODMuanBlZz9wYXJhbT00RTNZYzltZTg3T1JIUWE1d292UDJjODZnNGVrcGFUTkQ0L3hPdDR0eHUwPSIsIiJdXSwidiI6IjMuMCJ9"
    },
    {
      "code": "sd_format_state",
      "value": -20000
    },
    {
      "code": "doorbell_active",
      "value": ""
    },
    {
      "code": "wireless_electricity",
      "value": 78
    },
    {
      "code": "wireless_powermode",
      "value": "0"
    },
    {
      "code": "wireless_lowpower",
      "value": 10
    },
    {
      "code": "wireless_awake",
      "value": true
    },
    {
      "code": "record_switch",
      "value": true
    },
    {
      "code": "record_mode",
      "value": "2"
    },
    {
      "code": "pir_switch",
      "value": "1"
    },
    {
      "code": "doorbell_pic",
      "value": ""
    },
    {
      "code": "device_restart",
      "value": false
    },
    {
      "code": "motion_area_switch",
      "value": true
    },
    {
      "code": "motion_area",
      "value": ""
    },
    {
      "code": "alarm_message",
      "value": "eyJ2IjoiMy4wIiwiZmlsZXMiOlt7ImRhdGEiOiJkYTcyYWI5YzE5N2M2NDY0MzNkM2Q0ZmQwNmQyMDAyZmMzYjljNGUzYzAwNDA3NTM4M2I0MjUzY2U2OTk1MWJlZDcyOGYzYzJhZWVjNGFlYjEzZTE5MjllZmY5ZGRlNzc1Yzc5NWI2YjYwYjkwMDZmYWYxODI4OWNjMjFlMjc5NDU2ODQzZmE0NmU3YmQ2ZDE4ZGZkYWQ4MGYzZGJjOTZiZjAyZjAxYzM3ZjkzOWE0ZWU4NTdjNjhmNDZhYWEzZDU5ZmQxOTU1N2JmZTI0ODViZWI2MjhiZTJmOGZmZDIxZiIsImtleUlkIjoiZGVmYXVsdCIsIml2IjoiZmI4NjE1NjA4MDg5YTc2Y2YyMzM5NmNmY2Q0ZTlmZmIifV0sImNtZCI6ImlwY19kb29yYmVsbCIsInR5cGUiOiJpbWFnZSJ9"
    }
  ],
  "success": true,
  "t": 1671203864134,
  "tid": "ca2e6f187d5411ed8b31260268243644"
}
[16/12/2022, 12:17:44] [TuyaPlatform] [Video Campainha AGL ] Motion event: {"bucket":"ty-us-storage30-pic","files":[["/f5a951-70503222-hsljada3c4f2107552fd/detect/1671201983.jpeg?param=4E3Yc9me87ORHQa5wovP2c86g4ekpaTND4/xOt4txu0=",""]],"v":"3.0"}
[16/12/2022, 12:17:44] [TuyaPlatform] [TuyaOpenAPI] Response:
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
data = {
  "result": [
    {
      "code": "basic_indicator",
      "value": true
    },
    {
      "code": "basic_flip",
      "value": false
    },
    {
      "code": "basic_osd",
      "value": true
    },
    {
      "code": "basic_nightvision",
      "value": "0"
    },
    {
      "code": "sd_storge",
      "value": "15540224|1515520|14024704"
    },
    {
      "code": "sd_status",
      "value": 1
    },
    {
      "code": "sd_format",
      "value": false
    },
    {
      "code": "movement_detect_pic",
      "value": "eyJidWNrZXQiOiJ0eS11cy1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi9mNWE5NTEtNzA1MDMyMjItaHNsamFkYTNjNGYyMTA3NTUyZmQvZGV0ZWN0LzE2NzEyMDE5ODMuanBlZz9wYXJhbT00RTNZYzltZTg3T1JIUWE1d292UDJjODZnNGVrcGFUTkQ0L3hPdDR0eHUwPSIsIiJdXSwidiI6IjMuMCJ9"
    },
    {
      "code": "sd_format_state",
      "value": -20000
    },
    {
      "code": "doorbell_active",
      "value": ""
    },
    {
      "code": "wireless_electricity",
      "value": 78
    },
    {
      "code": "wireless_powermode",
      "value": "0"
    },
    {
      "code": "wireless_lowpower",
      "value": 10
    },
    {
      "code": "wireless_awake",
      "value": true
    },
    {
      "code": "record_switch",
      "value": true
    },
    {
      "code": "record_mode",
      "value": "2"
    },
    {
      "code": "pir_switch",
      "value": "1"
    },
    {
      "code": "doorbell_pic",
      "value": ""
    },
    {
      "code": "device_restart",
      "value": false
    },
    {
      "code": "motion_area_switch",
      "value": true
    },
    {
      "code": "motion_area",
      "value": ""
    },
    {
      "code": "alarm_message",
      "value": "eyJ2IjoiMy4wIiwiZmlsZXMiOlt7ImRhdGEiOiIzNDY5N2FjNzZjMzlmMzFiMjNjYzMyNWUyZTExMDg5MTVlMzVjZTQyZDA1NGU3MjI2NGVmYWE4NzdlNTljODA1MTJjM2Y2NTQzNzBkNTkzZjA4ZmI1MTEzMWYzMGQ2NzRlOTJiZDZiZTVlMDIxY2IxNWFhNmRjMTQ5MjljZTRkZDhjZWE0MzcxN2U4NGI1Nzc3NWQ1NTMwYmM1ZTA5MzFkNDQ1YzYxZmI5ZWI0YzQxYjhhMTA1NGE4ZTA2MGI0YWYzZDhhOTU3MDllYzczZWJlOWJmZTU2OWJhZGM0ZDgwNSIsImtleUlkIjoiZGVmYXVsdCIsIml2IjoiMjkzMTUzYjE5YTk5ZDY1NTY4YjhlMzkyNTg0MGIwODkifV0sImNtZCI6ImlwY19kb29yYmVsbCIsInR5cGUiOiJpbWFnZSJ9"
    }
  ],
  "success": true,
  "t": 1671203864207,
  "tid": "ca38af127d5411ed8864c6843b9bc2ab"
}
[16/12/2022, 12:17:44] [TuyaPlatform] [Video Campainha AGL ] Motion event: {"bucket":"ty-us-storage30-pic","files":[["/f5a951-70503222-hsljada3c4f2107552fd/detect/1671201983.jpeg?param=4E3Yc9me87ORHQa5wovP2c86g4ekpaTND4/xOt4txu0=",""]],"v":"3.0"}
[16/12/2022, 12:17:44] [TuyaPlatform] [TuyaOpenAPI] Response:
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
data = {
  "result": [
    {
      "code": "basic_indicator",
      "value": true
    },
    {
      "code": "basic_flip",
      "value": false
    },
    {
      "code": "basic_osd",
      "value": true
    },
    {
      "code": "basic_nightvision",
      "value": "0"
    },
    {
      "code": "sd_storge",
      "value": "15540224|1515520|14024704"
    },
    {
      "code": "sd_status",
      "value": 1
    },
    {
      "code": "sd_format",
      "value": false
    },
    {
      "code": "movement_detect_pic",
      "value": "eyJidWNrZXQiOiJ0eS11cy1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi9mNWE5NTEtNzA1MDMyMjItaHNsamFkYTNjNGYyMTA3NTUyZmQvZGV0ZWN0LzE2NzEyMDE5ODMuanBlZz9wYXJhbT00RTNZYzltZTg3T1JIUWE1d292UDJjODZnNGVrcGFUTkQ0L3hPdDR0eHUwPSIsIiJdXSwidiI6IjMuMCJ9"
    },
    {
      "code": "sd_format_state",
      "value": -20000
    },
    {
      "code": "doorbell_active",
      "value": ""
    },
    {
      "code": "wireless_electricity",
      "value": 78
    },
    {
      "code": "wireless_powermode",
      "value": "0"
    },
    {
      "code": "wireless_lowpower",
      "value": 10
    },
    {
      "code": "wireless_awake",
      "value": true
    },
    {
      "code": "record_switch",
      "value": true
    },
    {
      "code": "record_mode",
      "value": "2"
    },
    {
      "code": "pir_switch",
      "value": "1"
    },
    {
      "code": "doorbell_pic",
      "value": ""
    },
    {
      "code": "device_restart",
      "value": false
    },
    {
      "code": "motion_area_switch",
      "value": true
    },
    {
      "code": "motion_area",
      "value": ""
    },
    {
      "code": "alarm_message",
      "value": "eyJ2IjoiMy4wIiwiZmlsZXMiOlt7ImRhdGEiOiI1NTBiMDY0MmU0MjY3MDFiMjk2ZmNkMDMxZGY2NDU3NzJiMjc4YjAzNTExMWM0MTMzOGMwZjYwMDlkYjBkZjcxNGEyYmIzMTQ2MWEyNTM0MzRkNGI2OTQwOTBjOGQ5N2UzMzMzZDRhYjM3YTY2MTM1YjYzY2YzN2Y1NDg3YTBjYWY0NzRhOWVhMzA2Mzk3ZGY5YjcxNmY1ZDBkOTg5OWU4MDVjNWU0YWQ3M2Y0M2RkMjRmOTZiMGZjNmViNzRjOTg5MmQwZTJkNzE3MzFlOTUzNGZmMzg4MmQ2ZmJhMGQwNyIsImtleUlkIjoiZGVmYXVsdCIsIml2IjoiY2UwYzJjZWFmMTY5ZmIwMDIyMjcwZDNkMDI0NmJmYTIifV0sImNtZCI6ImlwY19kb29yYmVsbCIsInR5cGUiOiJpbWFnZSJ9"
    }
  ],
  "success": true,
  "t": 1671203864235,
  "tid": "ca3dbcbf7d5411ed8b31260268243644"
}
[16/12/2022, 12:17:44] [TuyaPlatform] [Video Campainha AGL ] Motion event: {"bucket":"ty-us-storage30-pic","files":[["/f5a951-70503222-hsljada3c4f2107552fd/detect/1671201983.jpeg?param=4E3Yc9me87ORHQa5wovP2c86g4ekpaTND4/xOt4txu0=",""]],"v":"3.0"}
[16/12/2022, 12:17:44] [TuyaPlatform] [TuyaOpenAPI] Response:
path = /v1.0/iot-03/devices/eb5cf3d97be677ad8feh9u/status
data = {
  "result": [
    {
      "code": "basic_indicator",
      "value": true
    },
    {
      "code": "basic_flip",
      "value": false
    },
    {
      "code": "basic_osd",
      "value": true
    },
    {
      "code": "basic_nightvision",
      "value": "0"
    },
    {
      "code": "sd_storge",
      "value": "15540224|1515520|14024704"
    },
    {
      "code": "sd_status",
      "value": 1
    },
    {
      "code": "sd_format",
      "value": false
    },
    {
      "code": "movement_detect_pic",
      "value": "eyJidWNrZXQiOiJ0eS11cy1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi9mNWE5NTEtNzA1MDMyMjItaHNsamFkYTNjNGYyMTA3NTUyZmQvZGV0ZWN0LzE2NzEyMDE5ODMuanBlZz9wYXJhbT00RTNZYzltZTg3T1JIUWE1d292UDJjODZnNGVrcGFUTkQ0L3hPdDR0eHUwPSIsIiJdXSwidiI6IjMuMCJ9"
    },
    {
      "code": "sd_format_state",
      "value": -20000
    },
    {
      "code": "doorbell_active",
      "value": ""
    },
    {
      "code": "wireless_electricity",
      "value": 78
    },
    {
      "code": "wireless_powermode",
      "value": "0"
    },
    {
      "code": "wireless_lowpower",
      "value": 10
    },
    {
      "code": "wireless_awake",
      "value": true
    },
    {
      "code": "record_switch",
      "value": true
    },
    {
      "code": "record_mode",
      "value": "2"
    },
    {
      "code": "pir_switch",
      "value": "1"
    },
    {
      "code": "doorbell_pic",
      "value": ""
    },
    {
      "code": "device_restart",
      "value": false
    },
    {
      "code": "motion_area_switch",
      "value": true
    },
    {
      "code": "motion_area",
      "value": ""
    },
    {
      "code": "alarm_message",
      "value": "eyJ2IjoiMy4wIiwiZmlsZXMiOlt7ImRhdGEiOiI4NzYxMWFhOGQyMGI2OTkzYjQ2YTA0ZmQ3OTFkNmIzYWE2ZTQyMjEwNGEzM2M0ZDA1MDVmODA3ZWNiNDQ1MGZkZmZkNjU4MGVmZDQ4YjY4ZWMxZDVkYjM3OTg1MDRmYzM3NTNiMjM0MGY4ZGRlZGFmNmExNjhlZDllNTAwMGU5NzEyMmFjMTFlMzdiN2U2YTgzYzdmYzQ0ZWYyOTQ5NDZlMGRhYTUyYTU1NWYxNjczYmU4NmI1ZDhjYTk4MzE5Y2U1ZDA3MDgzODRmZDYyY2JkYmNlMTZiOGYyZjFiMTM3NiIsImtleUlkIjoiZGVmYXVsdCIsIml2IjoiZGY5NjU3OTEzZGNmYjY1MjQyMmY5YTRjMzEzZDlhNGMifV0sImNtZCI6ImlwY19kb29yYmVsbCIsInR5cGUiOiJpbWFnZSJ9"
    }
  ],
  "success": true,
  "t": 1671203864322,
  "tid": "ca4a602c7d5411ed87ecb6f336d87174"
}
[16/12/2022, 12:17:44] [TuyaPlatform] [Video Campainha AGL ] Motion event: {"bucket":"ty-us-storage30-pic","files":[["/f5a951-70503222-hsljada3c4f2107552fd/detect/1671201983.jpeg?param=4E3Yc9me87ORHQa5wovP2c86g4ekpaTND4/xOt4txu0=",""]],"v":"3.0"}
[16/12/2022, 12:17:44] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 20
message = {
  "bizCode": "online",
  "bizData": {
    "time": 1671203864
  },
  "devId": "07010311ecfabc66bfc9",
  "productKey": "cweu5xn5kod6piyo",
  "ts": 0
}
[16/12/2022, 12:17:48] [TuyaPlatform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/0bae77cae096a6758163ef02a3cbf1af
protocol = 4
message = {
  "dataId": "6aa8587a-6294-4c50-b3e5-5bccd8832707",
  "devId": "eb5cf3d97be677ad8feh9u",
  "productKey": "ybrhmoymnvtdnwie",
  "status": [
    {
      "185": "eyJ2IjoiMy4wIiwiYnVja2V0IjoidHktdXMtc3RvcmFnZTMwLXBpYyIsImNtZCI6ImlwY19kb29yYmVsbCIsInR5cGUiOiJpbWFnZSIsIndpdGgiOiJyZXNvdXJjZXMiLCJmaWxlcyI6W1siL2Y1YTk1MS03MDUwMzIyMi1oc2xqYWRhM2M0ZjIxMDc1NTJmZC9kZXRlY3QvMTY3MTIwMzg2NC5qcGVnIiwiMzUyYzQ5M2Y4ZmJmZmYwYyJdXX0=",
      "code": "alarm_message",
      "t": "1671203868",
      "value": "eyJ2IjoiMy4wIiwiZmlsZXMiOlt7ImRhdGEiOiJjYjkxODNiYjU0MTA5ZmM2Y2IwOWMwMzFjNjZlMmJhYTM5MjY4ODViZTMzNmY2YTgyMzJmMGRiOTVlZTg1NDRlYjkwODc2ZTkzOTNjYjY2MjFjMjMxNGI2MmJhNWJlOWUzNGFhMjZjM2I2ZmMxNjkwODczMDcyMDVmMGVmNjVmNWMwYmI4NDYwMzVhYTZlMThmZjc4NDg3YzcyOTY0NGY5MmQ2NGZjMTMxMWY3N2YzODhjNmU5MmNiMTFjMDMyYjQzNzllYjBjMTM0OGViMDZlMTQzNWZkMTRiODNhOTA2OCIsImtleUlkIjoiZGVmYXVsdCIsIml2IjoiMDE5ZTQ2ODY2YzczYWRhMDJmM2M3ZTdmNWVmYWRlMjUifV0sImNtZCI6ImlwY19kb29yYmVsbCIsInR5cGUiOiJpbWFnZSJ9"
    }
  ]
}
0x5e commented 1 year ago

@sadanro100 So the doorbell related status really not get updated, fine I will update the code later, we have to do some camera logic outside the camera accessory class...

ErrorErrorError commented 1 year ago

@sadanro100 So the doorbell related status really not get updated, fine I will update the code later, we have to do some camera logic outside the camera accessory class...

I'll fix the camera logic soon, and they have an alarm_message status and when a new updated value happens, then it means there is a doorbell ring. Some doorbells use that rather than doorbell_pic.

ErrorErrorError commented 1 year ago

@sadanro100

Can you test and see if my fork fixes your issues with doorbell notifications?

https://github.com/ErrorErrorError/homebridge-tuya-platform/tree/doorbell-fixes

sadanro100 commented 1 year ago

How do I test? Did you release a new beta version? Nothing popped up in homebridge

Thijsjuh92 commented 1 year ago

@Thijsjuh92 Mostly doorbell_ring_exist is a boolean value but your's is enum with range ['0', '1'], I've submit a fix #150, should be working now.

@0x5e & @ErrorErrorError Great work thank you both! Seems to working properly now, in test setup. There is only one unhandled message from mqtt, when pressing the doorbell:

[17-12-2022 00:06:45] [@0x5e/homebridge-tuya-platform] [TuyaDeviceManager] Unhandled mqtt message: bizCode = event notify, bizData = {devId:'b£*******************'
edata:'c9a1788b1671232006
etype:'doorbell'
}
[17-12-2022 00:06:46] [@0x5e/homebridge-tuya-platform] [Tuya0penMQ] Message received with wrong order.
[17-12-2022 00:06:46] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] LastMessage: 
dataId = undefined, 
t = 1671232005218
[17-12-2022 00:06:46] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] CurrentMessage: dataId = 00beb51d-e667-4232-ad
d5-8c************, t = 1671232007
[17-12-2022 00:06:46] [@0x5e/homebridg
e-tuya-platform] [TuyaOpenMQ] Fallback
to use API fetching the latest device status.
[17-12-2022 00:06:46] [@0x5e/homebridge-tuya-platform] [Deurbe1 ] Motion event: {"bucket" : "ty-eu-storage30-pic"
"files":[["/5£*****-12******42-pp*****cad7f d6*****d11/detect/167**********.jpeg?param=JXJYBrWOLOg75RqIy7exrLe1SMfLmRGGoq£HCh
5pj1Y="
""11, "v": "3.0"}
ErrorErrorError commented 1 year ago

@Thijsjuh92 Mostly doorbell_ring_exist is a boolean value but your's is enum with range ['0', '1'], I've submit a fix #150, should be working now.

@0x5e & @ErrorErrorError Great work thank you both! Seems to working properly now, in test setup. There is only one unhandled message from mqtt, when pressing the doorbell:

[17-12-2022 00:06:45] [@0x5e/homebridge-tuya-platform] [TuyaDeviceManager] Unhandled mqtt message: bizCode = event notify, bizData = {devId:'b£*******************'
edata:'c9a1788b1671232006
etype:'doorbell'
}
[17-12-2022 00:06:46] [@0x5e/homebridge-tuya-platform] [Tuya0penMQ] Message received with wrong order.
[17-12-2022 00:06:46] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] LastMessage: 
dataId = undefined, 
t = 1671232005218
[17-12-2022 00:06:46] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] CurrentMessage: dataId = 00beb51d-e667-4232-ad
d5-8c************, t = 1671232007
[17-12-2022 00:06:46] [@0x5e/homebridg
e-tuya-platform] [TuyaOpenMQ] Fallback
to use API fetching the latest device status.
[17-12-2022 00:06:46] [@0x5e/homebridge-tuya-platform] [Deurbe1 ] Motion event: {"bucket" : "ty-eu-storage30-pic"
"files":[["/5£*****-12******42-pp*****cad7f d6*****d11/detect/167**********.jpeg?param=JXJYBrWOLOg75RqIy7exrLe1SMfLmRGGoq£HCh
5pj1Y="
""11, "v": "3.0"}

Doorbell notifications are not working as of now. I released a fix that should fix notifications but it wont be published until tomorrow most likely.

Thijsjuh92 commented 1 year ago

@Thijsjuh92 Mostly doorbell_ring_exist is a boolean value but your's is enum with range ['0', '1'], I've submit a fix #150, should be working now.

@0x5e & @ErrorErrorError Great work thank you both! Seems to working properly now, in test setup. There is only one unhandled message from mqtt, when pressing the doorbell:


[17-12-2022 00:06:45] [@0x5e/homebridge-tuya-platform] [TuyaDeviceManager] Unhandled mqtt message: bizCode = event notify, bizData = {devId:'b£*******************'

edata:'c9a1788b1671232006

etype:'doorbell'

}

[17-12-2022 00:06:46] [@0x5e/homebridge-tuya-platform] [Tuya0penMQ] Message received with wrong order.

[17-12-2022 00:06:46] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] LastMessage: 

dataId = undefined, 

t = 1671232005218

[17-12-2022 00:06:46] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] CurrentMessage: dataId = 00beb51d-e667-4232-ad

d5-8c************, t = 1671232007

[17-12-2022 00:06:46] [@0x5e/homebridg

e-tuya-platform] [TuyaOpenMQ] Fallback

to use API fetching the latest device status.

[17-12-2022 00:06:46] [@0x5e/homebridge-tuya-platform] [Deurbe1 ] Motion event: {"bucket" : "ty-eu-storage30-pic"

"files":[["/5£*****-12******42-pp*****cad7f d6*****d11/detect/167**********.jpeg?param=JXJYBrWOLOg75RqIy7exrLe1SMfLmRGGoq£HCh

5pj1Y="

""11, "v": "3.0"}

Doorbell notifications are not working as of now. I released a fix that should fix notifications but it wont be published until tomorrow most likely.

@ErrorErrorError When i now press the doorbell, my HomePod rings and i get a snapshot notification on my phone and ipad. No worries at all, glad the first steps of the working plugin are made.🙌🏼 The upcoming days will start testing the doorbell, when mounted at the front door. Later on we might can check to add features like HKSV and Activity zone's etc. Just like Camera.UI.

ErrorErrorError commented 1 year ago

When i now press the doorbell, my HomePod rings and i get a snapshot notification on my phone and ipad.

@Thijsjuh92 Let's go! And just to confirm, this is working under my fork's version of the plugin or are you using the latest beta version of homebridge-tuya-platform?

Later on we might can check to add features like HKSV and Activity zone's etc. Just like Camera.UI.

@Thijsjuh92 HKSV is coming soon. ;)

Thijsjuh92 commented 1 year ago

@ErrorErrorError Currently running this version: @0x5e/homebridge-tuya-platform v1.7.0-beta.8

0x5e commented 1 year ago

Merged and released in v1.7.0-beta.9, please try @sadanro100

ErrorErrorError commented 1 year ago

@ErrorErrorError Currently running this version: @0x5e/homebridge-tuya-platform v1.7.0-beta.8

@Thijsjuh92 Can you verify if it still works well using v1.7.0-beta.9? Thanks!

Thijsjuh92 commented 1 year ago

@ErrorErrorError Currently running this version: @0x5e/homebridge-tuya-platform v1.7.0-beta.8

@Thijsjuh92 Can you verify if it still works well using v1.7.0-beta.9? Thanks!

@ErrorErrorError With beta.9 the doorbell doesn't ring my HomePod anymore. The Doorbell shows up with two accessories:

  1. Motion Switch (when this is one in Tuya Smart Home Motion Detection Alarm is set to on)
  2. Motion event Apple Home: image Tuya Smart Life app: image

The motion_switch should be connected i think to the Activity Notifications setting in Homekit: Also zone selection can be added here i think. image

There must be another switch to be created with the doorbell active event. Who's triggers the doorbell chime. When pressed the doorbell button, this log appears: image

With beta.8 the doorbell chime worked. Only the strange thing was it triggerd the motion switch, what ringed the doorbell. (doesn't seem right to me either)

ErrorErrorError commented 1 year ago

@Thijsjuh92 can you please upload logs with debug mode on, including whenever you do a doorbell press?

The changes that were made yesterday should've added more support to doorbells.

Thijsjuh92 commented 1 year ago

@ErrorErrorError Debug log when doorbell pressed:

[17-12-2022 15:07:24] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/586cf0e0bbe75e******************
protocol = 4
message = {
  "dataId": "085d******-7a31-4fea-8e5e-86***********",
  "devId": "bf36b2aa****************",
  "productKey": "lasivv**************",
  "status": [
    {
      "136": "1671286044",
      "code": "doorbell_active",
      "t": "1671286044",
      "value": "1671286044"
    }
  ]
}
[17-12-2022 15:07:24] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/586cf0e0bbe75ec8e8****************
protocol = 20
message = {
  "bizCode": "event_notify",
  "bizData": {
    "devId": "bf36b2aa6*************",
    "edata": "c9a1788b1671286044",
    "etype": "doorbell"
  },
  "devId": "bf36b2****************",
  "productKey": "lasivvb8cc*********",
  "ts": 1671286044958,
  "uuid": "pp01cfccad7*********"
}
[17-12-2022 15:07:25] [@0x5e/homebridge-tuya-platform] [TuyaDeviceManager] Unhandled mqtt message: bizCode = event_notify, bizData = {
  devId: 'bf36b2aa66**************,
  edata: 'c9a1788b1671286044',
  etype: 'doorbell'
}
[17-12-2022 15:07:25] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/586cf0e0bbe75ec8e8***************5
protocol = 4
message = {
  "dataId": "414dc6c2-72da-405d-b2a6-86e01d3924e1",
  "devId": "bf36b2*****************",
  "productKey": "lasivvb8c**********",
  "status": [
    {
      "154": "aHR0cHM6Ly90eS1ldS1zdG9yYWdlMzAtcGljLnMzLmV1LWNlbnRyYWwtMS5hbWF6b25hd3MuY29tLzVmN2Y2MC0xMjM0ODM0Mi1wcDAxY2ZjY2FkN2ZkNjU0ZWQxMS9kZXRlY3QvMTY3MTI4NjA0NC5qcGVnP1gtQW16LVNlY3VyaXR5LVRva2VuPUZ3b0daWEl2WVhkekVQaiUyRiUyRiUyRiUyRiUyRiUyRiUyRiUyRiUyRiUyRndFYURCc2RQNW92SWtvTGR3VFRSU0tGQXVTdFN6THJkRHRTdCUyRjFraDE2UXlodGh5Nnh2S3Y1ODBhMlVxVU9ucXlmTkZoQ0poJTJCYzJmY1ZEbGJPRkZmQWFhaFY2MHVlMmRRQVI2eHZucVJZMWtrVVdyaDJuV3FaSVg4cjFIcVJVeTJMUzVKM2lTWSUyRmZNc3FIT2pqVm4ya0NRTE5mSFNhalNhaGR5RzFxWFlHWW5CWm16OTdibjkyOVNETVhiYkVOeXdKRmElMkJmUzYzRWFuY21KSG9vJTJCT0l2amNXY0lhTmdmQW5tY1hFTGZkQkRxdmg1dFdKdWJ0OTJaJTJGbXNZSmklMkJyWXAxYjlqRyUyQlhabjJmMTNjNkpGVVo1WG9qJTJGMmJRQmk4bGZ3VW0yUXNkVDZ0S2hlY1djWXFmYzdTSVh3TCUyQlJ3N3lGcTFzZVM2VTRaWk5rblc3UFpCNVAyQkxySWVMWUFqM3o5dzlMamRWS2ZjeVJJd1IxenRTQ2lhN3ZPY0JqSXAxJTJGQiUyRmxLdDlXZVhqU1kxS255OWlTYnhrYnolMkIlMkZScFQwdDY5MWFnMWVWeVlodE1HYTdyQ0tjMWMlM0QmWC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BU0lBVVRQTVVKSko0WE5PWkpXNiUyRjIwMjIxMjE3JTJGZXUtY2VudHJhbC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDIyMTIxN1QxNDA3MjVaJlgtQW16LUV4cGlyZXM9NjAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmJ1Y2tldD10eS1ldS1zdG9yYWdlMzAtcGljJnY9MS4wJlgtQW16LVNpZ25hdHVyZT0zNmVkNDA0MTY1N2NjYzU0MTRmYjhlM2VhZTg3YmIwNzZjMzIzYTllYTQwNGE0OTJjZGI0MTYxMDEzNTNlNjFh",
      "code": "doorbell_pic",
      "t": "1671286045",
      "value": "aHR0cHM6Ly90eS1ldS1zdG9yYWdlMzAtcGljLnMzLmV1LWNlbnRyYWwtMS5hbWF6b25hd3MuY29tLzVmN2Y2MC0xMjM0ODM0Mi1wcDAxY2ZjY2FkN2ZkNjU0ZWQxMS9kZXRlY3QvMTY3MTI4NjA0NC5qcGVnP1gtQW16LVNlY3VyaXR5LVRva2VuPUZ3b0daWEl2WVhkekVQaiUyRiUyRiUyRiUyRiUyRiUyRiUyRiUyRiUyRiUyRndFYURCc2RQNW92SWtvTGR3VFRSU0tGQXVTdFN6THJkRHRTdCUyRjFraDE2UXlodGh5Nnh2S3Y1ODBhMlVxVU9ucXlmTkZoQ0poJTJCYzJmY1ZEbGJPRkZmQWFhaFY2MHVlMmRRQVI2eHZucVJZMWtrVVdyaDJuV3FaSVg4cjFIcVJVeTJMUzVKM2lTWSUyRmZNc3FIT2pqVm4ya0NRTE5mSFNhalNhaGR5RzFxWFlHWW5CWm16OTdibjkyOVNETVhiYkVOeXdKRmElMkJmUzYzRWFuY21KSG9vJTJCT0l2amNXY0lhTmdmQW5tY1hFTGZkQkRxdmg1dFdKdWJ0OTJaJTJGbXNZSmklMkJyWXAxYjlqRyUyQlhabjJmMTNjNkpGVVo1WG9qJTJGMmJRQmk4bGZ3VW0yUXNkVDZ0S2hlY1djWXFmYzdTSVh3TCUyQlJ3N3lGcTFzZVM2VTRaWk5rblc3UFpCNVAyQkxySWVMWUFqM3o5dzlMamRWS2ZjeVJJd1IxenRTQ2lhN3ZPY0JqSXAxJTJGQiUyRmxLdDlXZVhqU1kxS255OWlTYnhrYnolMkIlMkZScFQwdDY5MWFnMWVWeVlodE1HYTdyQ0tjMWMlM0QmWC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BU0lBVVRQTVVKSko0WE5PWkpXNiUyRjIwMjIxMjE3JTJGZXUtY2VudHJhbC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDIyMTIxN1QxNDA3MjVaJlgtQW16LUV4cGlyZXM9NjAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmJ1Y2tldD10eS1ldS1zdG9yYWdlMzAtcGljJnY9MS4wJlgtQW16LVNpZ25hdHVyZT0zNmVkNDA0MTY1N2NjYzU0MTRmYjhlM2VhZTg3YmIwNzZjMzIzYTllYTQwNGE0OTJjZGI0MTYxMDEzNTNlNjFh"
    }
  ]
}
[17-12-2022 15:07:25] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] Message received with wrong order.
[17-12-2022 15:07:25] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] LastMessage: dataId = undefined, t = 1671286044958
[17-12-2022 15:07:25] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] CurrentMessage: dataId = 414dc6c2-72da-405d-b2a6-86***********, t = 1671286045
[17-12-2022 15:07:25] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] Fallback to use API fetching the latest device status.
[17-12-2022 15:07:25] [@0x5e/homebridge-tuya-platform] [TuyaOpenAPI] Request:
method = get
endpoint = https://openapi.tuyaeu.com
path = /v1.0/iot-03/devices/bf36b2a***************/status
query = undefined
headers = {
  "t": "1671286045520",
  "client_id": "sdvunmqp3w***********",
  "nonce": "4107326a-66b1-4a8e-bbea-007ea2547dde",
  "Signature-Headers": "client_id",
  "sign": "E212D09A70FAD6B23E3CC9DCCCAB****************D393527FA4C",
  "sign_method": "HMAC-SHA256",
  "access_token": "481db42584aa1*****************",
  "lang": "en",
  "dev_lang": "javascript",
  "dev_channel": "homebridge",
  "devVersion": "1.7.0-beta.9"
}
body = null
[17-12-2022 15:07:26] [@0x5e/homebridge-tuya-platform] [TuyaOpenAPI] Response:
path = /v1.0/iot-03/devices/bf36b******************/status
data = {
  "result": [
    {
      "code": "basic_indicator",
      "value": true
    },
    {
      "code": "basic_flip",
      "value": false
    },
    {
      "code": "basic_osd",
      "value": true
    },
    {
      "code": "motion_sensitivity",
      "value": "1"
    },
    {
      "code": "basic_nightvision",
      "value": "0"
    },
    {
      "code": "sd_storge",
      "value": "0|0|0"
    },
    {
      "code": "sd_status",
      "value": 2
    },
    {
      "code": "sd_format",
      "value": true
    },
    {
      "code": "movement_detect_pic",
      "value": "eyJidWNrZXQiOiJ0eS1ldS1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi81ZjdmNjAtMTIzNDgzNDItcHAwMWNmY2NhZDdmZDY1NGVkMTEvZGV0ZWN0LzE2NzEyODQyOTAuanBlZz9wYXJhbT1tR3YxRE1DWDhocGh3QlZYVm91SHNYVlZmeDF6aG9LUFRuREcyaVNyYUdJPSIsIiJdXSwidiI6IjMuMCJ9"
    },
    {
      "code": "sd_format_state",
      "value": 100
    },
    {
      "code": "motion_switch",
      "value": false
    },
    {
      "code": "doorbell_active",
      "value": "1671286044"
    },
    {
      "code": "record_switch",
      "value": true
    },
    {
      "code": "record_mode",
      "value": "2"
    },
    {
      "code": "doorbell_pic",
      "value": ""
    },
    {
      "code": "doorbell_ring_exist",
      "value": "1"
    },
    {
      "code": "chime_ring_tune",
      "value": "1"
    },
    {
      "code": "chime_ring_volume",
      "value": 100
    },
    {
      "code": "basic_device_volume",
      "value": 10
    },
    {
      "code": "chime_settings",
      "value": "3"
    },
    {
      "code": "motion_area_switch",
      "value": false
    },
    {
      "code": "motion_area",
      "value": ""
    },
    {
      "code": "alarm_message",
      "value": ""
    }
  ],
  "success": true,
  "t": 1671286046060,
  "tid": "226b86437e1411edbe0bee4d76ea34cc"
}
[17-12-2022 15:07:33] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/586cf0e0bbe75ec8e************5
protocol = 4
message = {
  "dataId": "bb9e9cbd-9f8d-4a21-8d54-4*************",
  "devId": "bf36b2aa************",
  "productKey": "lasivv************",
  "status": [
    {
      "110": 5,
      "code": "sd_status",
      "t": "1671286053",
      "value": 5
    }
  ]
}
[17-12-2022 15:07:34] [@0x5e/homebridge-tuya-platform] [TuyaOpenMQ] onMessage:
topic = cloud/token/in/586cf0e0bbe75ec8e84cf27b***********
protocol = 435a37565
protocol = 4
message = {
  "dataId": "0f6e2f01-0de9-4ad5-8186-d3************",
  "devId": "bf36b2aa*****************",
  "productKey": "lasivvb**************",
  "status": [
    {
      "110": 2,
      "code": "sd_status",
      "t": "1671286054",
      "value": 2
    }
  ]
}
0x5e commented 1 year ago

It happends that the doorbell message followed with [TuyaOpenMQ] Message received with wrong order., so the value of doorbell_pic is dropped and we use http api get the latest status from cloud server. And this schema is much like a event, not a status, the server return the empty value, then this fire was ignored...

The MQTT message wrong order is really annoying, I will try to optimize the fallback logic, and in the future we will try use Pulsar instead. Please have more try, If the "wrong order" didn't happend when you push the doorbell button, I think It still can work.

ErrorErrorError commented 1 year ago

I see the issue now. You have both alarm_message and doorbell_pic in your status, but only doorbell_pic receives the notification.

The code is expecting alarm_message to be the doorbell ring notification since you have that status and also doorbell pic.

We can change the priority, I.e. move alarm_message behind doorbell_pic but some doorbells then might have both doorbell_pic and alarm_message and only send notifications to alarm_message, which will cause this issue again.

@0x5e I think one way to solve this is to check whenever a device status update occurs, check and see if the changed status array contains ay doorbell code and then get the value from there, rather than "expecting" a specific status code.

0x5e commented 1 year ago

@ErrorErrorError Oh yeah you are right, I think there are two issue combined together: The first is priority of alarm_message is higher than doorbell_pic, then we are always getting empty value. The second is even when we put alarm_message behind doorbell_pic, or we check both of those value, when "wrong order" happends (depends on the server side stability), the status will still be replaced with the newest value from http api. the value from api is always empty...

So, the first issue I will check both value instead. The second issue, I already have a plan, it's hard to describe, but I think would be better :)