Scott--R / Tailwind_Local_Control_API

13 stars 1 forks source link

Open event is POSTed twice? #4

Open nefilim opened 1 week ago

nefilim commented 1 week ago

Hi

When opening the door (from the app), I received the Open status event twice at my specified notification URL:

20:02:03.174 [io-compute-14] INFO org.home4s.tailwind.TailwindRoutes -- received status: DeviceStatus(OK,iQ3,_54_43_b2_7b_30_e0_,0.1,1,1,10.52,100,-66,Map(door1 -> DoorStatus(0,open,0,0)))
20:02:04.697 [io-compute-3] INFO org.home4s.tailwind.TailwindRoutes -- received status: DeviceStatus(OK,iQ3,_54_43_b2_7b_30_e0_,0.1,1,1,10.52,100,-65,Map(door1 -> DoorStatus(0,open,0,0)))

Is this to be expected?

devTW001 commented 5 days ago

@nefilim Would you please let me know the firmware version of your device ? (You may find it in Tailwind App) Also, what's the notification type, HTTP or UDP ?

nefilim commented 5 days ago

@devTW001 I'm on 10.52 using HTTP

devTW001 commented 4 days ago

@nefilim I have set up similar test environment on firmware v10.52, with local http notification enabled.

The device should only send one notification. In the notification message, there is a 'notify' field, along with other device status.

{"result": "OK","product": "iQ3","dev_id": "30_ae_a4_80_18_80","proto_ver": "0.1","door_num": 3,"night_mode_en": 1,"fw_ver": "10.10","ledbrightness": 10,"data": {"door1": {"index": 0,"status": "close","lockup": 0,"disabled": 0} ,"door2": {"index": 1,"status": "open","lockup": 0,"disabled": 0} ,"door3": {"index": 2,"status": "close","lockup": 0,"disabled": 0} }, **"notify": {"dooridx": 2,"event": "open"}** }

Maybe we should check whether both of the messages have that 'notify' field ? (Maybe there was a 'get device status' command sent right before opening the door ?)

nefilim commented 3 days ago

thanks for looking @devTW001, when I start my server application, I check the device status and set the status URL, then I open the garage door with via the Tailwind iOS app and then close it again via iOS app.

Here are my logs for this sequence of events:

13:53:09.513 [io-compute-2] INFO org.http4s.ember.server.EmberServerBuilderCompanionPlatform -- Ember-Server service bound to address: 192.168.100.5:8888
HTTP/1.1 POST http://tailwind-5443b27b30e0.local/json Headers(Content-Length: 55, Accept: application/json, TOKEN: <REDACTED>, Content-Type: application/json, Accept: application/json) body="{"version":"0.1","data":{"name":"dev_st","type":"get"}}"
HTTP/1.1 200 OK Headers(Content-Type: text/html, Content-Length: 255) body="{"result": "OK","product": "iQ3","dev_id": "_54_43_b2_7b_30_e0_","proto_ver": "0.1","door_num": 1,"night_mode_en": 1,"fw_ver": "10.52","led_brightness": 100,"router_rssi": -64
,"data": {"door1": {"index": 0,"status": "close","lockup": 0,"disabled": 0}
}}
"

HTTP/1.1 POST http://tailwind-5443b27b30e0.local/json Headers(Content-Length: 155, Accept: application/json, TOKEN: <REDACTED>, Content-Type: application/json, Accept: application/json) body="{"version":"0.1","product":"iQ3","data":{"name":"notify_url","type":"set","value":{"url":"http://192.168.100.5:8888/v0/status","proto":"http","enable":1}}}"
HTTP/1.1 200 OK Headers(Content-Type: text/html, Content-Length: 17) body="{"result": "OK"}
"

13:53:19.864 [io-compute-15] INFO org.home4s.tailwind.Test -- HTTP/1.1 POST /v0/status Headers(User-Agent: ESP32 HTTP Client/1.0, Host: 192.168.100.5:8888, Content-Type: application/json, Content-Length: 297) body="{"result": "OK","product": "iQ3","dev_id": "_54_43_b2_7b_30_e0_","proto_ver": "0.1","door_num": 1,"night_mode_en": 1,"fw_ver": "10.52","led_brightness": 100,"router_rssi": -63
,"data": {"door1": {"index": 0,"status": "open","lockup": 0,"disabled": 0}
},"notify": {"door_idx": 0,"event": "open"}
}
"
13:53:19.865 [io-compute-7] INFO org.home4s.tailwind.Test -- HTTP/1.1 200 OK Headers(Content-Length: 0) body=""
13:53:22.093 [io-compute-10] INFO org.home4s.tailwind.Test -- HTTP/1.1 POST /v0/status Headers(User-Agent: ESP32 HTTP Client/1.0, Host: 192.168.100.5:8888, Content-Type: application/json, Content-Length: 297) body="{"result": "OK","product": "iQ3","dev_id": "_54_43_b2_7b_30_e0_","proto_ver": "0.1","door_num": 1,"night_mode_en": 1,"fw_ver": "10.52","led_brightness": 100,"router_rssi": -63
,"data": {"door1": {"index": 0,"status": "open","lockup": 0,"disabled": 0}
},"notify": {"door_idx": 0,"event": "open"}
}
"
13:53:22.094 [io-compute-0] INFO org.home4s.tailwind.Test -- HTTP/1.1 200 OK Headers(Content-Length: 0) body=""

13:53:53.941 [io-compute-6] INFO org.home4s.tailwind.Test -- HTTP/1.1 POST /v0/status Headers(User-Agent: ESP32 HTTP Client/1.0, Host: 192.168.100.5:8888, Content-Type: application/json, Content-Length: 299) body="{"result": "OK","product": "iQ3","dev_id": "_54_43_b2_7b_30_e0_","proto_ver": "0.1","door_num": 1,"night_mode_en": 1,"fw_ver": "10.52","led_brightness": 100,"router_rssi": -64
,"data": {"door1": {"index": 0,"status": "close","lockup": 0,"disabled": 0}
},"notify": {"door_idx": 0,"event": "close"}
}
"
13:53:53.943 [io-compute-16] INFO org.home4s.tailwind.Test -- HTTP/1.1 200 OK Headers(Content-Length: 0) body=""