fuatakgun / eufy_security

Home Assistant integration to manage Eufy Security devices as cameras, home base stations, doorbells, motion and contact sensors.
889 stars 73 forks source link

Camera feed not detected after setup. #10

Closed apokha1 closed 3 years ago

apokha1 commented 3 years ago

I am working with a wired doorbell, T8200. After the installation, three new entities were added, person detector sensor, battery & wifi ssid power. The battery entity was unavailable, as it makes sens with the wired doorbell, there is no battery. wifi ssid sensor was unavailable too. And I had no luck getting the stream from the doorbell camera.

image

Some log lines:

2021-07-18 12:16:49 ERROR (MainThread) [custom_components.eufy_security] eufy_security - Exception in websocket - process_messages : 'battery' - traceback: Traceback (most recent call last): File "/config/custom_components/eufy_security/websocket.py", line 55, in process_messages await self.on_message(msg) File "/config/custom_components/eufy_security/websocket.py", line 66, in on_message await self.message_callback(message) File "/config/custom_components/eufy_security/coordinator.py", line 165, in on_message self.async_set_updated_data(self.data) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 287, in async_set_updated_data update_callback() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 419, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 453, in _async_write_ha_state state = self._stringify_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 425, in _stringify_state state = self.state File "/config/custom_components/eufy_security/sensor.py", line 86, in state return self.entity[self.key] KeyError: 'battery'

2021-07-18 12:12:43 ERROR (MainThread) [homeassistant.components.camera] Error while setting up eufy_security platform for camera Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/eufy_security/camera.py", line 34, in async_setup_entry _LOGGER.debug(f"{DOMAIN} - camera setup entries - {entities}") File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 803, in __repr__ return f"<Entity {self.name}: {self.state}>" File "/config/custom_components/eufy_security/camera.py", line 74, in state self.is_streaming = self.entity["rtspStream"] KeyError: 'rtspStream'

fuatakgun commented 3 years ago

Your camera should support RTSP, double check if you had enabled it on eufy app and try start_rtsp service and check if camera state is changed as streaming. Later than, click on image to see live stream.

Or share the steps, when you are having these issues, more info needed.

fabianluque commented 3 years ago

@fuatakgun Updated to latest, my T8400 camera (2K IndoorCam with RTSP enabled) became unavailable. I reinstalled the integration and now my camera entity is gone, I still have all the sensors though. eufy_security_addon also updated to version 0.3.3.

fuatakgun commented 3 years ago

any logs you can share?

jbrukardt commented 3 years ago

@fuatakgun Updated to latest, my T8400 camera (2K IndoorCam with RTSP enabled) became unavailable. I reinstalled the integration and now my camera entity is gone, I still have all the sensors though. eufy_security_addon also updated to version 0.3.3.

Ive had weirdness as well. The camera entity is only showing up for 2 of my 8 cams (the 2 with SD cards in them, but also rstp enabled). The other devices are all there, and all their sensors are functioning, but no camera entity.

Same versions.

No errors in logs, and all devices are detected by the addon as shown in the logs. I think its something with the auto-creation of entities by the integration

fabianluque commented 3 years ago

@fuatakgun Here are some logs:

Removed.

fuatakgun commented 3 years ago

can you double check that you have enabled notifications with picture? There is no picture URL her to show as a placeholder and I am intentionally skipping these entities. I can try to find another way of doing this but you will have no still image.

jbrukardt commented 3 years ago

Double checked on mine that "thumbnail included" is present on all cameras for notification mode.

I think this a 2c vs 2k thing. The 2c's all store last thumbnail on the home base. The 2k's dont store last thumbnail anywhere persistent UNLESS you have an SD card in them. Id hypothesize thats why my two cameras with sd cards in them are working but the others arent. In previous versions of the integration I would get no-picture-url placeholders for the cams without sd cards in them, and then as motion events were triggered on that cam, they would update the lovelace card.

fuatakgun commented 3 years ago

ok, let's fix it, I will release a fix tonight in EU time zone (in couple of hours)

fabianluque commented 3 years ago

@fuatakgun @jbrukardt Can confirm the thumbnail behavior. Before the update I would get no image until there were some events triggered.

fuatakgun commented 3 years ago

can you share your device for testing purposes with admin rights? if you are located in EU, use my account: fuatakgun@gmail.com if you are located in US, use test account: eufydeveloper@gmail.com

jbrukardt commented 3 years ago

be aware that if you're testing on my "basement" device @fuatakgun that one does have an SD card in it, so it may not be good for testing this issue.

fuatakgun commented 3 years ago

be aware that if you're testing on my "basement" device @fuatakgun that one does have an SD card in it, so it may not be good for testing this issue.

which one I should rely? :)

jbrukardt commented 3 years ago

eeek... i dont have any I can share with you that dont have an sd card in em. Theyre all in my living spaces.

You could eject the card in app i guess? i think you can do that as an admin.

fuatakgun commented 3 years ago

i can only format but not eject, so you dont have sutaible camera to share. let's wait @fabianluque 's response than

fabianluque commented 3 years ago

i can only format but not eject, so you dont have sutaible camera to share. let's wait @fabianluque 's response than

Just shared one my 2K cameras with you, admin rights. Let me know if it works for you.

fuatakgun commented 3 years ago

please get latest codebase (1 min ago) and you will have camera. There is also one good improvement for you, picture will be updated while streaming automatically. Please resolve if it is done.

No update on add on, just integration

While i was connected, i confirmed that integration is automatically noticing that RTSP is on and trying to generate image. RTSP would not work if home assistant instance is not in the same network, so I switched to p2p live stream and validated that stream and live image is working fine.

fabianluque commented 3 years ago

@fuatakgun Awesome, let me update and test.

jbrukardt commented 3 years ago

waiting for the update to show up in hacs and then ill do it.

fabianluque commented 3 years ago

@fuatakgun Confirmed, fix works beautifully! Thanks so much! Removing access until next time. :)

fuatakgun commented 3 years ago

Let's hope we dont need it anymore :-) @jbrukardt , can you also validate with your cameras?

jbrukardt commented 3 years ago

can do. Just waiting for HA. Its hanging on restart waiting for something :/

fuatakgun commented 3 years ago

Do you see what keeps it hanging? Normally, it should mention which integration is holding it. I hope it is not about this one :-)

jbrukardt commented 3 years ago

ok, all cameras are detected again and have snapshots.

Streams working too!

jbrukardt commented 3 years ago

Do you see what keeps it hanging? Normally, it should mention which integration is holding it. I hope it is not about this one :-)

Honestly, it is this the integration sometimes :p but lets let that sleeping dog lie for now. We'll go for functionality first, then stability.

fuatakgun commented 3 years ago

There are many stuff happening at startup, i can definitely improve them.

dsjackson commented 3 years ago

After the latest code update (thanks for the frequent updates and improvements), wired doorbell no longer shown (Generates error: This entity is currently unavailable and is an orphan to a removed, changed or dysfunctional integration or device.) and the 2c's I have show the snapshot with RTSP-Streaming (before, just Streaming) but no longer stream.

fuatakgun commented 3 years ago

I know the issue about doorbell but i am not sure about 2c, any luck you can share it?

Update: published another version of integration, please check if you have latest version of integration and 0.3.3 version of add on.

I just wanted to separate streaming-rtsp vs streaming-p2p as it is difficult most of the time for users what is happening, so state is fine.

jbrukardt commented 3 years ago

Great enhancement to add the tag for streaming type. Thats really handy for troubleshooting the streaming method. All mine show rstp (as they should)

dsjackson commented 3 years ago

I know the issue about doorbell but i am not sure about 2c, any luck you can share it?

Update: published another version of integration, please check if you have latest version of integration and 0.3.3 version of add on.

I just wanted to separate streaming-rtsp vs streaming-p2p as it is difficult most of the time for users what is happening, so state is fine.

Confirmed that the 2C's now work as expected. Wired doorbell shows "Streaming - p2p" but no snapshot and no streaming. An earlier version (a few days ago...I will I had the version number) worked fine...a version before you added the streaming type tag.

fuatakgun commented 3 years ago

@dsjackson please create a separate issue, this became unmanageable. And share logs with it. And you can share your camera with admin rights following readme file and let me know the name.