roleoroleo / yi-hack_ha_integration

Home Assistant custom integration for Yi cameras: yi-hack-MStar, yi-hack-Allwinner, yi-hack-Allwinner-v2, yi-hack-v5 and sonoff-hack
GNU General Public License v3.0
218 stars 32 forks source link

Motion detection on MQTTP but not appearing in the motion_sensor in HA #55

Closed xinux87 closed 2 years ago

xinux87 commented 2 years ago

HI,

I'm having aproblem, with 5 cameras and the motion_sensor. I can see the MQTTP packets on HO, but it don't refresh the sensors on HA.

![image](https://user-images.githubusercontent.com/6419184/140622839-af5e59bb-14f9-4094-aac0-a5dcf444be87.png)

I have tried to configure first the mqttp on the cameras and later add them in the integration but nothing, but i'm getting the connect status to work. image

Even i've tried to use a diferent Topics Prefix for each camera.

P.d works fine! but any other sensor than the offline don't work.

This camera is

Thanks Again!!

roleoroleo commented 2 years ago

Which HA version are you using?

xinux87 commented 2 years ago

Home Assistant 2021.11.2

roleoroleo commented 2 years ago

Tested with this version. It seems working. Try to disable human detection.

xinux87 commented 2 years ago

already done and it doen't work, it can be for the CAM? they're using yi-hack-v5.

roleoroleo commented 2 years ago

Maybe. Because I can't test the integration with v5. Which version are you using? Is there any useful log in ha?

xinux87 commented 2 years ago

Here you have!!

Thanks!!

Firmware Version | 0.4.3 Base Version | 4.2.0.0H_201909041620 Model Suffix | y25

Just This one.

This error originated from a custom integration.

Logger: homeassistant.helpers.entity Source: custom_components/yi_hack/common.py:193 Integration: Yi Cam with yi-hack (documentation) First occurred: November 23, 2021, 1:17:12 AM (50 occurrences) Last logged: 9:37:57 AM

Update for switch.yi_hack_m_ced657_privacy fails Update for switch.yi_hack_m_5480ef_privacy fails Update for switch.yi_hack_m_549b12_privacy fails Update for switch.yi_hack_m_54975d_privacy fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 468, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 658, in async_device_update raise exc File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/yi_hack/switch.py", line 43, in update self._state = get_privacy(self.hass, self._device_name, conf) File "/config/custom_components/yi_hack/common.py", line 193, in get_privacy if response is not None: UnboundLocalError: local variable 'response' referenced before assignment

Burbacottero commented 2 years ago

Same problem here but with allwinner v2. Home Assistant detection says connected but the sensor doesn't work.

Mosquitto broker logs: 1638136813: New connection from 172.30.32.2 on port 1883. 1638136813: Socket error on client , disconnecting.

xinux87 commented 2 years ago

@roleoroleo There is any place with a tutorial to integrate the cams with the MQTTP?

I mean, it says just need to add the integration and add the IP/Username/password, but we need to add the MQTTP credentials right?? or with the Hack its not necessary¿

And anything else?

Like, giving a new name for each camera on the MQTTP section and i dont know...

Thanks!!

roleoroleo commented 2 years ago

@xinux87 Which version are you using? Line 193 in common.py is blank.

About MQTT, you have to configure credentials:

You don't need to insert username/password when you add this integration.

xinux87 commented 2 years ago

lol 0.3.1 updating and testing.

xinux87 commented 2 years ago

Then, in the MQTT webpage from the cam: /index.html?page=mqtt -> Add server data, and port, then the autentification -> I'm getting the status Connected. And in the: index.html?page=mqtt_adv

What do we need to activate everything? with Enabled And Start on boot?

Or there is a minimal install.

Thanks for your time!

xinux87 commented 2 years ago

Started Again with the new version.

now i see the motion events on mqtt but, but just motion_stop not motion_start

getting data on the MQTT: image

Can it be a problem with the firmware of the camera? even i can see the recorded videos, but the event motion_start, dont appears on the mqtt.

image

added some infor of the webcam: image

roleoroleo commented 2 years ago

What do we need to activate everything? with Enabled And Start on boot?

* MQTT Information Advertise

* MQTT Link Advertise

* MQTT Camera Settings Advertise

* MQTT Telemetry Advertise

* Home Assistant -> Changing device ID right?

If you use this integration, you don't need to activate mqtt advertising.

Can it be a problem with the firmware of the camera? even i can see the recorded videos, but the event motion_start, dont appears on the mqtt.

Normally this happens if you enable human detection. But depends on the model.

xinux87 commented 2 years ago

Afrter some debuggind and help, it seems to be a problem with the firmware that don't send the motion_start via MQTTP.

I will open, in the firmware the issue.

Thanks!!

roleoroleo commented 2 years ago

https://github.com/roleoroleo/yi-hack_ha_integration/issues/55#issuecomment-968316266