Closed witold-gren closed 1 year ago
Hey @witold-gren, there are some push notifications i intentionally skip such as motion detected, person detected, alarm, snooze etc because all these events are also generating a secondary event called property_changed for respective attributes.
I will take simplest example, motion detected
event and its respective attribute motionDetected
.
Whenever there is an event generated as motion detected
, it is immediately followed by property_changed
event for motionDetected
to True. In my local setup (homebase 2, 4 pieces 2c cameras and one indoor pan tilt) this setup is working fine.
So, given all these, why would we want to explicitly catch motion detected
event?
Example below;
2023-01-21 15:38:05.640 DEBUG (MainThread)[custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'property changed', 'serialNumber': 'T8113xxx', 'name': 'motionDetected', 'value': True}} 2023-01-21 15:38:05.678 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'motion detected', 'serialNumber': 'T8113xxx', 'state': True}}
So.. what I noticed is that for camera T8151
we completely don't have this kind of property_changed
events. So for me this is a problem because it look like Eufy Security Add-on
still not fully support all events (or that is the way how works eufy api service for specific devices) like for others devices. My idea was to try to add this kind of events until it is added/fixed in Eufy Security Add-on
. Maybe there is an option to enable these events for specific devices (in HA settings)?
I fully understand your concept of the plugin and the fact that you would not want to duplicate these events, but from my perspective, adding these events is the only option for the correct operation of automation for the indicated cameras (of course, I can also wait for update the add-on, but I have no idea when it will happen 😀).
I also wonder what the reason we have two type of events, and for some cameras they work differently than for the other kind of devices. Is this the action of this add-on or maybe the Eufy api service works like that..
Hello, may I have the same issue? I am presenting the switches for my installes cameras in Lovelace. Unfortunately some of them don't update when I disable/enable the cameras in my mobile eufy-app (android and ios). But I can disable/enable the cameras using the switches in Lovelace. So the push events from Lovelace/HA seem to be send to Eufy, but the pushes from Eufy to HA are either not send or don't come through. Interesting is, that for some of my cameras both directions work (like my Solocam), for others not. Another point is, that I have most of my cameras connected to the Homebase 3.
It is the same behaviour as in #669.
Why don't we spend our time and energy to fix these under eufy-security-ws? Everyone would receive the benefits?
At least, i will do accordingly
Hi fuatakgun, I appreciate you effort. Unfortunately my programming experience ended more than 7 years ago and I am trying to get into it again playing with my HA. And I am more than happy where I am now. If I can help you with something please let me know. I will do my best, but I cannot promise anything.
Fair enough, what do you think @witold-gren
I can try, but when it comes to python, I have a lot of experience, if we talk about it TypeScript I don't have much experience here.
Ok, let's introduce these hopefully temporary hacks here, would you do this for as many as events @witold-gren ?
All I can try to do is add support for events that I can see locally. I was thinking about adding an additional variable to the configuration that would enable and disable this functionality. This means that you don't follow events if you don't want to, but you use them if you want to. The second thing is the approach.. we can, for example, do a simple conversion of those events to property_changed
and just update property when we will have this kind of events..
The last question is can you tell me how to enable all events? I haven't fully understood the whole code yet 😀
makes sense, let's define a constant enum to map Event Name to respective Property (motion detected -> motionDetected) and generate property_changed
on the fly.
Do you want to pick this up or I can do it.
If you have a time you can do it.. of course, I can also think about it, but I certainly won't do it as quickly as you. I'm just wondering how to do it in such a way that in the future you don't have to, for example, remove the code when the library is updated 😀 I'd rather see it as an extra ability to track changes, rather than something we're adding and later we will remove
Hey @fuatakgun 👋🏻 I finally found a time to check what happen (sorry but I also support other projects).. after a little investigation, it turns out that this is a eufy
and eufy-security-client
problem. The main problem is related with the type of message how eufy inform about motion detected.. above is an example of such a message. We should pay attention to this key event_type: undefined
. If you check it in the library itself eufy-security-client
:
https://github.com/bropat/eufy-security-client/blob/master/src/eufysecurity.ts#L947
you will find two executions:
as you can see in my case the message is not handled for the relevant devices and this is the reason why it is not visible in the logs. The only option to fix this is to add additional logic that emits the appropriate events.
Great news @witold-gren , thanks for deep dive, would you raise a PR in eufy-security-client?
Hey @fuatakgun , I'm working on this a bit now, unfortunately it's more complicated than I described above.. so far what I've actually found are errors in the correct formatting of the raw answer (it's already been fixed by me..) but I'll keep checking what is the problem really. When I have more information, I'll let you know 😀
I saw something about eufy notification on the app saying, "when we ask full notification mensage abou motion it saves one thumbnail on the hub"
Do we have access to this image, because this way instead we create a image we could use the one automatic created by eufy, that one is really quick.
Describe the bug
While using this plugin, I noticed that it does not process all sent messages. When motion is detected by my camera
T8151
(Eufy Security 4G LTE) I noticed that there is no logs/action in the plugin.To reproduce
Steps to reproduce the behavior:
T8151
deviceEufy Security Add-on
Expected behavior
I would expect that even if this notification is not supported, I would see some log.
Additional information
Go to Settings -> System -> Repairs -> Click on 3 dots (...) -> System Information and get Version and Installation Type to below fields;
Hardware Information;
Camera Model: T8151
Debug Logs from Home Assistant (https://github.com/fuatakgun/eufy_security/discussions/624) They don't exist for this event
Logs from Eufy Security Add-on (either from Add-ons page of Home Assistant or Docker output):
Would you share your device with me in case further debugging required? (Yes/No): Yes
Additional context
I would like to add support for motion detection without a photo and with a photo. I would also like the relevant entities in Home Assistant to update as well.