-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ON / OFF status in real time #62
Comments
As we have covered in previous issue, fetching on/off status real time is not feasible, given that eufy is not sending push notifications to its clients about state changes. My proposal is to create a service to fetch latest status and you can use this service as you want.
|
OK, |
Hi @fuatakgun ,
I tried to run it, following your examples in the other topic, it did not report errors, but it did not update the device information on home assistant. Did I get the code wrong or is it not for this? Thanks |
i was going to wrap this by a specific service, but you are right, you can call this via send_message, but your format is wrong, you do not need to pass serial number as poll_refresh will try to refresh everything. can you try like below and check if there are any errors in eufy ws add on logs?
|
Yes! I tried both the camera status and the led status and they are updated in real time after launching the service. Great |
Hi @fuatakgun, Can the attributes present be used to create a sensor or do you have to create it yourself as the binary sensor "enabled"? example:
(NULL)
(UNKNOW) Thanks |
replace
|
Thanks @fuatakgun for that too. From the developer tools and in the camera.eufy attributes, the status is changed immediately. The sensor created, however, is not always updated:
Look at the attribute value (statusLed: false) and the state of the new sensor (True): |
Yes template sensor is very slow and unreliable, i didn't understand this too. |
@fuatakgun I tried to create the led sensor from the binary sensor, but it doesn't show up in the developer model: {{state_attr ('binary_sensor.xxx_enabled', 'data') ['statusLed']}} Do you have any suggestions? |
Hey before moving forward, i suggest you to create this sensor directly in integration, it is very straightforward, do you have any experience in development? If not i can help you, if you don't want to get into this, having these sensors are fairly simple, one liner in codebase. |
@fuatakgun If you help me to create the sensors directly from the integration I would be grateful. I'd love to learn |
Check this line:
You see there is a list of binary sensors here. Just add all applicable binary sensors here and they will be generated as a real sensor in your machine. After testing out locally, create a push request so we can merge your change into codebase. You can go ahead and change custom_components/eufy_security/binary_sensor.py and restart your HA to pick up changes and create respective sensors. |
I added this line:
I restarted Home Assistant and reloaded the integration, but I only ever have 8 entities and the new one doesn't load. Where did I go wrong? I tried to remove motion from binary_sensor.py and it actually removed it from Home Assistant, so the problem is related to the statusLed |
Hi @fuatakgun
Binary sensor imported as entity = OK
Binary sensor imported as entity = OK
Binary sensor imported as entity = OK
Binary sensor imported as entity = NO |
Hey, it should be |
OK, he also sees the led. Thanks I have entered all the binary sensors available, tomorrow I will check who is able to update in real time after running the service. If tomorrow you explain to me how to create the push request, after testing the sensors, I will add the request Good night |
Hi @fuatakgun I realized that actually the "statusLed" sensor exists in your integration and it is the one that is actually updated when I launch the service. I am attaching screenshots where the two sensors are present (it also results in the binary sensors created by the integration). At the precise moment, the webcam led was actually off as is evident in "statusLed: false". The problem is that the "statusLed" sensor is not interpreted if inserted into the integration through the binary_sensor.py Maybe it's a problem with how the name was reported in the integration / add-on? Further info: The "statusLed" sensor of the "binary_sensor.salone_led_status" and of the "binary_sensor.salotto_enabled" are updated in real time after running the refresh service. The "ledStatus" sensor of the binary_sensor and camera.salotto never update and always remain "true" |
apparently, this is the bug which was resolved in 0.4.0 version of add-on but we are not able to update into that one yet because of p2p live stream problem. If you do not have a direct dependency on p2p live stream, go ahead and update your add on using following this: #59 |
Hi @fuatakgun The "ledStatus" sensor is never displayed both in the camera.salotto and in the binary_sensor.salotto_enabled The "statusLed" sensor attribute is displayed only after a change from the official app of the status LED I tried reporting in the binary_sensor.py
but the sensor is not created, as was the case with the previous addon In developer templates / tools, when the sensor is displayed as an attribute after an app change, it is reported correctly
Can I perform any other tests? |
Hi @DivanX10 , I was looking at how to sync the settings imparted by the eufy app to Home Assistant. I enabled additional binary sensors (e.g. motion tracking) and, taking a cue from your topic: #71, I created the boolean inputs for the sensors of interest. However, I have seen that the switches report the correct status only if the data is sent from Home Assistant to the cam. As a remedy, in addition to your automation I have created two more in order to position the switch as per the eufy app. In this way the switches, after 10 minutes of waiting provided by the add-on to get the status from the eufy app, you get the correct status of the switch.
you can get the status in real time, without waiting for the 10 minute wait provided by Eufy. (I would like to force the update every time I view the Home Assistant page where the cam switches are present). In summary, to have the synchronization between Eufy and Home Assistant I set these codes:
and your automation which I do not report in full, but which includes the following condition:
Do you have any suggestions to improve it all? |
Hi @DivanX10 , This is the list of sensors I have entered in my Home Assistant I am waiting to know from @fuatakgun how to open a pull request to merge the sensors in the code for all Thanks again for the help on io-broker! |
I added the DEVICE_CLASS_LIGHT class for auto Night vision, although I liked the option ("auto night vision", "auto Night vision", "autonightvision", "mdi:weather-night", None, DEVICE_CLASS_LIGHT) more, but this is a matter of taste, and now to the point auto Night vision doesn't work for me. and Motion Tracking shows the status True\False. I understand that you need to create another file switch.py where there will be switches and there is no need to use automation in the home assistant and then the statuses will work correctly
|
I didn't look at the camera attributes right away, but as soon as I saw them, I realized that there was no point in editing the file binary_sensor.py , you can create a file and output any sensor.
But I can't get the sensor status in real time by calling the service and driver.poll_refresh. How are you calling the service for a status update? My statuses are updated only after a reboot HA (
|
Hi @DivanX10 , To update the statuses, I use this code:
|
Yes, indeed, the status changes faster when they are in the file binary_sensor.py . Then it would be good for the author to make a file switch.py with a standard set of switches, but in order to be able to add your own switches, for example, the author will indicate all possible switches, but comment them out, and we just need to uncomment the necessary switches |
@DivanX10 |
Excellent possibility to choose the scan time! I can't find a way to automate the action on viewing a particular Home Assistant page. |
Hi @fuatakgun
I noticed that if I change the on off status of the cam through the original app, in the home assistant, the status change is displayed with about 10 minutes delay.
To have it updated in real time, the security status must be changed, via the official app, by setting from home to away, or via the alarm activation service in the home assistant.
Conversely, I tried to turn the cam on and off from Home Assistant and the official app immediately shows the status change, closing and reopening the Eufy app.
Would it be possible to create the service to get the on / off status in real time?
Thanks
The text was updated successfully, but these errors were encountered: