Comments (10)
Same here, Imou Life is working but also if I made all the settings needed I don't receive any push notification
from imou_life.
Hi, first of all, you are not doing anything wrong, it is a known issue with which we are struggling since a few weeks now so I decided to do some more troubleshooting in order to try identifying the problem and looking for a workaround.
First of all, I've setup up a test HA environment, configured an automation and the callback pointing to it. I triggered a motion on my webcam and nothing happened on HA. I then installed tcpdump on HA to see if the incoming request was entering my network and why HA refused it. This is what I got:
A POST with the full URL in the URI and HA responding with 404 Not Found. Is the full URL acceptable in a POST? Don't know but looks HA doesn't like it. Then I copied and pasted the entire request, using netcat to connect to HA and replying the request. Again 404. Of course. Then I tried REMOVING the full URL leaving the URI only and it worked, 200 OK and I see the automation triggering:
I then must assume the full URL is the problem. Now, how to fix it? Unfortunately we cannot control what the remote Imou server is sending over. Let's see if a reverse proxy can help. I've then set up a nginx with the following configuration:
server {
listen 80;
listen [::]:80;
server_name localhost;
proxy_buffering off;
location /{
access_log /dev/stdout postdata;
proxy_pass http://192.168.0.159:8124/;
}
Nginx "cleans" the request. When calling HA, it removes automatically the full URL, the request reaches HA and the automation triggers. I then tried to make nginx pointing back to my production HA. And again it worked out.
Last test was to use the NGINX Home Assistant SSL proxy Addon on HA which is basically just a simple nginx server pointing to the local HA. And it did NOT work for me. I then tried to replicate the nginx configuration from https://github.com/home-assistant/addons/blob/master/nginx_proxy/data/nginx.conf into my test nginx. Still my nginx works, HA nginx doesn't.
This is where I am right now. I'm pretty sure the problem is the malformed request passed by Imou which HA cannot handle. I'm pretty use a reverse proxy can help in cleaning up the request. I'm just missing the last mile: why nginx running on HA is not behaving like my test nginx...
I'll go on with additional tests, meanwhile if anybody has any idea, please share :-)
from imou_life.
I have understand the problem, probably send a wrong POST request then HA does not accept it.
This is a problem because on the one hand I think it is difficult to communicate it to IMOU, on the other hand HA blocks the request immediately and therefore there is no way to intervene except from the outside (as you did with NGINX).
Besides this in my case I think there is also the problem that I don't have a fixed IP and I use duckdns, so IMOU should be given the duckdns address otherwise the request will never arrive, right?
from imou_life.
Have you already tried writing in the HA developer forum to see if there is a way around this?
https://community.home-assistant.io/c/development/10
from imou_life.
Ok, now I think I finally found a solution which finally WORKS :-)
The problem with NGINX Home Assistant SSL proxy Addon encountered in the test above was that there was a catch all server_name in the nginx configuration which was intercepting and rejecting the request. This is because ALSO the Host header sent by the Imou server is malformed, so never reaching the right server directive and hence HA.
Unfortunately with that addon is not possible to customize nginx configuration.
I then installed Nginx Proxy Manager Add-on (which requires Maria DB Addon FYI) and now everything works just fine!!
Bottomline:
- Callbacks are correctly sent by the Imou Server to the configured webhook
- Keep in mind that if you change the URL, sometimes it may take up to 5 minutes for a change to apply on Imou side
- However the requests are malformed:
- the full URL is used in the POST request instead of the URI
- the Host header contains the port number
- This makes HA rejecting the request (404 error, without any evidence in the logs)
- A reverse proxy in front of HA without any special configuration takes care of cleaning out the request
- If running HA in Supervised mode, " Nginx Proxy Manager Add-on" just works . "NGINX Home Assistant SSL proxy Addon" instead does not
Now I would need somebody to confirm that this solution is actually working also somewhere else.
Thanks!
@array81 correct, I'm using the duckdns address indeed
from imou_life.
Closing the issue since the workaround above seems to work and instructions have been updated accordingly in v1.0.5. Feel free to reopen again if anything is not working as expected, thanks
from imou_life.
Nice update on the v1.0.5 release, however I am using "Nginx Proxy Manager Add-on" v0.12.2 in "Supervised" mode and the callback is never received.
With the addition of the callback sensor I notice the full URL path is not shown, only the protocol and domain name https://subdomain.domain/
Whereas my configured callback URL is https://subdomain.domain/api/webhook/callback_id
Should the sensor value be truncated or display the full path? When I call the webhook in Postman it receives it fine, so I am guessing the issue is related to the path truncation?
from imou_life.
The callback url sensor should display the full path, this is what I get here at least. Try in HA going to Developer Tools, States and search for the sensor. If you see the truncated url, try disabling push notifications, setting the callback url again in options and re-enabling push notifications.
I'm using the same version of Nginx Proxy Manager Add-on so it is very strange :-/ In terms of configuration, I have websocket support on, and in SSL "Force SSL" and "HTTP/2 Support" only enabled and gets those notifications consistently:
I don't understand why it is random somewhere else :-(
from imou_life.
try disabling push notifications, setting the callback url again in options and re-enabling push notifications.
After doing this, the callback URL is now reporting correctly. Thanks for the tip. After a few basic tests I can confirm I now receive event notifications, nice work! :-)
from imou_life.
Fantastic thanks for the feedback!
from imou_life.
Related Issues (20)
- Can't get usable image via "picUrl" or "thumbUrl" HOT 2
- Add support for multiple channel IDs HOT 2
- Firmware Upgrade // this is not a issue but a question HOT 1
- Where to find app Id and secret id HOT 1
- IPC-S21FE Video stream not showing HOT 7
- Imou life motion detection (Option 3) automation error HOT 4
- Vacuum Cleaner config flow error HOT 1
- Malformed or unexpected API response - When adding Vacuum Cleaner HOT 2
- Done
- Add an ability to call a PTZ preset point HOT 5
- speaker integration HOT 1
- APIError: FL1001: Insufficient remaining available licenses HOT 28
- Add instructions on how to contribute HOT 1
- Video Streaming not working on shared devices
- APIError: DV1026: The device does not support the call of this function HOT 8
- 500 Internal Server Error Server got itself in trouble HOT 9
- Cannot start version 1.0.14 in Home Assistant 2023.9.2 HOT 4
- smart plug HOT 1
- IMOU B5 Bulbs, problem. HOT 1
- APIError: DV1026: The device does not support the call of this function. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imou_life.