home-assistant.io
home-assistant.io copied to clipboard
Better info how ignore_attributes works
Feedback
I was looking for a way to ignore "icon_str" attribute being send to my InfluxDB instance. I configured my filter:
ignore_attributes:
- icon_str
But icon_str was still being reported. Then I found this issue: https://github.com/home-assistant/core/issues/47773
I think it should at least be mentioned in the docs, if not fixed in code.
Possible solutions:
- validate attribute names in
ignore_attributes, so that when I use a non-existent attribute name it is not silently ignored - strip
_strsuffix from attribute name, so that the the effect of ignoring an attribute it is obtained - fix the documentation, and provide the same info as in https://github.com/home-assistant/core/issues/47773
URL
https://www.home-assistant.io/integrations/influxdb/
Version
2022.7.7
Additional information
No response
Hey there @mdegat01, mind taking a look at this feedback as it has been labeled with an integration (influxdb) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
Only the third option is possible. Here's why:
validate attribute names in ignore_attributes, so that when I use a non-existent attribute name it is not silently ignored
Impossible. There's no such thing as an existent or non-existent attribute because there is no schema for attributes. Any attribute can appear or disappear on any entity at any point. There is no validation or rules around what makes an attribute valid or not. It is simply an additional space for integrations to put data.
Also this schema is checked at designtime so-to-speak. Config check does not look at the running state of HA. So as far as it can tell absolutely no attributes or entities exist. The only thing it can check is whether you put a list of strings in ignore_attributes, as long as you did that then the schema is valid.
strip _str suffix from attribute name, so that the the effect of ignoring an attribute it is obtained
Can't do that. icon_str is a fully valid attribute name and may actually exist on some entities in some integrations. See the point above - we have absolutely no way to know what attribute names are valid and which aren't. So by stripping this off we end up creating a new bug - users cannot ignore attribute icon_str from their entities which have that.
fix the documentation
Yea this we could do. It's come up a few times, it should be mentioned.
@mdegat01 Fair enough, thanks. I actually made a PR for doc change.