123
(Taras)
October 26, 2021, 2:32am
1
Does anyone else see this on their system?
If I use Developer Tools > Events to listen for call_service
events, I see an endless stream of events reporting this:
Event 133 fired 22:18:
{
"event_type": "call_service",
"data": {
"domain": "persistent_notification",
"service": "dismiss",
"service_data": {
"notification_id": "config_entry_discovery"
}
},
"origin": "LOCAL",
"time_fired": "2021-10-26T02:18:39.754810+00:00",
"context": {
"id": "5daeccb3bf2e3b51c9cf1e599d388fec",
"parent_id": null,
"user_id": null
}
}
They come in bursts, ranging from about 5 at a time to dozens. Within about a minute of observation, it reported over 130 events containing the same data
.
I’m using 2021.10.4. Does anyone know why these events are produced?
BTW, I have call_service
events excluded from the recorder integration.
tom_l
October 26, 2021, 2:51am
2
Yes I am.
Event 55 fired 13:48:
{
"event_type": "call_service",
"data": {
"domain": "persistent_notification",
"service": "dismiss",
"service_data": {
"notification_id": "config_entry_discovery"
}
},
"origin": "LOCAL",
"time_fired": "2021-10-26T02:48:48.423863+00:00",
"context": {
"id": "efe94f367b20f0097dc8d1a29dd75f5d",
"parent_id": null,
"user_id": null
}
}
1 Like
123
(Taras)
October 26, 2021, 3:00am
3
Thanks for taking the time to confirm it’s not unique to my system.
Based on the phrase “config_entry_discovery” it seems like there’s continuous monitoring of configuration entries. However, it’s unclear to me why that activity (whatever it actually is) is reported as as a dismissal of a persistent_notification.
Have you excluded call_service
events from recorder? If you have not , I assume these events are not recorded by default … otherwise your database would be filled with these things! (Or is it?)
tom_l
October 26, 2021, 3:12am
4
No I have not excluded any events from the recorder, only entities.
I do have a few ignored integrations that could be causing it:
123
(Taras)
October 26, 2021, 3:13am
5
FWIW, I stumbled over this when I simply wanted to see the event produced when I executed a certain service call. It’s nearly impossible to observe it because it’s swamped by these endless events.
tom_l
October 26, 2021, 3:15am
6
I reckon it is the ignored discovery messages as I see a persistent notification very briefly during restart.
123
(Taras)
October 26, 2021, 3:18am
7
I have also observed these events on my test system which has just two (config-flow) integrations (ELKM1 and Supervisor) and seven ignored integrations.
Anyway, I will experiment with it tomorrow (disable zeroconf, etc) and see what, if anything, affects the production of these events.
123
(Taras)
October 26, 2021, 8:03pm
8
Based on my experiments, the endless call_service
events (of the type posted above) are produced by the SSDP integration (Simple Service Discovery Protocol) and the zeroconf integration (Zero-configuration networking).
All new installations are configured with default_config . It’s a shorthand way of including over 30 individual integrations. Among those integrations are SSDP and zeroconf (and DHCP Discovery ) which permit Home Assistant to search your local network for compatible devices. When discovered, Home Assistant presents suitable integrations that you may install to integrate the discovered devices.
When I disabled the SSDP integration, it dramatically reduced the number of call_service
events. Only 23 events were generated over a span of 10 minutes. In contrast, with SSDP enabled over 130 were produced within a minute. When both SSDP and zeroconf were disabled, no call_service
events were reported. Enabling the DHCP Discovery integration did not produce call_service
events.
I don’t know why the SSDP and zeroconf integrations generate these events (Dismissing a persistent_notification). The main drawback of this chatty behavior is that if you ever need to examine a specific call_service
event, it is likely to be lost in the flood of these numerous events.
In my case, Home Assistant has already discovered all of the devices I own so I no longer need it to continue monitoring my network for others. Therefore I have chosen to disable the SSDP and zeroconf integrations.
tom_l
October 27, 2021, 1:26am
9
I’m guessing lazy quick fix programming.
A device is discovered and a persistent notification generated. Then the ignore status is checked and the notification dismissed if required.
Really the check should happen before the notification is created.
Do you want to create the issue?
123
(Taras)
October 27, 2021, 2:54am
10
It looks like someone beat me to it last month!
I searched through recent closed Issues and found that someone already reported it here:
opened 09:25AM - 27 Sep 21 UTC
closed 10:58AM - 07 Oct 21 UTC
### The problem
I have ignored some Integrations in the past (hue, fritz,...)… . with `default_config:`,`discovery:`, `ssdp:` and `zeroconf:` in my config.
After a while my Home Assistant instance becomes slow, so I started digging.
I started listen to the `call_service` event.
an event got triggered very often:
```
{
"event_type": "call_service",
"data": {
"domain": "persistent_notification",
"service": "dismiss",
"service_data": {
"notification_id": "config_entry_discovery"
}
},
"origin": "LOCAL",
"time_fired": "2021-09-27T09:01:47.171667+00:00",
"context": {
"id": "825ae962anonymized6c383176",
"parent_id": null,
"user_id": null
}
}
```
Before disabling `default_config`,`discovery`, `ssdp` and `zeroconf`:
hundreds of this events got triggered in one second.
(not all the time, but every 20seconds hundreds of events got triggered in a bunch, in between: only a few every few seconds)
After disabling the config entries the events only occur every 10/11sec.
But still I dont know how to disable them completely or if they harm anything.
After disabling the config entrys, I have no Integrations disabled or ignored anymore, and no "new entry discovered" notification is there, which is great, but I life in fear, that the call_services overload my event bus.
### What is version of Home Assistant Core has the issue?
2021.9.7
### What was the last working version of Home Assistant Core?
_No response_
### What type of installation are you running?
Home Assistant OS
### Integration causing the issue
_No response_
### Link to integration documentation on our website
_No response_
### Example YAML snippet
_No response_
### Anything in the logs that might be useful for us?
```txt
{
"event_type": "call_service",
"data": {
"domain": "persistent_notification",
"service": "dismiss",
"service_data": {
"notification_id": "config_entry_discovery"
}
},
"origin": "LOCAL",
"time_fired": "2021-09-27T09:01:47.171667+00:00",
"context": {
"id": "825ae962anonymized6c383176",
"parent_id": null,
"user_id": null
}
}
```
### Additional information
I have found a similar but still different problem: [https://github.com/home-assistant/core/issues/34331](https://github.com/home-assistant/core/issues/34331)
Bdraco responded with this PR:
home-assistant:dev
← bdraco:skip_notify_if_already_present
opened 09:14PM - 30 Sep 21 UTC
## Proposed change
<!--
Describe the big picture of your changes here to com… municate to the
maintainers why we should accept this pull request. If it fixes a bug
or resolves a feature request, be sure to link to that issue in the
additional information section.
-->
During startup there can be a storm of discovered device notifications
if there are large amount of esphome/etc devices on the network which
can cause a bit of I/O from all the events.
Fixes #56710
## Type of change
<!--
What type of change does your PR introduce to Home Assistant?
NOTE: Please, check only 1! box!
If your PR requires multiple boxes to be checked, you'll most likely need to
split it into multiple PRs. This makes things easier and faster to code review.
-->
- [ ] Dependency upgrade
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New integration (thank you!)
- [ ] New feature (which adds functionality to an existing integration)
- [ ] Breaking change (fix/feature causing existing functionality to break)
- [ ] Code quality improvements to existing code or addition of tests
## Additional information
<!--
Details are important, and help maintainers processing your PR.
Please be sure to fill out additional details, if applicable.
-->
- This PR fixes or closes issue: fixes #
- This PR is related to issue:
- Link to documentation pull request:
## Checklist
<!--
Put an `x` in the boxes that apply. You can also fill these out after
creating the PR. If you're unsure about any of them, don't hesitate to ask.
We're here to help! This is simply a reminder of what we are going to look
for before merging your code.
-->
- [ ] The code change is tested and works locally.
- [ ] Local tests pass. **Your PR cannot be merged unless tests pass**
- [ ] There is no commented out code in this PR.
- [ ] I have followed the [development checklist][dev-checklist]
- [ ] The code has been formatted using Black (`black --fast homeassistant tests`)
- [ ] Tests have been added to verify that the new code works.
If user exposed functionality or configuration variables are added/changed:
- [ ] Documentation added/updated for [www.home-assistant.io][docs-repository]
If the code communicates with devices, web services, or third-party tools:
- [ ] The [manifest file][manifest-docs] has all fields filled out correctly.
Updated and included derived files by running: `python3 -m script.hassfest`.
- [ ] New or updated dependencies have been added to `requirements_all.txt`.
Updated by running `python3 -m script.gen_requirements_all`.
- [ ] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
- [ ] Untested files have been added to `.coveragerc`.
The integration reached or maintains the following [Integration Quality Scale][quality-scale]:
<!--
The Integration Quality Scale scores an integration on the code quality
and user experience. Each level of the quality scale consists of a list
of requirements. We highly recommend getting your integration scored!
-->
- [ ] No score or internal
- [ ] 🥈 Silver
- [ ] 🥇 Gold
- [ ] 🏆 Platinum
<!--
This project is very active and we have a high turnover of pull requests.
Unfortunately, the number of incoming pull requests is higher than what our
reviewers can review and merge so there is a long backlog of pull requests
waiting for review. You can help here!
By reviewing another pull request, you will help raise the code quality of
that pull request and the final review will be faster. This way the general
pace of pull request reviews will go up and your wait time will go down.
When picking a pull request to review, try to choose one that hasn't yet
been reviewed.
Thanks for helping out!
-->
To help with the load of incoming pull requests:
- [ ] I have reviewed two other [open pull requests][prs] in this repository.
[prs]: https://github.com/home-assistant/core/pulls?q=is%3Aopen+is%3Apr+-author%3A%40me+-draft%3Atrue+-label%3Awaiting-for-upstream+sort%3Acreated-desc+review%3Anone
<!--
Thank you for contributing <3
Below, some useful links you could explore:
-->
[dev-checklist]: https://developers.home-assistant.io/docs/en/development_checklist.html
[manifest-docs]: https://developers.home-assistant.io/docs/en/creating_integration_manifest.html
[quality-scale]: https://developers.home-assistant.io/docs/en/next/integration_quality_scale_index.html
[docs-repository]: https://github.com/home-assistant/home-assistant.io
Balloob created a more recent PR addressing the same issue:
home-assistant:dev
← home-assistant:persistent-notif
opened 05:15AM - 06 Oct 21 UTC
<!--
You are amazing! Thanks for contributing to our project!
Please, DO N… OT DELETE ANY TEXT from this template! (unless instructed).
-->
## Breaking change
<!--
If your PR contains a breaking change for existing users, it is important
to tell them what breaks, how to make it work again and why we did this.
This piece of text is published with the release notes, so it helps if you
write it towards our users, not us.
Note: Remove this section if this PR is NOT a breaking change.
-->
**For developers:** It is deprecated to pass template strings to the `persistent_notification.async_create` method via Python (this is not the service).
## Proposed change
<!--
Describe the big picture of your changes here to communicate to the
maintainers why we should accept this pull request. If it fixes a bug
or resolves a feature request, be sure to link to that issue in the
additional information section.
-->
Persistent notifications still used the old (old old) approach of having functions call services to do the work. This meant that a lot of services got called, especially as we started to add more and more discovery. @bdraco started noticing it in his traces. This removes that logic and bypasses the services. This is the same approach as we have done in basically all other cases where we had this pattern.
I also took the liberty to:
- Convert the tests to async (first commit)
- Type the integration
Because we no longer route all data via services, it's no longer processing the input data as templates when called directly from another integration. This has been deprecated and a warning is logged.
The sync methods to create notifications have also been deprecated.
Fixes #56853
Fixes #56710
## Type of change
<!--
What type of change does your PR introduce to Home Assistant?
NOTE: Please, check only 1! box!
If your PR requires multiple boxes to be checked, you'll most likely need to
split it into multiple PRs. This makes things easier and faster to code review.
-->
- [ ] Dependency upgrade
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New integration (thank you!)
- [ ] New feature (which adds functionality to an existing integration)
- [ ] Breaking change (fix/feature causing existing functionality to break)
- [ ] Code quality improvements to existing code or addition of tests
## Additional information
<!--
Details are important, and help maintainers processing your PR.
Please be sure to fill out additional details, if applicable.
-->
- This PR fixes or closes issue: fixes #
- This PR is related to issue:
- Link to documentation pull request:
## Checklist
<!--
Put an `x` in the boxes that apply. You can also fill these out after
creating the PR. If you're unsure about any of them, don't hesitate to ask.
We're here to help! This is simply a reminder of what we are going to look
for before merging your code.
-->
- [ ] The code change is tested and works locally.
- [ ] Local tests pass. **Your PR cannot be merged unless tests pass**
- [ ] There is no commented out code in this PR.
- [ ] I have followed the [development checklist][dev-checklist]
- [ ] The code has been formatted using Black (`black --fast homeassistant tests`)
- [ ] Tests have been added to verify that the new code works.
If user exposed functionality or configuration variables are added/changed:
- [ ] Documentation added/updated for [www.home-assistant.io][docs-repository]
If the code communicates with devices, web services, or third-party tools:
- [ ] The [manifest file][manifest-docs] has all fields filled out correctly.
Updated and included derived files by running: `python3 -m script.hassfest`.
- [ ] New or updated dependencies have been added to `requirements_all.txt`.
Updated by running `python3 -m script.gen_requirements_all`.
- [ ] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
- [ ] Untested files have been added to `.coveragerc`.
The integration reached or maintains the following [Integration Quality Scale][quality-scale]:
<!--
The Integration Quality Scale scores an integration on the code quality
and user experience. Each level of the quality scale consists of a list
of requirements. We highly recommend getting your integration scored!
-->
- [ ] No score or internal
- [ ] 🥈 Silver
- [ ] 🥇 Gold
- [ ] 🏆 Platinum
<!--
This project is very active and we have a high turnover of pull requests.
Unfortunately, the number of incoming pull requests is higher than what our
reviewers can review and merge so there is a long backlog of pull requests
waiting for review. You can help here!
By reviewing another pull request, you will help raise the code quality of
that pull request and the final review will be faster. This way the general
pace of pull request reviews will go up and your wait time will go down.
When picking a pull request to review, try to choose one that hasn't yet
been reviewed.
Thanks for helping out!
-->
To help with the load of incoming pull requests:
- [ ] I have reviewed two other [open pull requests][prs] in this repository.
[prs]: https://github.com/home-assistant/core/pulls?q=is%3Aopen+is%3Apr+-author%3A%40me+-draft%3Atrue+-label%3Awaiting-for-upstream+sort%3Acreated-desc+review%3Anone
<!--
Thank you for contributing <3
Below, some useful links you could explore:
-->
[dev-checklist]: https://developers.home-assistant.io/docs/en/development_checklist.html
[manifest-docs]: https://developers.home-assistant.io/docs/en/creating_integration_manifest.html
[quality-scale]: https://developers.home-assistant.io/docs/en/next/integration_quality_scale_index.html
[docs-repository]: https://github.com/home-assistant/home-assistant.io
Both PRs were pulled into the dev
branch so they stand a good chance of appearing in the 2021.11.0 release.
1 Like