Closed hamid-elaosta closed 2 months ago
Based on some information I found here: https://community.home-assistant.io/t/how-to-fix-custom-integration-brematic-calls-async-write-ha-state/722238
I made the following change, which is working again:
diff --git a/custom_components/dahua/binary_sensor.py b/custom_components/dahua/binary_sensor.py
index 8120758..455d1ce 100755
--- a/custom_components/dahua/binary_sensor.py
+++ b/custom_components/dahua/binary_sensor.py
@@ -125,7 +125,7 @@ class DahuaEventSensor(DahuaBaseEntity, BinarySensorEntity):
async def async_added_to_hass(self):
"""Connect to dispatcher listening for entity data notifications."""
- self._coordinator.add_dahua_event_listener(self._event_name, self.async_write_ha_state)
+ self._coordinator.add_dahua_event_listener(self._event_name, self.schedule_update_ha_state)
@property
def should_poll(self) -> bool:
I'm not familiar with HA integration development, so I'm not sure if this is the correct solution, which is why I haven't opened a PR, but my doorbell is working again now with this change.
Fixed by merging adutchak's PR and released in 0.9.52 https://github.com/rroller/dahua/releases/tag/0.9.52
Released an update. Can you try now On May 4, 2024, at 11:14 AM, Hamid @.***> wrote: Based on some information I found here: https://community.home-assistant.io/t/how-to-fix-custom-integration-brematic-calls-async-write-ha-state/722238 I made the following change, which is working again: diff --git a/custom_components/dahua/binary_sensor.py b/custom_components/dahua/binary_sensor.py index 8120758..455d1ce 100755 --- a/custom_components/dahua/binary_sensor.py +++ b/custom_components/dahua/binary_sensor.py @@ -125,7 +125,7 @@ class DahuaEventSensor(DahuaBaseEntity, BinarySensorEntity):
async def async_added_to_hass(self):
"""Connect to dispatcher listening for entity data notifications."""
self._coordinator.add_dahua_event_listener(self._event_name, self.schedule_update_ha_state)
@property def should_poll(self) -> bool:
I'm not familiar with HA integration development, so I'm not sure if this is the correct solution, which is why I haven't opened a PR, but my doorbell is working again now with this change.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>
@rroller Thanks, I can confirm that it is working with the update.
Thanks @adutchak for the PR that fixed it.
I'm no longer receiving any events from my Amcrest AD410, the error log appears to suggest the integration is using a feature it shouldn't, but looking at the commit history, this particular issue was resolved some time ago.
I've removed and re-added the integration several times, even being sure to ensure the custom component is removed from the filesystem on HA.
I'll continue digging because the lack of a functioning doorbell is a big problem for us, but I thought I'd raise it here in the meantime.
Debug log:
Debug log is taken using main branch, but I was previously using the latest release.