Too many errors logged while editing card
erkr opened this issue · comments
It's really a great card once configured right. But while editing a amazing amount of errors was logged in just a matter of 15 minutes:
Logger: frontend.js.latest.202310050
Source: components/system_log/__init__.py:300
First occurred: 13:17:08 (54034 occurrences)
Last logged: 13:31:45
Uncaught error from WebKit 605.1.15 on iOS 17.0.3 TypeError: null is not an object (evaluating 'this._this.querySelector("#maincard").clientWidth') updateContent (/hacsfiles/history-explorer-card/history-explorer-card.js:70:6684)
Yeah the card doesn't really like the way the HA edit dialog spam calls certain entry points in the JS code. Depending on what and how you edit, it may generate errors.
But is this a problem ? I mean the YAML is invalid while you're editing it, after all. Just ignore the errors.
Well my log file increased with hundred MB while editing my cards 🥹
Very hard to spot relevant errors...
That's a lot of logs... For how long did you edit the card for ? I mean I usually get something like maybe a dozen errors while editing my cards, hundreds of megabytes of errors is insanely extreme.
It's also difficult to reproduce the error above, as it's too generic. Do you have an example of a broken YAML that will generate this error ?
No it was just about 1 hour of tweaking of card options. Now the logs are gone
I can't reproduce this. The error message you posted is too generic and does not point to the problem itself. In order to proceed with your issue, you will have to provide an example YAML config that produces this error for you.
I will try to reproduce as I simply don't recall what I was doing.
@alexarch21
Found it: This is what causes the log spam on my system:
graphs:
- type: line
entities:
Without any entities specified yet, it generated over thousand logs in 3 minutes:
Logger: frontend.js.latest.202310302
Source: components/system_log/__init__.py:300
First occurred: 12:07:15 (1321 occurrences)
Last logged: 12:11:00
Uncaught error from WebKit 605.1.15 on iOS 17.1.1 TypeError: null is not an object (evaluating 'this._this.querySelector("#maincard").clientWidth') updateContent (/hacsfiles/history-explorer-card/history-explorer-card.js:70:6684)
Ps: error logging continued long after I specified entities. Stopped after a restart
Without any entities specified yet, it generated over thousand logs in 3 minutes
Ok, I see. This would also generate an error on Firefox, but only a single one. It seems browser dependent. In any case, I fixed that with the commit above. Will be in the next release. Let's see how it goes.
Wauw that is fast, looking forward to check it 🥳
Added to V1.0.51.
I just tested the card. The empty entities case is solved (thanks). BUT when I briefly edited the entities list, by just adding one entity. I got over 1000 errors after the edit:
Logger: frontend.js.latest.202310302
Source: components/system_log/__init__.py:300
First occurred: 18:51:47 (1107 occurrences)
Last logged: 18:53:34
Uncaught error from WebKit 605.1.15 on iOS 17.1.1 TypeError: null is not an object (evaluating 'this._this.querySelector("#maincard").clientWidth') updateContent (/hacsfiles/history-explorer-card/history-explorer-card.js:70:6793)
Uncaught error from WebKit 605.1.15 on iOS 17.1.1 TypeError: undefined is not an object (evaluating 'c.chart.data.datasets[t].data=g') buildChartData (/hacsfiles/history-explorer-card/history-explorer-card.js:9:14322) generateGraphDataFromCache (/hacsfiles/history-explorer-card/history-explorer-card.js:9:8252) updateHistory (/hacsfiles/history-explorer-card/history-explorer-card.js:9:21747) today (/hacsfiles/history-explorer-card/history-explorer-card.js:1:239877) createContent (/hacsfiles/history-explorer-card/history-explorer-card.js:70:6408) updateContent (/hacsfiles/history-explorer-card/history-explorer-card.js:70:6856)
This happened while I was just adding this single entity:
graphs:
- type: timeline
entities:
- entity: binary_sensor.relais_ctrl_connection
As long I omit the 'entity:' object part, or have an incorrect entity name, the log gets spammed (using the companion app on iOS)
Same here. Every time I open tab that has history explorer card, I get a lot of errors in the event log.
I don't even have to update anything in the card. Just open the tab that has the card at that card and errors are logged.
Logger: frontend.js.latest.202312082
Source: components/system_log/__init__.py:300
First occurred: December 18, 2023 at 12:27:23 PM (51 occurrences)
Last logged: 12:44:30 AM
Uncaught error from Chrome 120.0.0.0 on Windows 10 TypeError: Cannot read properties of undefined (reading 'isValid') a (/hacsfiles/history-explorer-card/history-explorer-card.js:1:199379) n.getLabelForIndex (/hacsfiles/history-explorer-card/history-explorer-card.js:1:203457) n.update (/hacsfiles/history-explorer-card/history-explorer-card.js:1:147705) n.handleEvent (/hacsfiles/history-explorer-card/history-explorer-card.js:1:152901) t.eventHandler (/hacsfiles/history-explorer-card/history-explorer-card.js:1:109759) n (/hacsfiles/history-explorer-card/history-explorer-card.js:1:109111) x.<computed> (/hacsfiles/history-explorer-card/history-explorer-card.js:1:171659)
Uncaught error from Chrome 120.0.0.0 on Windows 10 TypeError: Cannot read properties of undefined (reading 'length') n.draw (/hacsfiles/history-explorer-card/history-explorer-card.js:1:152336) t._drawTooltip (/hacsfiles/history-explorer-card/history-explorer-card.js:1:107453) t.draw (/hacsfiles/history-explorer-card/history-explorer-card.js:1:106701) t.render (/hacsfiles/history-explorer-card/history-explorer-card.js:1:106319) Object.callback (/hacsfiles/history-explorer-card/history-explorer-card.js:1:162710) Object.advance (/hacsfiles/history-explorer-card/history-explorer-card.js:1:100971) Object.startDigest (/hacsfiles/history-explorer-card/history-explorer-card.js:1:100690) /hacsfiles/history-explorer-card/history-explorer-card.js:1:100546
Uncaught error from Chrome 120.0.0.0 on Windows 10 TypeError: Cannot read properties of undefined (reading 'length') n.draw (/hacsfiles/history-explorer-card/history-explorer-card.js:1:152336) t._drawTooltip (/hacsfiles/history-explorer-card/history-explorer-card.js:1:107453) t.draw (/hacsfiles/history-explorer-card/history-explorer-card.js:1:106701) Object.afterEvent (/hacsfiles/history-explorer-card/history-explorer-card.js:80:1693) Object.notify (/hacsfiles/history-explorer-card/history-explorer-card.js:1:129199) t.eventHandler (/hacsfiles/history-explorer-card/history-explorer-card.js:1:109776) n (/hacsfiles/history-explorer-card/history-explorer-card.js:1:109111) x.<computed> (/hacsfiles/history-explorer-card/history-explorer-card.js:1:171659)
Uncaught error from Chrome 120.0.0.0 on Windows 10 TypeError: Cannot read properties of undefined (reading 'state') HistoryCardState.getFormattedLabelName (/hacsfiles/history-explorer-card/history-explorer-card.js:9:6254) HistoryCardState.newGraph (/hacsfiles/history-explorer-card/history-explorer-card.js:9:15753) HistoryCardState.addGraphToCanvas (/hacsfiles/history-explorer-card/history-explorer-card.js:9:35145) HistoryCardState.addFixedGraph (/hacsfiles/history-explorer-card/history-explorer-card.js:9:31993) HistoryCardState.createContent (/hacsfiles/history-explorer-card/history-explorer-card.js:70:4199) HistoryCardState.updateContent (/hacsfiles/history-explorer-card/history-explorer-card.js:70:6843)
Sadly the history explorer card has been declared end of life and won't be developed anymore. So I will have to close this issue / FR without resolution. This repository will be archived and set to read-only shortly.
See this post on the HA forum for more information:
https://community.home-assistant.io/t/new-interactive-history-explorer-custom-card/369450/978