yi-hack_ha_integration icon indicating copy to clipboard operation
yi-hack_ha_integration copied to clipboard

Dome U Pro - Switch to enable / disable AI Human Detection and Face Detection

Open SmartM-ui opened this issue 3 years ago • 21 comments

Hi, Would it be possible to provide the switches to activate / deactivate the AI Human Detection and Face Detection control present on the YI app for the U Pro Dome cam?

Thank you

SmartM-ui avatar Jul 02 '21 09:07 SmartM-ui

I need to find a solution here https://github.com/roleoroleo/yi-hack-Allwinner-v2/issues/210 before.

roleoroleo avatar Jul 05 '21 20:07 roleoroleo

Hi @roleoroleo

this is the data that is detected when I press AI human detection from the YIhome app

AI Humand Detect OFF IPC message. Len: 20. Status: No error information! Parsing message. 01 00 00 00 08 00 00 00 3c 10 01 00 04 00 00 00 00 00 00 00

AI Humand Detect ON IPC message. Len: 20. Status: No error information! Parsing message. 01 00 00 00 08 00 00 00 3c 10 01 00 04 00 00 00 01 00 00 00

Thanks

SmartM-ui avatar Jul 07 '21 13:07 SmartM-ui

Ok, now try to send these messages. 1 - Save the binary code (20 bytes) into a file (use hxd if you are a windows user). ~~2 - Use the command ipc_cmd -x file.bin~~ 2 - Use the command ipc_cmd -f file.bin 3 - Refresh the app and check if the switch is changed.

roleoroleo avatar Jul 07 '21 14:07 roleoroleo

ipc_cmd -x file.bin

Hi @roleoroleo

I installed HxD and pasted the code "01 00 00 00 08 00 00 00 3c 10 01 00 04 00 00 00 01 00 00 00" in a new file. Saving the AI.bin file, I saw that it takes up 20 bytes.

I copied the file to the root of the MicroSd

Through terminal I gave the command: killall ipc_multiplexer / tmp / sd / yi-hack / bin / ipc_cmd -x AI.bin

but the switch inside the YIhome app doesn't change

Schermata 2021-07-07 alle 17 24 34 Schermata 2021-07-07 alle 17 24 51

SmartM-ui avatar Jul 07 '21 15:07 SmartM-ui

Sorry, use -f parameter. -x is another feature.

roleoroleo avatar Jul 08 '21 07:07 roleoroleo

Sorry, use -f parameter. -x is another feature.

@roleoroleo Good morning, thanks, i tried but i must have made a mistake using HxD (i had never used it).

The following error is returned with the - f command: killall ipc_multiplexer /tmp/sd/yi-hack/bin/ipc_cmd -f AI.bin Error opening file AI.bin

Opening the AI.bin file whit HxD (which I saved by manually adding the .bin extension), I see this: Schermata 2021-07-08 alle 10 17 18

SmartM-ui avatar Jul 08 '21 08:07 SmartM-ui

Try to add the absolute path to the AI.bin The content of the file seems to be ok.

roleoroleo avatar Jul 08 '21 08:07 roleoroleo

Try to add the absolute path to the AI.bin The content of the file seems to be ok.

Hi, The absolute path should be AI.bin, I put it in the root of the microSD. Or create a temporary file inside the tmp / sd folder?

SmartM-ui avatar Jul 08 '21 09:07 SmartM-ui

It's not important where you copy the file. If it's in the root of the microSD try: /tmp/sd/yi-hack/bin/ipc_cmd -f /tmp/sd/AI.bin

roleoroleo avatar Jul 08 '21 11:07 roleoroleo

It's not important where you copy the file. If it's in the root of the microSD try: /tmp/sd/yi-hack/bin/ipc_cmd -f /tmp/sd/AI.bin

GREAT @roleoroleo

It works! AI.bin file manages to activate human detection in the official YI app!

After lunch I also try to create the file to deactivate it and I inform you.

Thanks again :-)

SmartM-ui avatar Jul 08 '21 11:07 SmartM-ui

Hi @roleoroleo The code works to both activate and deactivate the AI Human Detect:

AI Human Detect ON: 01 00 00 00 08 00 00 00 3C 10 01 00 04 00 00 00 01 00 00 00

AI Human Detect OFF: 01 00 00 00 08 00 00 00 3C 10 01 00 04 00 00 00 00 00 00 00

This code enable the AI Face Detection:

Face detect ON 01 00 00 00 08 00 00 00 3d 10 01 00 04 00 00 00 01 00 00 00

Face detect OFF 01 00 00 00 08 00 00 00 3d 10 01 00 04 00 00 00 00 00 00 00

Would it be possible to create the switch from Home Assistant?

SmartM-ui avatar Jul 08 '21 12:07 SmartM-ui

I need to add them to the fw before to add to ha.

roleoroleo avatar Jul 08 '21 12:07 roleoroleo

I need to add them to the fw before to add to ha.

I look forward to! Thank you

SmartM-ui avatar Jul 08 '21 13:07 SmartM-ui

I need to add them to the fw before to add to ha.

Hi @roleoroleo , maybe you will have to insert only face detection in the firmware because from further tests, I was able to ascertain that already currently, by modifying the "AI Human Detection" parameter from your web page YIHACK (camera setting), the YIhome app receives the command and synchronizes it. This only happens in one sense, WEBpage YIHACS> YIhome app and not vice versa. (Maybe integrating it into the firmware will be able to sync it both ways?)

Having already the AI Human Detection sensor in your WebPage, is it already possible to have this switch in Home Assistant or can you tell me how to create it manually?

Thanks

SmartM-ui avatar Jul 09 '21 09:07 SmartM-ui

maybe you will have to insert only face detection in the firmware because from further tests, I was able to ascertain that already currently, by modifying the "AI Human Detection" parameter from your web page YIHACK (camera setting), the YIhome app receives the command and synchronizes it.

Ok.

This only happens in one sense, WEBpage YIHACS> YIhome app and not vice versa. (Maybe integrating it into the firmware will be able to sync it both ways?)

This is normal and I can't fix it at the moment.

Having already the AI Human Detection sensor in your WebPage, is it already possible to have this switch in Home Assistant or can you tell me how to create it manually?

Create a switch with a http request like this:

http://IP-CAM:8080/cgi-bin/camera_settings.sh?ai_human_detection=yes
http://IP-CAM:8080/cgi-bin/camera_settings.sh?ai_human_detection=no

roleoroleo avatar Jul 09 '21 10:07 roleoroleo

maybe you will have to insert only face detection in the firmware because from further tests, I was able to ascertain that already currently, by modifying the "AI Human Detection" parameter from your web page YIHACK (camera setting), the YIhome app receives the command and synchronizes it.

Ok.

This only happens in one sense, WEBpage YIHACS> YIhome app and not vice versa. (Maybe integrating it into the firmware will be able to sync it both ways?)

This is normal and I can't fix it at the moment.

Having already the AI Human Detection sensor in your WebPage, is it already possible to have this switch in Home Assistant or can you tell me how to create it manually?

Create a switch with a http request like this:

http://IP-CAM:8080/cgi-bin/camera_settings.sh?ai_human_detection=yes
http://IP-CAM:8080/cgi-bin/camera_settings.sh?ai_human_detection=no

THANK YOU!

I try to create a switch using restful

SmartM-ui avatar Jul 09 '21 10:07 SmartM-ui

Create a switch with a http request like this:

http://IP-CAM:8080/cgi-bin/camera_settings.sh?ai_human_detection=yes
http://IP-CAM:8080/cgi-bin/camera_settings.sh?ai_human_detection=no

Hi @roleoroleo ... sorry again, i was trying to make a switch with http, but it doesn't seem to work. If you managed to do this, could you fix my code please?

switch:

  • platform: rest resource: http://IPCAM:8080/cgi-bin/camera_settings.sh?ai_human_detection=yes name: yi_switch_ai_human_detection_on username: "xxx" password: "xxx"

  • platform: rest resource: http://IPCAM:8080/cgi-bin/camera_settings.sh?ai_human_detection=no name: yi_switch_ai_human_detection_off username: "xxx" password: "xxx"

  • platform: rest name: "yiswitchai" resource: http://IPCAM:8080/cgi-bin/camera_settings.sh?ai_human_detection body_on: "yes" body_off: "no" username: "xxx" password: "xxx"

Thanks in advance

SmartM-ui avatar Jul 09 '21 11:07 SmartM-ui

Try a command line switch with curl. This service is not really rest.

roleoroleo avatar Jul 09 '21 12:07 roleoroleo

Try a command line switch with curl. This service is not really rest.

Ok, I try

SmartM-ui avatar Jul 09 '21 13:07 SmartM-ui

Try a command line switch with curl. This service is not really rest.

Hi @roleoroleo I have managed to create a switch, but I have seen that it does not always work as well as the switches you have directly integrated.

I believe, for everyone's sake, that you will also have to integrate the AI Human Detect switch directly into the integration when you update the firmware :-)

The best code of all the tests turned out this, if it were to be useful to someone:

shell_command: switch_1_on: curl -k "http://IPCAM:8080/cgi-bin/camera_settings.sh?ai_human_detection=yes" switch_1_off: curl -k "http://IPCAM:8080/cgi-bin/camera_settings.sh?ai_human_detection=no"

switch:

  • platform: template switches: ipcam_ai_switch: turn_on: service: shell_command.switch_1_on turn_off: service: shell_command.switch_1_off

SmartM-ui avatar Jul 12 '21 15:07 SmartM-ui

Hi @roleoroleo I don't know where it is right to make the request, but in order not to let this request die, I only propose the link with the request made directly on yi-hack-Allwinner-v2 :-)

https://github.com/roleoroleo/yi-hack-Allwinner-v2/issues/210#issuecomment-911727758

https://github.com/roleoroleo/yi-hack-Allwinner-v2/issues/209#issuecomment-911742216

THANK YOU!!!

SmartM-ui avatar Sep 02 '21 14:09 SmartM-ui

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Apr 05 '24 02:04 github-actions[bot]