├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
└── workflows
│ ├── release.yaml
│ └── validate.yaml
├── .gitignore
├── EXAMPLES.md
├── LICENSE
├── MORE-INFO.md
├── README.md
├── after.png
├── before.png
├── before_2.png
├── custom-more-info.js
├── hacs.json
├── package.json
├── pnpm-lock.yaml
├── rollup.config.js
├── src
├── constants
│ └── index.ts
├── custom-more-info.ts
├── types
│ └── index.ts
└── utilities
│ └── index.ts
└── tsconfig.json
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: bug
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **Debug JSON from Inspector**
14 | ```
15 | {
16 | "hide": [
17 | "icon_color",
18 | "id"
19 | ],
20 | "unhide": [
21 | "device_class"
22 | ]
23 | }
24 | ```
25 | **Custom-more-info Version:**
26 | 1.0.0
27 |
28 | **Expected behavior**
29 | A clear and concise description of what you expected to happen.
30 |
31 | **Screenshots**
32 | If applicable, add screenshots to help explain your problem.
33 |
34 | **Dom Path of attributes dropdown box**
35 | Always include screenshot to the path of the attributes that error
36 | We cant help you without that exact info
37 |
38 | **Desktop (please complete the following information):**
39 | - OS: [e.g. iOS]
40 | - Browser [e.g. chrome, safari]
41 | - Version [e.g. 22]
42 |
43 | **Smartphone (please complete the following information):**
44 | - Device: [e.g. iPhone6]
45 | - OS: [e.g. iOS8.1]
46 | - Browser [e.g. stock browser, safari]
47 | - Version [e.g. 22]
48 |
49 | **The custom-more-info configuration**
50 | ```yaml
51 | filter_attributes:
52 | by_glob:
53 | '*.*':
54 | - id
55 | by_domain:
56 | light:
57 | - all
58 | ```
59 |
60 | **Additional context**
61 | Add any other context about the problem here.
62 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/.github/workflows/release.yaml:
--------------------------------------------------------------------------------
1 | name: Create release
2 |
3 | on:
4 | push:
5 | tags:
6 | - 'v[0-9]+.[0-9]+.[0-9]+'
7 |
8 | jobs:
9 | build:
10 | runs-on: ubuntu-latest
11 | steps:
12 | - name: Checkout
13 | uses: actions/checkout@v4
14 | - name: Install pnpm
15 | uses: pnpm/action-setup@v4
16 | with:
17 | version: 10
18 | run_install: false
19 | - name: Set-up Node
20 | uses: actions/setup-node@v4
21 | with:
22 | node-version: 20
23 | cache: 'pnpm'
24 | - name: Install deps
25 | run: pnpm install
26 | - name: Test
27 | run: pnpm test:ts
28 | - name: Build Changelog
29 | id: build_changelog
30 | uses: mikepenz/release-changelog-builder-action@v5
31 | with:
32 | configurationJson: |
33 | {
34 | "categories": [
35 | {
36 | "title": "## 🚀 Features",
37 | "labels": ["🌟 feature", "✨ feature-request", "enhancement", "request"]
38 | },
39 | {
40 | "title": "## 🛠 Fixes",
41 | "labels": ["fix", "🐛 bug"]
42 | },
43 | {
44 | "title": "## 🧩 Dependencies",
45 | "labels": ["dependencies"]
46 | },
47 | {
48 | "title": "## ⚙️ Configuration",
49 | "labels": ["configuration"]
50 | },
51 | {
52 | "title": "## 📝 Documentation",
53 | "labels": ["📝 documentation"]
54 | },
55 | {
56 | "title": "## 📦 Other",
57 | "labels": []
58 | }
59 | ],
60 | "template": "#{{CHANGELOG}}",
61 | "pr_template": "- #{{TITLE}}\n - PR: ##{{NUMBER}} by @#{{AUTHOR}}",
62 | "empty_template": "#{{OWNER}}\n#{{REPO}}\n#{{FROM_TAG}}\n#{{TO_TAG}}",
63 | "max_pull_requests": 1000,
64 | "max_back_track_time_days": 1000
65 | }
66 | env:
67 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68 | - name: Create a release
69 | uses: softprops/action-gh-release@v2
70 | with:
71 | files: |
72 | custom-more-info.js
73 | body: |
74 | ${{ steps.build_changelog.outputs.changelog }}
--------------------------------------------------------------------------------
/.github/workflows/validate.yaml:
--------------------------------------------------------------------------------
1 | name: Validate
2 |
3 | on:
4 | push:
5 | pull_request:
6 | schedule:
7 | - cron: "0 0 * * *"
8 | workflow_dispatch:
9 |
10 | jobs:
11 | validate-hacs:
12 | runs-on: "ubuntu-latest"
13 | steps:
14 | - uses: "actions/checkout@v4"
15 | - name: HACS validation
16 | uses: "hacs/action@main"
17 | with:
18 | category: "plugin"
19 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | .DS_Store
--------------------------------------------------------------------------------
/EXAMPLES.md:
--------------------------------------------------------------------------------
1 | ## Example configuration file
2 |
3 | ```yaml
4 | ##########################################################################################
5 | # Custom more-info configuration settings #
6 | # use a config per Dashboard, and add it to the root of the yaml file like #
7 | # #
8 | # ############################################################################ #
9 | # # title: Your Dashboard title # #
10 | # # # #
11 | # # button_card_templates: !include_dir_merge_named ../button_card_templates # #
12 | # # decluttering_templates: !include_dir_named ../decluttering_templates # #
13 | # # kiosk_mode: !include ../kiosk-mode/kiosk-mode.yaml # #
14 | # # custom_more_info: !include ../custom_more_info/custom_more_info.yaml # #
15 | # # # #
16 | # # views: # #
17 | # # - !include view_home.yaml # #
18 | # # - !include view_number_two # #
19 | # # - etc # #
20 | # ############################################################################ #
21 | # #
22 | ##########################################################################################
23 |
24 | # use the available 'debug' parameter if a filter does not work and you need to report
25 | # malfunctioning to the issue tracker.
26 |
27 | debug: true
28 |
29 | ##########################################################################################
30 | # Control the history icon in the header #
31 | ##########################################################################################
32 |
33 | auto_hide_header_history_icon: true
34 |
35 | hide_header_history_icon:
36 |
37 | by_domain:
38 | - input_datetime
39 | - automation
40 | - script
41 | - cover
42 | - group
43 |
44 | by_entity_id:
45 | - sun.sun
46 |
47 | ##########################################################################################
48 | # Control History section #
49 | ##########################################################################################
50 |
51 | hide_history:
52 | by_entity_id:
53 | - binary_sensor.ongemeten_verbruik_te_hoog
54 | - sensor.ha_main_config
55 |
56 | by_domain:
57 | - input_select
58 | - select
59 | - input_boolean
60 | - number
61 |
62 | by_device_class:
63 | - sound
64 |
65 | by_glob:
66 | - 'siren.*'
67 | - 'input_number.*'
68 |
69 | ##########################################################################################
70 | # Control Logbook section #
71 | ##########################################################################################
72 |
73 | hide_logbook:
74 |
75 | by_entity_id:
76 | - binary_sensor.ongemeten_verbruik_te_hoog
77 | - binary_sensor.power_using_off_switches
78 |
79 | by_domain:
80 | - input_select
81 | - select
82 | - input_boolean
83 | - number
84 | - device_tracker
85 |
86 | by_device_class:
87 | - sound
88 |
89 | ##########################################################################################
90 | # Unfilter #
91 | ##########################################################################################
92 |
93 | # special boolean setting for 'all'
94 | unfilter_all: true
95 |
96 | unfilter_attributes:
97 |
98 | by_domain:
99 | # filtered by Home Assistant by default
100 | binary_sensor:
101 | - device_class
102 |
103 | sensor:
104 | - device_class
105 |
106 | # filtered by User in the filter_attributes
107 | by_glob:
108 |
109 | 'device_tracker.google*':
110 | - ip
111 | - mac
112 | - ap_mac
113 |
114 | ##########################################################################################
115 | # Filter #
116 | ##########################################################################################
117 |
118 | # special boolean setting for 'all'
119 | filter_all: true
120 |
121 | filter_attributes:
122 |
123 | by_glob:
124 |
125 | '*.*':
126 | - icon_color
127 | - id
128 |
129 | # first filter 'all' in glob, then unfilter only what user needs in the unfilter section
130 | 'device_tracker.google*':
131 | - all
132 |
133 | 'sensor.ha_*_version':
134 | - all
135 |
136 | 'sensor.buienradar_*':
137 | - Stationname
138 |
139 | 'sensor.*_actueel': &meter # use a yaml anchor to easily c&p repetitive attributes
140 | - meter_type
141 | - meter_type_name
142 |
143 | 'sensor.*_totaal': *meter
144 |
145 | 'sensor.*_amperage': *meter
146 |
147 | 'sensor.*_voltage': *meter
148 |
149 | 'sensor.*_battery_state':
150 | - templates
151 |
152 | by_device_class:
153 |
154 | enum:
155 | - options
156 |
157 | by_domain:
158 |
159 | binary_sensor:
160 | - hysteresis
161 |
162 | light:
163 | - all
164 |
165 | siren:
166 | - available_tones
167 |
168 | by_entity_id:
169 |
170 | sensor.cpu_speed:
171 | - brand
172 |
173 | group.media_players_device_trackers:
174 | - all
175 |
176 | group.hub_device_trackers:
177 | - all
178 |
179 |
180 | ```
181 |
182 | ## Edit, safe (and refresh)
183 |
184 | If you are using [yaml mode](https://www.home-assistant.io/dashboards/dashboards/#using-yaml-for-the-default-dashboard), you need to refesh the Dashboard via the top right menu item (3-dots) and next reload the view after editing and saving your `filter_attributes`.
185 | The reload is required for [each Dashboard](https://www.home-assistant.io/dashboards/dashboards) you might use.
186 | On subviews, a second reload of the subview could be needed, just be sure the cache is cleared.
187 |
188 |
189 |
190 | When in storage mode (UI) `home-assistant-query-selector` takes care of that and you're set on safe. No need to refresh manually.
191 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/MORE-INFO.md:
--------------------------------------------------------------------------------
1 | MORE-INFO
2 |
3 | HomeAssistant filters many attributes that are deemed to be not of importance/relevance for the display in the Frontend More-info cards.
4 | Below the files are listed which the current Home Assistant Frontend employs to compute, control or Filter those attributes:
5 |
6 | Historic:
7 | - https://github.com/home-assistant/frontend/blob/7bc27082595f943d15ca35ae948c766184a93eed/src/util/hass-attributes-util.ts#L87
8 |
9 | Current:
10 | - https://github.com/home-assistant/frontend/blob/dev/src/data/entity_attributes.ts
11 | - https://github.com/home-assistant/frontend/blob/dev/src/components/ha-attributes.ts
12 | and more specifically
13 | - https://github.com/home-assistant/frontend/blob/dev/src/components/ha-attributes.ts#L24
14 | - https://github.com/home-assistant/frontend/blob/dev/src/common/entity/compute_attribute_display.ts
15 |
16 | With this custom resource we aim at allowing some flexibilty and customization of that selection of filtered attributes.
17 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Custom More-info for Home Assistant
2 |
3 | [](https://github.com/hacs/integration)
4 | [](https://github.com/Mariusthvdb/custom-more-info/releases)
5 | [](https://github.com/Mariusthvdb/custom-more-info/releases)
6 | [](https://github.com/Mariusthvdb/custom-more-info/commits/master)
7 | [](https://github.com/Mariusthvdb/custom-more-info)
8 |
9 | ### What is Custom More-info
10 |
11 | This is a custom Plugin for Home Assistant to customize *which entity attributes are displayed* in the Dashboard on `more-info` cards.
12 | Moreover, if configured so that no more attributes are left to display (all attributes are filtered), the *attributes dropdown box is not rendered at all*.
13 |
14 | Next to that, with this plugin users can customize when and when not to display the History and Logbook sections in the More-info card.
15 | Even the History icon in the Header can be hidden.
16 |
17 | From now on *you* are in control of the More-info attributes and all other sections.
18 | Filter all, unfilter all, or select which to see/hide by glob, domain, device_class, or entity_id.
19 | Any combination is possible!
20 |
21 | Custom More-info gives the user ultimate control over the More-info panel.
22 |
23 | If you want to hide the more-info panel completely, use [Kiosk-mode](https://github.com/NemesisRE/kiosk-mode), which is the ultimate tool for that and much more. Or check [this card-mod mod](https://github.com/Mariusthvdb/custom-more-info#prevent-more-info-completely) for preventing the more-info in individual entities.
24 |
25 | Note: This superseeds the existing custom-attributes plugin that focusses solely on the attributes [Custom-attributes](https://github.com/Mariusthvdb/custom-attributes).
26 |
27 | _______
28 |
29 | ## Installation
30 |
31 | Download and install the plugin like any other custom resource in Home Assistant.
32 |
33 |
34 |
35 |
36 | ## Enable
37 |
38 | To enable the plugin one needs to add the `custom_more_info` parameter to the root of the lovelace yaml file of each Dashboard:
39 |
40 | ```yaml
41 | custom_more_info:
42 | # Configuration
43 | ```
44 |
45 | ## Configuration options
46 |
47 | Available configuration options:
48 |
49 | * `debug`
50 | * `maximized_size`
51 | * `auto_hide_header_history_icon`
52 | * `hide_header_history_icon`
53 | * `unhide_header_history_icon`
54 |
55 | * `hide_history`
56 | * `unhide_history`
57 | * `hide_logbook`
58 | * `unhide_logbook`
59 |
60 | * `filter_all`
61 | * `unfilter_all`
62 | * `filter_attributes`
63 | * `unfilter_attributes`
64 |
65 | ```yaml
66 | custom_more_info:
67 | debug: true
68 | auto_hide_header_history_icon: true
69 | hide_header_history_icon:
70 | # parameters
71 | hide_header_history_icon:
72 | # parameters
73 |
74 | filter_all: true
75 | unfilter_all: true
76 | filter_attributes:
77 | # parameters
78 | unfilter_attributes:
79 | # parameters
80 | ```
81 |
82 | The parameters control which attributes and sections should be (un)filtered in the more-info dialogs.
83 |
84 | ### Available parameters:
85 |
86 | 4 'by' parameters allowing detailed customization on various levels, requiring an array of attributes
87 | * `by_entity_id`
88 | * `by_domain`
89 | * `by_device_class`
90 | * `by_glob`
91 |
92 | ### All possible options:
93 |
94 | ```yaml
95 | custom_more_info:
96 |
97 | debug: true/false
98 |
99 | maximized_size:
100 | by_entity_id:
101 | - sensor.netto_verbruik
102 | by_domain:
103 | - sensor
104 | by_device_class:
105 | - door
106 | by_glob:
107 | - 'sensor.*_actueel'
108 | - 'sensor.*_totaal'
109 |
110 | filter_all: true ##
111 | filter_attributes:
112 | by_entity_id:
113 | sensor.some_sensor:
114 | -
115 | -
116 | by_domain:
117 | binary_sensor:
118 | -
119 | -
120 | by_device_class:
121 | motion:
122 | -
123 | -
124 | by_glob:
125 | 'sensor.*_sensor':
126 | -
127 | -
128 | '*.*':
129 | -
130 |
131 | # identical structure for 'unfilter' on all parameters
132 |
133 | unfilter_all: true ##
134 | unfilter_attributes:
135 | by_entity_id:
136 |
137 | by_domain:
138 |
139 | by_device_class:
140 |
141 | by_glob:
142 |
143 | ```
144 |
145 | ### Special filter 'all'
146 |
147 | The `all` filter is available for all parameters:
148 |
149 | ```yaml
150 | filter_attributes:
151 | by_domain:
152 | light:
153 | - all
154 | ```
155 | and here, will filter all attributes on all Domain Light more-info panels.
156 |
157 | For the header-history-icon we also have a special `all` setting:
158 |
159 | ```yaml
160 | custom_more_info:
161 | ## The same with unhide_header_history_icon , hide_history, hide_logbook, unhide_history, and unhide_logbook
162 | hide_header_history_icon:
163 | all: true
164 | ```
165 |
166 | ### Filter merge
167 |
168 | Finally, all configured filters are merged.
169 | To check the complete filter that gets applied, enable `debug: true` and open an Inspector window, where the full JSON object is printed.
170 |
171 |
172 | ## Examples
173 |
174 | Please find some real life examples [here](https://github.com/Mariusthvdb/custom-more-info/blob/main/EXAMPLES.md) which explains all available options in detail.
175 |
176 | ## Prevent More-info completely
177 |
178 | This plugin is for customizing the more-info panel. If you want to prevent the More-info from popping up completely, you can do so using card-mod stylings:
179 |
180 | ```yaml
181 | card_mod:
182 | style:
183 | hui-generic-entity-row $: |
184 | state-badge {
185 | pointer-events: none;
186 | }
187 | ```
188 | which would prevent the pop-up when clicking the icon, but still allows interaction on a dropdown, eg when using an input_select entity.
189 | Preventing the more-info completely can be done with:
190 |
191 | ```yaml
192 | card_mod:
193 | style: |
194 | :host {
195 | pointer-events: none;
196 | }
197 | ```
198 |
199 |
200 | ### Result of Custom More-info
201 |
202 | **Before filtering:**
203 |
204 | Device_class attribute `options`
205 |
206 |
207 |
208 |
209 | Siren:
210 |
211 |
212 |
213 |
214 | Light group:
215 |
216 |
217 |
218 |
219 | **After filtering**
220 |
221 | Device_class attribute `options` after *('Mogelijke statussen' in Dutch)*
222 |
223 |
224 |
225 |
226 | Siren after:
227 |
228 |
229 |
230 |
231 | Light group after:
232 |
233 |
234 |
235 |
--------------------------------------------------------------------------------
/after.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Mariusthvdb/custom-more-info/7aa7ce5c624428c3dddeddf2b500e0990bf78ddf/after.png
--------------------------------------------------------------------------------
/before.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Mariusthvdb/custom-more-info/7aa7ce5c624428c3dddeddf2b500e0990bf78ddf/before.png
--------------------------------------------------------------------------------
/before_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Mariusthvdb/custom-more-info/7aa7ce5c624428c3dddeddf2b500e0990bf78ddf/before_2.png
--------------------------------------------------------------------------------
/custom-more-info.js:
--------------------------------------------------------------------------------
1 | !function(){"use strict";function t(t,e,n,o){return new(n||(n=Promise))((function(i,r){function s(t){try{l(o.next(t))}catch(t){r(t)}}function a(t){try{l(o.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((o=o.apply(t,e||[])).next())}))}function e(t,e){var n,o,i,r,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;r&&(r=0,a[0]&&(s=0)),s;)try{if(n=1,o&&(i=2&a[0]?o.return:a[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;switch(o=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,o=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]0&&i[i.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]=6.0.0'}
42 |
43 | '@jridgewell/resolve-uri@3.1.1':
44 | resolution: {integrity: sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==}
45 | engines: {node: '>=6.0.0'}
46 |
47 | '@jridgewell/set-array@1.1.2':
48 | resolution: {integrity: sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==}
49 | engines: {node: '>=6.0.0'}
50 |
51 | '@jridgewell/source-map@0.3.5':
52 | resolution: {integrity: sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==}
53 |
54 | '@jridgewell/sourcemap-codec@1.4.15':
55 | resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==}
56 |
57 | '@jridgewell/trace-mapping@0.3.20':
58 | resolution: {integrity: sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==}
59 |
60 | '@rollup/plugin-json@6.1.0':
61 | resolution: {integrity: sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==}
62 | engines: {node: '>=14.0.0'}
63 | peerDependencies:
64 | rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0
65 | peerDependenciesMeta:
66 | rollup:
67 | optional: true
68 |
69 | '@rollup/plugin-node-resolve@16.0.1':
70 | resolution: {integrity: sha512-tk5YCxJWIG81umIvNkSod2qK5KyQW19qcBF/B78n1bjtOON6gzKoVeSzAE8yHCZEDmqkHKkxplExA8KzdJLJpA==}
71 | engines: {node: '>=14.0.0'}
72 | peerDependencies:
73 | rollup: ^2.78.0||^3.0.0||^4.0.0
74 | peerDependenciesMeta:
75 | rollup:
76 | optional: true
77 |
78 | '@rollup/plugin-terser@0.4.4':
79 | resolution: {integrity: sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A==}
80 | engines: {node: '>=14.0.0'}
81 | peerDependencies:
82 | rollup: ^2.0.0||^3.0.0||^4.0.0
83 | peerDependenciesMeta:
84 | rollup:
85 | optional: true
86 |
87 | '@rollup/plugin-typescript@12.1.2':
88 | resolution: {integrity: sha512-cdtSp154H5sv637uMr1a8OTWB0L1SWDSm1rDGiyfcGcvQ6cuTs4MDk2BVEBGysUWago4OJN4EQZqOTl/QY3Jgg==}
89 | engines: {node: '>=14.0.0'}
90 | peerDependencies:
91 | rollup: ^2.14.0||^3.0.0||^4.0.0
92 | tslib: '*'
93 | typescript: '>=3.7.0'
94 | peerDependenciesMeta:
95 | rollup:
96 | optional: true
97 | tslib:
98 | optional: true
99 |
100 | '@rollup/pluginutils@5.1.0':
101 | resolution: {integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==}
102 | engines: {node: '>=14.0.0'}
103 | peerDependencies:
104 | rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0
105 | peerDependenciesMeta:
106 | rollup:
107 | optional: true
108 |
109 | '@rollup/rollup-android-arm-eabi@4.41.0':
110 | resolution: {integrity: sha512-KxN+zCjOYHGwCl4UCtSfZ6jrq/qi88JDUtiEFk8LELEHq2Egfc/FgW+jItZiOLRuQfb/3xJSgFuNPC9jzggX+A==}
111 | cpu: [arm]
112 | os: [android]
113 |
114 | '@rollup/rollup-android-arm64@4.41.0':
115 | resolution: {integrity: sha512-yDvqx3lWlcugozax3DItKJI5j05B0d4Kvnjx+5mwiUpWramVvmAByYigMplaoAQ3pvdprGCTCE03eduqE/8mPQ==}
116 | cpu: [arm64]
117 | os: [android]
118 |
119 | '@rollup/rollup-darwin-arm64@4.41.0':
120 | resolution: {integrity: sha512-2KOU574vD3gzcPSjxO0eyR5iWlnxxtmW1F5CkNOHmMlueKNCQkxR6+ekgWyVnz6zaZihpUNkGxjsYrkTJKhkaw==}
121 | cpu: [arm64]
122 | os: [darwin]
123 |
124 | '@rollup/rollup-darwin-x64@4.41.0':
125 | resolution: {integrity: sha512-gE5ACNSxHcEZyP2BA9TuTakfZvULEW4YAOtxl/A/YDbIir/wPKukde0BNPlnBiP88ecaN4BJI2TtAd+HKuZPQQ==}
126 | cpu: [x64]
127 | os: [darwin]
128 |
129 | '@rollup/rollup-freebsd-arm64@4.41.0':
130 | resolution: {integrity: sha512-GSxU6r5HnWij7FoSo7cZg3l5GPg4HFLkzsFFh0N/b16q5buW1NAWuCJ+HMtIdUEi6XF0qH+hN0TEd78laRp7Dg==}
131 | cpu: [arm64]
132 | os: [freebsd]
133 |
134 | '@rollup/rollup-freebsd-x64@4.41.0':
135 | resolution: {integrity: sha512-KGiGKGDg8qLRyOWmk6IeiHJzsN/OYxO6nSbT0Vj4MwjS2XQy/5emsmtoqLAabqrohbgLWJ5GV3s/ljdrIr8Qjg==}
136 | cpu: [x64]
137 | os: [freebsd]
138 |
139 | '@rollup/rollup-linux-arm-gnueabihf@4.41.0':
140 | resolution: {integrity: sha512-46OzWeqEVQyX3N2/QdiU/CMXYDH/lSHpgfBkuhl3igpZiaB3ZIfSjKuOnybFVBQzjsLwkus2mjaESy8H41SzvA==}
141 | cpu: [arm]
142 | os: [linux]
143 |
144 | '@rollup/rollup-linux-arm-musleabihf@4.41.0':
145 | resolution: {integrity: sha512-lfgW3KtQP4YauqdPpcUZHPcqQXmTmH4nYU0cplNeW583CMkAGjtImw4PKli09NFi2iQgChk4e9erkwlfYem6Lg==}
146 | cpu: [arm]
147 | os: [linux]
148 |
149 | '@rollup/rollup-linux-arm64-gnu@4.41.0':
150 | resolution: {integrity: sha512-nn8mEyzMbdEJzT7cwxgObuwviMx6kPRxzYiOl6o/o+ChQq23gfdlZcUNnt89lPhhz3BYsZ72rp0rxNqBSfqlqw==}
151 | cpu: [arm64]
152 | os: [linux]
153 |
154 | '@rollup/rollup-linux-arm64-musl@4.41.0':
155 | resolution: {integrity: sha512-l+QK99je2zUKGd31Gh+45c4pGDAqZSuWQiuRFCdHYC2CSiO47qUWsCcenrI6p22hvHZrDje9QjwSMAFL3iwXwQ==}
156 | cpu: [arm64]
157 | os: [linux]
158 |
159 | '@rollup/rollup-linux-loongarch64-gnu@4.41.0':
160 | resolution: {integrity: sha512-WbnJaxPv1gPIm6S8O/Wg+wfE/OzGSXlBMbOe4ie+zMyykMOeqmgD1BhPxZQuDqwUN+0T/xOFtL2RUWBspnZj3w==}
161 | cpu: [loong64]
162 | os: [linux]
163 |
164 | '@rollup/rollup-linux-powerpc64le-gnu@4.41.0':
165 | resolution: {integrity: sha512-eRDWR5t67/b2g8Q/S8XPi0YdbKcCs4WQ8vklNnUYLaSWF+Cbv2axZsp4jni6/j7eKvMLYCYdcsv8dcU+a6QNFg==}
166 | cpu: [ppc64]
167 | os: [linux]
168 |
169 | '@rollup/rollup-linux-riscv64-gnu@4.41.0':
170 | resolution: {integrity: sha512-TWrZb6GF5jsEKG7T1IHwlLMDRy2f3DPqYldmIhnA2DVqvvhY2Ai184vZGgahRrg8k9UBWoSlHv+suRfTN7Ua4A==}
171 | cpu: [riscv64]
172 | os: [linux]
173 |
174 | '@rollup/rollup-linux-riscv64-musl@4.41.0':
175 | resolution: {integrity: sha512-ieQljaZKuJpmWvd8gW87ZmSFwid6AxMDk5bhONJ57U8zT77zpZ/TPKkU9HpnnFrM4zsgr4kiGuzbIbZTGi7u9A==}
176 | cpu: [riscv64]
177 | os: [linux]
178 |
179 | '@rollup/rollup-linux-s390x-gnu@4.41.0':
180 | resolution: {integrity: sha512-/L3pW48SxrWAlVsKCN0dGLB2bi8Nv8pr5S5ocSM+S0XCn5RCVCXqi8GVtHFsOBBCSeR+u9brV2zno5+mg3S4Aw==}
181 | cpu: [s390x]
182 | os: [linux]
183 |
184 | '@rollup/rollup-linux-x64-gnu@4.41.0':
185 | resolution: {integrity: sha512-XMLeKjyH8NsEDCRptf6LO8lJk23o9wvB+dJwcXMaH6ZQbbkHu2dbGIUindbMtRN6ux1xKi16iXWu6q9mu7gDhQ==}
186 | cpu: [x64]
187 | os: [linux]
188 |
189 | '@rollup/rollup-linux-x64-musl@4.41.0':
190 | resolution: {integrity: sha512-m/P7LycHZTvSQeXhFmgmdqEiTqSV80zn6xHaQ1JSqwCtD1YGtwEK515Qmy9DcB2HK4dOUVypQxvhVSy06cJPEg==}
191 | cpu: [x64]
192 | os: [linux]
193 |
194 | '@rollup/rollup-win32-arm64-msvc@4.41.0':
195 | resolution: {integrity: sha512-4yodtcOrFHpbomJGVEqZ8fzD4kfBeCbpsUy5Pqk4RluXOdsWdjLnjhiKy2w3qzcASWd04fp52Xz7JKarVJ5BTg==}
196 | cpu: [arm64]
197 | os: [win32]
198 |
199 | '@rollup/rollup-win32-ia32-msvc@4.41.0':
200 | resolution: {integrity: sha512-tmazCrAsKzdkXssEc65zIE1oC6xPHwfy9d5Ta25SRCDOZS+I6RypVVShWALNuU9bxIfGA0aqrmzlzoM5wO5SPQ==}
201 | cpu: [ia32]
202 | os: [win32]
203 |
204 | '@rollup/rollup-win32-x64-msvc@4.41.0':
205 | resolution: {integrity: sha512-h1J+Yzjo/X+0EAvR2kIXJDuTuyT7drc+t2ALY0nIcGPbTatNOf0VWdhEA2Z4AAjv6X1NJV7SYo5oCTYRJhSlVA==}
206 | cpu: [x64]
207 | os: [win32]
208 |
209 | '@types/estree@1.0.5':
210 | resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==}
211 |
212 | '@types/estree@1.0.7':
213 | resolution: {integrity: sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==}
214 |
215 | '@types/resolve@1.20.2':
216 | resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==}
217 |
218 | acorn@8.11.2:
219 | resolution: {integrity: sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==}
220 | engines: {node: '>=0.4.0'}
221 | hasBin: true
222 |
223 | buffer-from@1.1.2:
224 | resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==}
225 |
226 | commander@2.20.3:
227 | resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==}
228 |
229 | deepmerge@4.3.1:
230 | resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==}
231 | engines: {node: '>=0.10.0'}
232 |
233 | estree-walker@2.0.2:
234 | resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==}
235 |
236 | fsevents@2.3.3:
237 | resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
238 | engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
239 | os: [darwin]
240 |
241 | function-bind@1.1.2:
242 | resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==}
243 |
244 | get-promisable-result@1.0.1:
245 | resolution: {integrity: sha512-hUUKs/s8qoeH4gk3NPcKjCWaCjOv0S+kyT3oTuJXneEWYzwmyfEJHESU2ES7pMZNVHTjMt7X8hpmThFfggTVtg==}
246 |
247 | hasown@2.0.0:
248 | resolution: {integrity: sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==}
249 | engines: {node: '>= 0.4'}
250 |
251 | home-assistant-query-selector@4.3.0:
252 | resolution: {integrity: sha512-L+TfdKKlqKAijIp/dWYKmtQWmTT+S9CZOM43L1lu1azPwVqIhJ2nlzf4GZ1MpWlGjY0+kn4sip0TYxvSCpZeeg==}
253 |
254 | is-core-module@2.13.1:
255 | resolution: {integrity: sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==}
256 |
257 | is-module@1.0.0:
258 | resolution: {integrity: sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==}
259 |
260 | path-parse@1.0.7:
261 | resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==}
262 |
263 | picomatch@2.3.1:
264 | resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==}
265 | engines: {node: '>=8.6'}
266 |
267 | randombytes@2.1.0:
268 | resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==}
269 |
270 | resolve@1.22.8:
271 | resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==}
272 | hasBin: true
273 |
274 | rollup@4.41.0:
275 | resolution: {integrity: sha512-HqMFpUbWlf/tvcxBFNKnJyzc7Lk+XO3FGc3pbNBLqEbOz0gPLRgcrlS3UF4MfUrVlstOaP/q0kM6GVvi+LrLRg==}
276 | engines: {node: '>=18.0.0', npm: '>=8.0.0'}
277 | hasBin: true
278 |
279 | safe-buffer@5.2.1:
280 | resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==}
281 |
282 | serialize-javascript@6.0.2:
283 | resolution: {integrity: sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==}
284 |
285 | shadow-dom-selector@5.0.1:
286 | resolution: {integrity: sha512-f7KFwXGR2DdeQmsFXrjYV3nrYuVAuFUqW0hpwJh/gynMnF/Q8gt+y1n/kPOYj25wo/xFL+EvaUuuZ8EwJ5NYhg==}
287 |
288 | smob@1.5.0:
289 | resolution: {integrity: sha512-g6T+p7QO8npa+/hNx9ohv1E5pVCmWrVCUzUXJyLdMmftX6ER0oiWY/w9knEonLpnOp6b6FenKnMfR8gqwWdwig==}
290 |
291 | source-map-support@0.5.21:
292 | resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==}
293 |
294 | source-map@0.6.1:
295 | resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==}
296 | engines: {node: '>=0.10.0'}
297 |
298 | supports-preserve-symlinks-flag@1.0.0:
299 | resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
300 | engines: {node: '>= 0.4'}
301 |
302 | terser@5.26.0:
303 | resolution: {integrity: sha512-dytTGoE2oHgbNV9nTzgBEPaqAWvcJNl66VZ0BkJqlvp71IjO8CxdBx/ykCNb47cLnCmCvRZ6ZR0tLkqvZCdVBQ==}
304 | engines: {node: '>=10'}
305 | hasBin: true
306 |
307 | tslib@2.6.2:
308 | resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==}
309 |
310 | typescript@5.8.3:
311 | resolution: {integrity: sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==}
312 | engines: {node: '>=14.17'}
313 | hasBin: true
314 |
315 | snapshots:
316 |
317 | '@jridgewell/gen-mapping@0.3.3':
318 | dependencies:
319 | '@jridgewell/set-array': 1.1.2
320 | '@jridgewell/sourcemap-codec': 1.4.15
321 | '@jridgewell/trace-mapping': 0.3.20
322 |
323 | '@jridgewell/resolve-uri@3.1.1': {}
324 |
325 | '@jridgewell/set-array@1.1.2': {}
326 |
327 | '@jridgewell/source-map@0.3.5':
328 | dependencies:
329 | '@jridgewell/gen-mapping': 0.3.3
330 | '@jridgewell/trace-mapping': 0.3.20
331 |
332 | '@jridgewell/sourcemap-codec@1.4.15': {}
333 |
334 | '@jridgewell/trace-mapping@0.3.20':
335 | dependencies:
336 | '@jridgewell/resolve-uri': 3.1.1
337 | '@jridgewell/sourcemap-codec': 1.4.15
338 |
339 | '@rollup/plugin-json@6.1.0(rollup@4.41.0)':
340 | dependencies:
341 | '@rollup/pluginutils': 5.1.0(rollup@4.41.0)
342 | optionalDependencies:
343 | rollup: 4.41.0
344 |
345 | '@rollup/plugin-node-resolve@16.0.1(rollup@4.41.0)':
346 | dependencies:
347 | '@rollup/pluginutils': 5.1.0(rollup@4.41.0)
348 | '@types/resolve': 1.20.2
349 | deepmerge: 4.3.1
350 | is-module: 1.0.0
351 | resolve: 1.22.8
352 | optionalDependencies:
353 | rollup: 4.41.0
354 |
355 | '@rollup/plugin-terser@0.4.4(rollup@4.41.0)':
356 | dependencies:
357 | serialize-javascript: 6.0.2
358 | smob: 1.5.0
359 | terser: 5.26.0
360 | optionalDependencies:
361 | rollup: 4.41.0
362 |
363 | '@rollup/plugin-typescript@12.1.2(rollup@4.41.0)(tslib@2.6.2)(typescript@5.8.3)':
364 | dependencies:
365 | '@rollup/pluginutils': 5.1.0(rollup@4.41.0)
366 | resolve: 1.22.8
367 | typescript: 5.8.3
368 | optionalDependencies:
369 | rollup: 4.41.0
370 | tslib: 2.6.2
371 |
372 | '@rollup/pluginutils@5.1.0(rollup@4.41.0)':
373 | dependencies:
374 | '@types/estree': 1.0.5
375 | estree-walker: 2.0.2
376 | picomatch: 2.3.1
377 | optionalDependencies:
378 | rollup: 4.41.0
379 |
380 | '@rollup/rollup-android-arm-eabi@4.41.0':
381 | optional: true
382 |
383 | '@rollup/rollup-android-arm64@4.41.0':
384 | optional: true
385 |
386 | '@rollup/rollup-darwin-arm64@4.41.0':
387 | optional: true
388 |
389 | '@rollup/rollup-darwin-x64@4.41.0':
390 | optional: true
391 |
392 | '@rollup/rollup-freebsd-arm64@4.41.0':
393 | optional: true
394 |
395 | '@rollup/rollup-freebsd-x64@4.41.0':
396 | optional: true
397 |
398 | '@rollup/rollup-linux-arm-gnueabihf@4.41.0':
399 | optional: true
400 |
401 | '@rollup/rollup-linux-arm-musleabihf@4.41.0':
402 | optional: true
403 |
404 | '@rollup/rollup-linux-arm64-gnu@4.41.0':
405 | optional: true
406 |
407 | '@rollup/rollup-linux-arm64-musl@4.41.0':
408 | optional: true
409 |
410 | '@rollup/rollup-linux-loongarch64-gnu@4.41.0':
411 | optional: true
412 |
413 | '@rollup/rollup-linux-powerpc64le-gnu@4.41.0':
414 | optional: true
415 |
416 | '@rollup/rollup-linux-riscv64-gnu@4.41.0':
417 | optional: true
418 |
419 | '@rollup/rollup-linux-riscv64-musl@4.41.0':
420 | optional: true
421 |
422 | '@rollup/rollup-linux-s390x-gnu@4.41.0':
423 | optional: true
424 |
425 | '@rollup/rollup-linux-x64-gnu@4.41.0':
426 | optional: true
427 |
428 | '@rollup/rollup-linux-x64-musl@4.41.0':
429 | optional: true
430 |
431 | '@rollup/rollup-win32-arm64-msvc@4.41.0':
432 | optional: true
433 |
434 | '@rollup/rollup-win32-ia32-msvc@4.41.0':
435 | optional: true
436 |
437 | '@rollup/rollup-win32-x64-msvc@4.41.0':
438 | optional: true
439 |
440 | '@types/estree@1.0.5': {}
441 |
442 | '@types/estree@1.0.7': {}
443 |
444 | '@types/resolve@1.20.2': {}
445 |
446 | acorn@8.11.2: {}
447 |
448 | buffer-from@1.1.2: {}
449 |
450 | commander@2.20.3: {}
451 |
452 | deepmerge@4.3.1: {}
453 |
454 | estree-walker@2.0.2: {}
455 |
456 | fsevents@2.3.3:
457 | optional: true
458 |
459 | function-bind@1.1.2: {}
460 |
461 | get-promisable-result@1.0.1: {}
462 |
463 | hasown@2.0.0:
464 | dependencies:
465 | function-bind: 1.1.2
466 |
467 | home-assistant-query-selector@4.3.0:
468 | dependencies:
469 | shadow-dom-selector: 5.0.1
470 |
471 | is-core-module@2.13.1:
472 | dependencies:
473 | hasown: 2.0.0
474 |
475 | is-module@1.0.0: {}
476 |
477 | path-parse@1.0.7: {}
478 |
479 | picomatch@2.3.1: {}
480 |
481 | randombytes@2.1.0:
482 | dependencies:
483 | safe-buffer: 5.2.1
484 |
485 | resolve@1.22.8:
486 | dependencies:
487 | is-core-module: 2.13.1
488 | path-parse: 1.0.7
489 | supports-preserve-symlinks-flag: 1.0.0
490 |
491 | rollup@4.41.0:
492 | dependencies:
493 | '@types/estree': 1.0.7
494 | optionalDependencies:
495 | '@rollup/rollup-android-arm-eabi': 4.41.0
496 | '@rollup/rollup-android-arm64': 4.41.0
497 | '@rollup/rollup-darwin-arm64': 4.41.0
498 | '@rollup/rollup-darwin-x64': 4.41.0
499 | '@rollup/rollup-freebsd-arm64': 4.41.0
500 | '@rollup/rollup-freebsd-x64': 4.41.0
501 | '@rollup/rollup-linux-arm-gnueabihf': 4.41.0
502 | '@rollup/rollup-linux-arm-musleabihf': 4.41.0
503 | '@rollup/rollup-linux-arm64-gnu': 4.41.0
504 | '@rollup/rollup-linux-arm64-musl': 4.41.0
505 | '@rollup/rollup-linux-loongarch64-gnu': 4.41.0
506 | '@rollup/rollup-linux-powerpc64le-gnu': 4.41.0
507 | '@rollup/rollup-linux-riscv64-gnu': 4.41.0
508 | '@rollup/rollup-linux-riscv64-musl': 4.41.0
509 | '@rollup/rollup-linux-s390x-gnu': 4.41.0
510 | '@rollup/rollup-linux-x64-gnu': 4.41.0
511 | '@rollup/rollup-linux-x64-musl': 4.41.0
512 | '@rollup/rollup-win32-arm64-msvc': 4.41.0
513 | '@rollup/rollup-win32-ia32-msvc': 4.41.0
514 | '@rollup/rollup-win32-x64-msvc': 4.41.0
515 | fsevents: 2.3.3
516 |
517 | safe-buffer@5.2.1: {}
518 |
519 | serialize-javascript@6.0.2:
520 | dependencies:
521 | randombytes: 2.1.0
522 |
523 | shadow-dom-selector@5.0.1:
524 | dependencies:
525 | get-promisable-result: 1.0.1
526 |
527 | smob@1.5.0: {}
528 |
529 | source-map-support@0.5.21:
530 | dependencies:
531 | buffer-from: 1.1.2
532 | source-map: 0.6.1
533 |
534 | source-map@0.6.1: {}
535 |
536 | supports-preserve-symlinks-flag@1.0.0: {}
537 |
538 | terser@5.26.0:
539 | dependencies:
540 | '@jridgewell/source-map': 0.3.5
541 | acorn: 8.11.2
542 | commander: 2.20.3
543 | source-map-support: 0.5.21
544 |
545 | tslib@2.6.2:
546 | optional: true
547 |
548 | typescript@5.8.3: {}
549 |
--------------------------------------------------------------------------------
/rollup.config.js:
--------------------------------------------------------------------------------
1 | import typescript from '@rollup/plugin-typescript';
2 | import json from '@rollup/plugin-json';
3 | import terser from '@rollup/plugin-terser';
4 | import { nodeResolve } from '@rollup/plugin-node-resolve';
5 |
6 | export default {
7 | plugins: [
8 | nodeResolve(),
9 | json(),
10 | typescript(),
11 | terser({
12 | output: {
13 | comments: false
14 | }
15 | })
16 | ],
17 | input: 'src/custom-more-info.ts',
18 | output: {
19 | file: './custom-more-info.js',
20 | format: 'iife'
21 | }
22 | };
--------------------------------------------------------------------------------
/src/constants/index.ts:
--------------------------------------------------------------------------------
1 | export const NAME = 'Custom-more-info';
2 | export const DESCRIPTION = 'Custom more-info for Home Assistant';
3 | export const URL = 'https://github.com/Mariusthvdb/custom-more-info';
4 |
5 | export const STYLES_PREFIX = 'custom_more_info';
6 | export const MAX_ATTEMPTS = 100;
7 | export const RETRY_DELAY = 10;
8 |
9 | export enum SELECTOR {
10 | HUI_VIEW = 'hui-view',
11 | MORE_INFO_CONTENT = 'more-info-content',
12 | MORE_INFO_HISTORY = 'ha-more-info-history',
13 | MORE_INFO_LOGBOOK = 'ha-more-info-logbook',
14 | HA_ATTRIBUTES = 'ha-attributes',
15 | MENU_ITEM = 'ha-icon-button',
16 | MENU_ITEM_ICON = 'mwc-icon-button',
17 | MORE_INFO_HEADER = 'ha-dialog-header',
18 | MORE_INFO_HEADER_HISTORY_ICON = 'ha-icon-button[data-custom-selector="DIALOG_HISTORY"]'
19 | }
20 |
21 | export enum MENU {
22 | SEARCH = 'SEARCH',
23 | ASSIST = 'ASSIST',
24 | REFRESH = 'REFRESH',
25 | UNUSED_ENTITIES = 'UNUSED_ENTITIES',
26 | RELOAD_RESOURCES = 'RELOAD_RESOURCES',
27 | EDIT_DASHBOARD = 'EDIT_DASHBOARD',
28 | DIALOG_DISMISS = 'DIALOG_DISMISS',
29 | DIALOG_HISTORY = 'DIALOG_HISTORY',
30 | DIALOG_SETTINGS = 'DIALOG_SETTINGS'
31 | }
32 |
33 | const UI_PREFIX = 'ui';
34 | const COMMON_PREFIX = `${UI_PREFIX}.common`;
35 | const DIALOGS_PREFIX = `${UI_PREFIX}.dialogs.more_info_control`;
36 |
37 | export const MENU_REFERENCES = Object.freeze({
38 | [MENU.DIALOG_HISTORY]: `${DIALOGS_PREFIX}.history`,
39 | [MENU.DIALOG_SETTINGS]: `${DIALOGS_PREFIX}.settings`,
40 | [MENU.DIALOG_DISMISS]: `${COMMON_PREFIX}.close`
41 | });
42 |
43 | export const ESCAPE_REG_EXP = /[.?+^$[\]\\(){}|-]/g;
44 | export const DOMAIN_REG_EXP = /^(.+)\..+$/;
45 |
46 | export const ALL_FILTER = 'all';
47 |
48 | export const IGNORED_ATTRIBUTES = [
49 | 'assumed_state',
50 | 'attribution',
51 | 'custom_ui_more_info',
52 | 'custom_ui_state_card',
53 | 'device_class',
54 | 'editable',
55 | 'emulated_hue_name',
56 | 'emulated_hue',
57 | 'entity_id',
58 | 'entity_picture',
59 | 'event_types',
60 | 'friendly_name',
61 | 'haaska_hidden',
62 | 'haaska_name',
63 | 'icon',
64 | 'initial_state',
65 | 'last_reset',
66 | 'restored',
67 | 'state_class',
68 | 'supported_features',
69 | 'unit_of_measurement'
70 | ];
--------------------------------------------------------------------------------
/src/custom-more-info.ts:
--------------------------------------------------------------------------------
1 | import {
2 | HAQuerySelector,
3 | HAQuerySelectorEvent,
4 | OnLovelacePanelLoadDetail,
5 | OnMoreInfoDialogOpenDetail,
6 | OnHistoryAndLogBookDialogOpenDetail
7 | } from 'home-assistant-query-selector';
8 | import {
9 | Lovelace,
10 | CustomMoreInfoConfig,
11 | ExtendedEntityRegistryEntry,
12 | Attributes,
13 | InternalFilters,
14 | InternalConfig,
15 | MoreInfoDialog,
16 | HomeAssistant,
17 | ConditionalFilter
18 | } from '@types';
19 | import {
20 | NAME,
21 | DESCRIPTION,
22 | SELECTOR,
23 | ESCAPE_REG_EXP,
24 | DOMAIN_REG_EXP,
25 | ALL_FILTER,
26 | IGNORED_ATTRIBUTES,
27 | MAX_ATTEMPTS,
28 | RETRY_DELAY
29 | } from '@constants';
30 | import {
31 | addStyle,
32 | removeStyle,
33 | getHiddenStyle,
34 | getTranslations,
35 | addDataSelectors
36 | } from '@utilities';
37 | import { version } from '../package.json';
38 |
39 | class CustomMoreInfo {
40 |
41 | constructor() {
42 | this._selector = new HAQuerySelector({
43 | retries: MAX_ATTEMPTS,
44 | delay: RETRY_DELAY
45 | });
46 | this._selector.addEventListener(HAQuerySelectorEvent.ON_LOVELACE_PANEL_LOAD, (event) => {
47 | this.storeConfig(event.detail);
48 | });
49 | this._selector.addEventListener(HAQuerySelectorEvent.ON_MORE_INFO_DIALOG_OPEN, (event) => {
50 | this._debug('a more info dialog has been opened so applying customizations');
51 | this.queryAttributes(event.detail);
52 | this.queryDialogElements(event.detail);
53 | });
54 | this._selector.addEventListener(HAQuerySelectorEvent.ON_HISTORY_AND_LOGBOOK_DIALOG_OPEN, (event) => {
55 | this._debug('a history and logbook dialog has been opened so applying customizations');
56 | this.queryDialogElements(event.detail);
57 | });
58 | this._extendedEntityRegistryEntry = new Map<
59 | string,
60 | ExtendedEntityRegistryEntry
61 | >();
62 | this._selector.listen();
63 | }
64 |
65 | private _selector: HAQuerySelector;
66 | private _config: CustomMoreInfoConfig;
67 | private _filters: Record;
68 | private _conditionalConfig: Record;
69 | private _translations: Record;
70 | private _extendedEntityRegistryEntry: Map<
71 | string,
72 | ExtendedEntityRegistryEntry
73 | >;
74 |
75 | private _insertAttributesGlobs(
76 | entityId: string,
77 | hide: Record | undefined,
78 | show: Record | undefined,
79 | hideSet: Set,
80 | showSet: Set
81 | ): void {
82 | this._addSetValues(
83 | hideSet,
84 | this._getFiltersByGlob(entityId, hide)
85 | );
86 | this._addSetValues(
87 | showSet,
88 | this._getFiltersByGlob(entityId, show)
89 | );
90 | }
91 |
92 | private _insertParameters(
93 | hide: string[] | undefined,
94 | show: string[] | undefined,
95 | hideSet: Set,
96 | showSet: Set
97 | ): void {
98 | this._addSetValues(
99 | hideSet,
100 | hide
101 | );
102 | this._addSetValues(
103 | showSet,
104 | show
105 | );
106 | }
107 |
108 | private async _getExtendedEntityRegistryEntry(
109 | dialog: MoreInfoDialog
110 | ): Promise {
111 | const entity_id = dialog._entityId;
112 | if (entity_id) {
113 | return (
114 | this._extendedEntityRegistryEntry.get(entity_id) ??
115 | dialog.hass.callWS({
116 | type: 'config/entity_registry/get',
117 | entity_id
118 | })
119 | .then((registry: ExtendedEntityRegistryEntry) => {
120 | this._extendedEntityRegistryEntry.set(entity_id, registry);
121 | return registry;
122 | })
123 | .catch((): null => null)
124 | );
125 | }
126 | return null;
127 | };
128 |
129 | private async _getDialogDeviceClass(dialog: MoreInfoDialog): Promise {
130 | const registry = await this._getExtendedEntityRegistryEntry(dialog);
131 | return registry?.original_device_class ?? null;
132 | }
133 |
134 | private _getDomain(entityId: string): string {
135 | return entityId.replace(DOMAIN_REG_EXP, '$1');
136 | }
137 |
138 | private _getEntityIdRegExp(glob: string): RegExp {
139 | const regExpString = glob
140 | .replace(ESCAPE_REG_EXP, '\\$&')
141 | .replace(/\*/g, '.*');
142 | return new RegExp(`^${regExpString}$`);
143 | }
144 |
145 | private _addSetValues(set: Set, values: string[] = []): void {
146 | values.forEach((value: string): void => {
147 | set.add(value);
148 | });
149 | }
150 |
151 | private _anyConfigMatch(
152 | parameter: ConditionalFilter | undefined,
153 | entityId: string,
154 | deviceClass: string,
155 | domain: string
156 | ): boolean {
157 | return (
158 | this._anyGlobMatch(entityId, parameter?.by_glob) ||
159 | parameter?.by_device_class?.includes(deviceClass) ||
160 | parameter?.by_domain?.includes(domain) ||
161 | parameter?.by_entity_id?.includes(entityId)
162 | );
163 | }
164 |
165 | private _debug(message: unknown): void {
166 | if (this._config?.debug) {
167 | if (
168 | typeof message === 'object' &&
169 | !(message instanceof Node)
170 | ) {
171 | console.debug(
172 | JSON.stringify(message, null, 4)
173 | );
174 | } else {
175 | console.debug(message);
176 | }
177 | }
178 | }
179 |
180 | private _globMatch(entityId: string, glob: string): boolean {
181 | const regExp = this._getEntityIdRegExp(glob);
182 | return regExp.test(entityId);
183 | }
184 |
185 | private _anyGlobMatch(entityId: string, globs: string[] = []): boolean {
186 | const find = globs.find((glob: string) => this._globMatch(entityId, glob));
187 | return !!find;
188 | }
189 |
190 | private _getFiltersByGlob(entityId: string, filter: Record = {}): string[] {
191 | const filters: string[] = [];
192 | Object.entries(filter).forEach((entry: [string, string[]]): void => {
193 | const [ glob, globFilters ] = entry;
194 | if (this._globMatch(entityId, glob)) {
195 | filters.push(...globFilters);
196 | }
197 | });
198 | return filters;
199 | }
200 |
201 | protected storeConfig(detail: OnLovelacePanelLoadDetail): void {
202 | detail.HA_PANEL_LOVELACE.element
203 | .then((lovelacePanel: Lovelace): void => {
204 | const config = lovelacePanel?.lovelace?.config?.custom_more_info;
205 | if (config) {
206 | this._config = config;
207 | this._debug('the config has been loaded, printing the config...');
208 | } else if (
209 | !this._config ||
210 | !Object.keys(this._config).length
211 | ) {
212 | this._debug('no config has been found so initiating an empty config...');
213 | this._config = {};
214 | } else {
215 | this._debug('this dashboard doesn‘t contain a config but there is a previous one in memory...');
216 | }
217 | this._filters = {};
218 | this._conditionalConfig = {};
219 | this._debug(this._config);
220 | })
221 | .finally(() => {
222 | detail.HOME_ASSISTANT.element
223 | .then((ha: HomeAssistant): void => {
224 | getTranslations(ha)
225 | .then((translations: Record) => {
226 | this._translations = translations;
227 | this._debug('translations have been retrieved. printing the translations');
228 | this._debug(this._translations);
229 | })
230 | .catch(() => {
231 | this._debug('error getting the translations');
232 | });
233 | });
234 | });
235 | }
236 |
237 | protected async queryAttributes(detail: OnMoreInfoDialogOpenDetail): Promise {
238 |
239 | const { HA_MORE_INFO_DIALOG_INFO } = detail;
240 |
241 | HA_MORE_INFO_DIALOG_INFO
242 | .selector
243 | .$
244 | .query(SELECTOR.MORE_INFO_CONTENT)
245 | .deepQuery(SELECTOR.HA_ATTRIBUTES)
246 | .element
247 | .then((attributes: Attributes): void => {
248 | this._debug('finished the task of querying attributes, the result is');
249 | if (attributes) {
250 | this._debug('attributes have been found');
251 | this._debug(attributes);
252 | this.filterAttributes(attributes);
253 | } else {
254 | this._debug('this dialog doesn‘t have attributes or the attributes have not been found');
255 | }
256 | });
257 |
258 | }
259 |
260 | protected async queryDialogElements(detail: OnMoreInfoDialogOpenDetail | OnHistoryAndLogBookDialogOpenDetail): Promise {
261 |
262 | const {
263 | HA_DIALOG,
264 | HA_MORE_INFO_DIALOG,
265 | HA_DIALOG_CONTENT
266 | } = detail;
267 |
268 | const dialog = await HA_MORE_INFO_DIALOG.element as MoreInfoDialog;
269 | const entityId = dialog._entityId;
270 | const deviceClass = await this._getDialogDeviceClass(dialog);
271 | const domain = this._getDomain(entityId);
272 |
273 | const internalConfig = this.getInternalConfig(
274 | entityId,
275 | domain,
276 | deviceClass || ''
277 | );
278 |
279 | if (internalConfig.maximized_size) {
280 | dialog.large = true;
281 | }
282 |
283 | HA_DIALOG
284 | .selector
285 | .query(SELECTOR.MORE_INFO_HEADER)
286 | .element
287 | .then((header: Element): void => {
288 | if (header) {
289 | this._debug('finished the task of querying the header, the result is');
290 | this._debug(header);
291 | this.addDataSelectors(header);
292 | this.processHeaderElements(header, internalConfig);
293 | } else {
294 | this._debug('this dialog doesn‘t have a header or it has not been found');
295 | }
296 | });
297 |
298 | HA_DIALOG_CONTENT
299 | .selector
300 | .deepQuery(
301 | [
302 | SELECTOR.MORE_INFO_HISTORY,
303 | SELECTOR.MORE_INFO_LOGBOOK
304 | ].join(',')
305 | )
306 | .element
307 | .then((element: Element): void => {
308 | this._debug('finished the task of querying the history or logbook of the dialog, the result is');
309 | if (element) {
310 | const container = element.parentElement || element.getRootNode() as ShadowRoot;
311 | this._debug('history or logbook have been found');
312 | this._debug(element);
313 | this.processContentElements(container, internalConfig);
314 | } else {
315 | this._debug('this dialog doesn‘t have history or logbook or they have not been found.');
316 | }
317 | });
318 |
319 | }
320 |
321 | protected filterAttributes(attributes: Attributes): void {
322 |
323 | const filters = this.getFilters(attributes);
324 | const finalFilters = filters.filter_attributes.filter((filter: string) => !filters.unfilter_attributes.includes(filter));
325 | const extraFilters = attributes.extraFilters || '';
326 | const separator = extraFilters.length
327 | ? ','
328 | : '';
329 | attributes.extraFilters = extraFilters + separator + finalFilters.join(',');
330 |
331 | if (filters.unfilter_attributes.length) {
332 |
333 | filters.unfilter_attributes.forEach((filter: string): void => {
334 |
335 | if (
336 | IGNORED_ATTRIBUTES.includes(filter) &&
337 | filter in attributes.stateObj.attributes
338 | ) {
339 | attributes.stateObj.attributes[`${filter} `] = attributes.stateObj.attributes[filter];
340 | }
341 |
342 | });
343 |
344 | }
345 |
346 | }
347 |
348 | protected addDataSelectors(header: Element): void {
349 | addDataSelectors(
350 | header.querySelectorAll(SELECTOR.MENU_ITEM),
351 | this._translations
352 | );
353 | }
354 |
355 | protected processContentElements(
356 | container: Element | ShadowRoot,
357 | internalConfig: InternalConfig
358 | ): void {
359 |
360 | const styles = [
361 | internalConfig.hide_history
362 | ? getHiddenStyle(SELECTOR.MORE_INFO_HISTORY)
363 | : '',
364 | internalConfig.hide_logbook
365 | ? getHiddenStyle(SELECTOR.MORE_INFO_LOGBOOK)
366 | : ''
367 | ];
368 |
369 | if (
370 | internalConfig.hide_history ||
371 | internalConfig.hide_logbook
372 | ) {
373 | addStyle(container, styles.join(''));
374 | } else {
375 | removeStyle(container);
376 | }
377 |
378 | }
379 |
380 | protected processHeaderElements(
381 | content: Element,
382 | internalConfig: InternalConfig
383 | ): void {
384 |
385 | if (!this._translations) {
386 | this._debug('skiping the header history task, because translations don‘t exist');
387 | return;
388 | }
389 |
390 | if (internalConfig.hide_header_history_icon) {
391 | addStyle(content, getHiddenStyle(SELECTOR.MORE_INFO_HEADER_HISTORY_ICON));
392 | } else {
393 | removeStyle(content);
394 | }
395 | }
396 |
397 | protected getFilters(attributes: Attributes): InternalFilters {
398 |
399 | const entityId = attributes.stateObj.entity_id;
400 | const deviceClass = attributes.stateObj.attributes.device_class;
401 | const domain = this._getDomain(entityId);
402 |
403 | this._debug(`getting the filters for ${entityId}`);
404 |
405 | if (this._filters[entityId]) {
406 | this._debug('the filters for this entity have been found in memory, recovering filters...');
407 | this._debug(this._filters[entityId]);
408 | return this._filters[entityId];
409 | }
410 |
411 | const filters = new Set();
412 | const unFilters = new Set();
413 |
414 | // By Glob
415 | this._insertAttributesGlobs(
416 | entityId,
417 | this._config?.filter_attributes?.by_glob,
418 | this._config?.unfilter_attributes?.by_glob,
419 | filters,
420 | unFilters
421 | );
422 |
423 | // By device class
424 | this._insertParameters(
425 | this._config?.filter_attributes?.by_device_class?.[deviceClass],
426 | this._config?.unfilter_attributes?.by_device_class?.[deviceClass],
427 | filters,
428 | unFilters
429 | );
430 |
431 | // By domain
432 | this._insertParameters(
433 | this._config?.filter_attributes?.by_domain?.[domain],
434 | this._config?.unfilter_attributes?.by_domain?.[domain],
435 | filters,
436 | unFilters
437 | );
438 |
439 | // By entity id
440 | this._insertParameters(
441 | this._config?.filter_attributes?.by_entity_id?.[entityId],
442 | this._config?.unfilter_attributes?.by_entity_id?.[entityId],
443 | filters,
444 | unFilters
445 | );
446 |
447 | // All
448 | if (this._config?.filter_all || filters.has(ALL_FILTER)) {
449 | this._addSetValues(
450 | filters,
451 | Object.keys(attributes.stateObj.attributes)
452 | );
453 | }
454 |
455 | if (this._config?.unfilter_all || unFilters.has(ALL_FILTER)) {
456 | this._addSetValues(
457 | unFilters,
458 | Object.keys(attributes.stateObj.attributes)
459 | );
460 | }
461 |
462 | this._filters[entityId] = {
463 | filter_attributes: Array.from(filters.values()),
464 | unfilter_attributes: Array.from(unFilters.values()),
465 | };
466 |
467 | this._debug('finished the filters retrieval, printing the filters...');
468 | this._debug(this._filters[entityId]);
469 |
470 | return this._filters[entityId];
471 |
472 | }
473 |
474 | protected getInternalConfig(
475 | entityId: string,
476 | domain: string,
477 | deviceClass: string | undefined
478 | ): InternalConfig {
479 |
480 | this._debug(`getting the conditional config for ${entityId}`);
481 |
482 | if (this._conditionalConfig[entityId]) {
483 | this._debug('the conditional config for this entity have been found in memory, recovering conditional config...');
484 | this._debug(this._conditionalConfig[entityId]);
485 | return this._conditionalConfig[entityId];
486 | }
487 |
488 | const internalConfig = {
489 | history: false,
490 | logbook: false,
491 | header_history_icon: false,
492 | maximized_size: false
493 | };
494 |
495 | if (
496 | this._anyConfigMatch(
497 | this._config?.hide_history,
498 | entityId,
499 | deviceClass,
500 | domain
501 | )
502 | ) {
503 | internalConfig.history = true;
504 | }
505 |
506 | if (
507 | this._anyConfigMatch(
508 | this._config?.unhide_history,
509 | entityId,
510 | deviceClass,
511 | domain
512 | )
513 | ) {
514 | internalConfig.history = false;
515 | }
516 |
517 | if (
518 | this._anyConfigMatch(
519 | this._config?.hide_logbook,
520 | entityId,
521 | deviceClass,
522 | domain
523 | )
524 | ) {
525 | internalConfig.logbook = true;
526 | }
527 |
528 | if (
529 | this._anyConfigMatch(
530 | this._config?.unhide_logbook,
531 | entityId,
532 | deviceClass,
533 | domain
534 | )
535 | ) {
536 | internalConfig.logbook = false;
537 | }
538 |
539 | if (
540 | this._anyConfigMatch(
541 | this._config?.hide_header_history_icon,
542 | entityId,
543 | deviceClass,
544 | domain
545 | )
546 | ) {
547 | internalConfig.header_history_icon = true;
548 | }
549 |
550 | if (
551 | this._anyConfigMatch(
552 | this._config?.unhide_header_history_icon,
553 | entityId,
554 | deviceClass,
555 | domain
556 | )
557 | ) {
558 | internalConfig.header_history_icon = false;
559 | }
560 |
561 | if (
562 | this._anyConfigMatch(
563 | this._config?.hide_history_logbook,
564 | entityId,
565 | deviceClass,
566 | domain
567 | )
568 | ) {
569 | internalConfig.history = true;
570 | internalConfig.logbook = true;
571 | }
572 |
573 | if (
574 | this._anyConfigMatch(
575 | this._config?.unhide_history_logbook,
576 | entityId,
577 | deviceClass,
578 | domain
579 | )
580 | ) {
581 | internalConfig.history = false;
582 | internalConfig.logbook = false;
583 | }
584 |
585 | if (
586 | this._anyConfigMatch(
587 | this._config?.maximized_size,
588 | entityId,
589 | deviceClass,
590 | domain
591 | )
592 | ) {
593 | internalConfig.maximized_size = true;
594 | }
595 |
596 | if (
597 | this._anyConfigMatch(
598 | this._config?.default_size,
599 | entityId,
600 | deviceClass,
601 | domain
602 | )
603 | ) {
604 | internalConfig.maximized_size = false;
605 | }
606 |
607 | this._conditionalConfig[entityId] = {
608 | hide_history: internalConfig.history,
609 | hide_logbook: internalConfig.logbook,
610 | hide_header_history_icon: internalConfig.header_history_icon ||
611 | (
612 | !!this._config?.auto_hide_header_history_icon &&
613 | internalConfig.history &&
614 | internalConfig.logbook
615 | ),
616 | maximized_size: internalConfig.maximized_size
617 | };
618 |
619 | this._debug('finished the conditonal config retrieval, printing the conditional config...');
620 | this._debug(this._conditionalConfig[entityId]);
621 |
622 | return this._conditionalConfig[entityId];
623 |
624 | }
625 |
626 | }
627 |
628 | if (!window.customMoreInfo) {
629 | console.info(
630 | `%c ${NAME} \n%c Version ${version} ${DESCRIPTION}`,
631 | 'color: gold; font-weight: bold; background: black',
632 | 'color: white; font-weight: bold; background: steelblue'
633 | );
634 | window.customMoreInfo = new CustomMoreInfo();
635 | }
636 |
--------------------------------------------------------------------------------
/src/types/index.ts:
--------------------------------------------------------------------------------
1 | export interface CustomMoreInfoClass {
2 | }
3 |
4 | export interface ExtendedEntityRegistryEntry {
5 | entity_id: string;
6 | original_device_class: string;
7 | }
8 |
9 | export interface WebSocketCall {
10 | type: string;
11 | entity_id: string;
12 | }
13 |
14 | export interface HomeAssistant extends HTMLElement {
15 | hass: {
16 | localize: (path: string) => string;
17 | callWS: (options: WebSocketCall) => Promise;
18 | };
19 | }
20 |
21 | export enum BY_TYPES {
22 | by_entity_id,
23 | by_domain,
24 | by_device_class,
25 | by_glob
26 | }
27 |
28 | export type ByTypes = keyof typeof BY_TYPES;
29 |
30 | export type AttributeFilters = Record<
31 | ByTypes,
32 | Record
33 | >;
34 |
35 | export type ConditionalFilter = Record<
36 | ByTypes,
37 | string[]
38 | >;
39 |
40 | export interface CustomMoreInfoConfig {
41 | debug?: boolean;
42 | filter_all?: boolean;
43 | unfilter_all?: boolean;
44 | filter_attributes?: AttributeFilters;
45 | unfilter_attributes?: AttributeFilters;
46 | hide_history_logbook?: ConditionalFilter;
47 | unhide_history_logbook?: ConditionalFilter;
48 | hide_history?: ConditionalFilter;
49 | hide_logbook?: ConditionalFilter;
50 | unhide_history?: ConditionalFilter;
51 | unhide_logbook?: ConditionalFilter;
52 | hide_header_history_icon?: ConditionalFilter;
53 | unhide_header_history_icon?: ConditionalFilter;
54 | auto_hide_header_history_icon?: boolean;
55 | maximized_size?: ConditionalFilter;
56 | default_size?: ConditionalFilter;
57 | }
58 |
59 | export interface InternalFilters {
60 | filter_attributes: string[];
61 | unfilter_attributes: string[];
62 | }
63 |
64 | export interface InternalConfig {
65 | hide_history: boolean;
66 | hide_logbook: boolean;
67 | hide_header_history_icon: boolean;
68 | maximized_size: boolean;
69 | }
70 |
71 | export interface Lovelace extends HTMLElement {
72 | lovelace: {
73 | config: {
74 | custom_more_info?: CustomMoreInfoConfig;
75 | };
76 | };
77 | }
78 |
79 | export interface StateObject {
80 | entity_id: string;
81 | attributes: {
82 | device_class?: string;
83 | [attr: string]: unknown;
84 | };
85 | }
86 |
87 | export interface Attributes extends Element {
88 | extraFilters: string | undefined;
89 | stateObj: StateObject;
90 | }
91 |
92 | export interface MoreInfoDialog extends HTMLElement {
93 | hass: HomeAssistant['hass'];
94 | _entry?: {
95 | entity_id: string;
96 | original_device_class?: string;
97 | };
98 | _entityId: string;
99 | large: boolean;
100 | }
101 |
102 | declare global {
103 | interface Window {
104 | customMoreInfo: CustomMoreInfoClass;
105 | }
106 | }
--------------------------------------------------------------------------------
/src/utilities/index.ts:
--------------------------------------------------------------------------------
1 | import { getPromisableResult } from 'get-promisable-result';
2 | import { HomeAssistant } from '@types';
3 | import {
4 | STYLES_PREFIX,
5 | MAX_ATTEMPTS,
6 | RETRY_DELAY,
7 | SELECTOR,
8 | MENU_REFERENCES
9 | } from '@constants';
10 |
11 | const getElementName = (element: Element | ShadowRoot): string => {
12 | if (element instanceof ShadowRoot) {
13 | return element.host.localName;
14 | }
15 | return element.localName;
16 | };
17 |
18 | export const styleExists = (element: Element | ShadowRoot): HTMLStyleElement => {
19 | const name = getElementName(element);
20 | return element.querySelector(`#${STYLES_PREFIX}_${name}`);
21 | };
22 |
23 | export const addStyle = (element: Element | ShadowRoot, css: string): void => {
24 | const name = getElementName(element);
25 | let style = styleExists(element);
26 | if (!style) {
27 | style = document.createElement('style');
28 | style.setAttribute('id', `${STYLES_PREFIX}_${name}`);
29 | element.appendChild(style);
30 | }
31 | style.innerHTML = css;
32 | };
33 |
34 | export const removeStyle = (element: Element | ShadowRoot): void => {
35 | const name = getElementName(element);
36 | if (styleExists(element)) {
37 | element.querySelector(`#${STYLES_PREFIX}_${name}`).remove();
38 | }
39 | };
40 |
41 | export const getHiddenStyle = (elementName: string): string => {
42 | return `${elementName} {
43 | display: none !important;
44 | }`;
45 | };
46 |
47 | export const getTranslations = async(
48 | ha: HomeAssistant
49 | ): Promise> => {
50 | const referencePaths = Object.entries(MENU_REFERENCES);
51 | const translations = await getPromisableResult(
52 | () => referencePaths.map((entry): [string, string] => {
53 | const [key, translationPath] = entry;
54 | return [ha.hass.localize(translationPath), key];
55 | }),
56 | (translationEntries: [string, string][]): boolean => {
57 | return !translationEntries.find((entry) => !entry[0]);
58 | },
59 | {
60 | shouldReject: false,
61 | retries: MAX_ATTEMPTS,
62 | delay: RETRY_DELAY
63 | }
64 | );
65 |
66 | return Object.fromEntries(translations);
67 | };
68 |
69 | export const addDataSelectors = (
70 | items: NodeListOf,
71 | translations: Record
72 | ): void => {
73 | items.forEach((item: HTMLElement): void => {
74 | if (
75 | item &&
76 | item.dataset &&
77 | !item.dataset.customSelector
78 | ) {
79 | const icon = item.shadowRoot.querySelector(SELECTOR.MENU_ITEM_ICON);
80 | item.dataset.customSelector = translations[icon.title];
81 | }
82 | });
83 | };
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "outDir": "./",
4 | "module": "esnext",
5 | "target": "ES5",
6 | "moduleResolution": "node",
7 | "esModuleInterop": true,
8 | "resolveJsonModule": true,
9 | "declaration": false,
10 | "noImplicitAny": true,
11 | "removeComments": true,
12 | "baseUrl": "./src",
13 | "rootDir": "src",
14 | "paths": {
15 | "@types": ["types"],
16 | "@constants": ["constants"],
17 | "@utilities": ["utilities"]
18 | }
19 | },
20 | "include": ["src/**/*.ts"],
21 | "exclude": ["node_modules"]
22 | }
--------------------------------------------------------------------------------