-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logbook Card #6976
Logbook Card #6976
Conversation
Couple things:
@bdraco Worked with you recently to help us with the More info logbook. Would you be able to help me with these changes in the backend to better support this card and the logbook as a whole? |
Getting the icon is expensive because we have to decode the json. If there can be only one icon in the attributes we can usually avoid the json decode. I think that's the case, but I need to validate that. Can you provide a bit more detail on the multi entity use case? |
We are already decoding the object that is sent to the frontend. (I don't know much about the backend section) but if you have the Use case would be this card. Being able to see a log book for all Motion Sensor entities and building a security dashboard of sorts with the card. All Windows. We would be allowing the users to choose which entities to query for instead of just one or all of them |
For the icon, can you try |
I think that will only work if there is a custom icon set. To calculate the default icon on the frontend, I think you need the 'state' as well? |
I adjusted the PR to provide |
We have this giant block to create the message https://github.com/home-assistant/core/blob/aa07171200ac06a89845464ba6b9f917d7ab4b8a/homeassistant/components/logbook/__init__.py#L551. Ideally we send I'd also like to drop "domain" as it appears to be unused by the frontend and means we end up sending the string again since its already in "entity_id" |
I can drop icon but I think its needed to fully match what the frontend does: |
Actually, Icon would be helpful actually. Re reading the code |
We don't need domain. We currently use domain but we don't need to |
What do you think about doing this part on the frontend? Edit: even if the first step is just porting the code and it isn't localized, it would be an improvement as the backend wouldn't have to send those text blobs for each state. |
I much prefer us to do that in the Frontend as we can run translations (I actually don't know if that done in the backend or not) @bramkragten (who is probably in bed) would be a better fit to say whether we should or not. I personally think it should be in the frontend though |
I pulled the changes that don't include adding the Logbook card so that the PRs are easier to review I will come back to this PR once the other is merged |
a2eb037
to
a62dc92
Compare
oldHass && | ||
this._configEntities!.some( | ||
(entity) => | ||
"entity" in entity && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have this here but not in shouldupdate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And do we need this check here if we already did it in shouldUpdate
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need both. Since to get to updated it can be more than just if the state obj changed
(oldHass && oldHass.themes !== this.hass.themes) || | ||
(oldConfig && oldConfig.theme !== this._config.theme) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now we don't apply on the first update?
const oldHass = changedProperties.get("hass") as HomeAssistant | undefined; | ||
const oldConfig = changedProperties.get("_config") as LogbookCardConfig; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could skip these if they are not in changedProperties
, but 🤷♂️
` | ||
: this._logbookEntries.length | ||
? html` | ||
<ha-logbook |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we virtualize this list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idk how to do that :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the virtualize
attribute ;-) https://github.com/home-assistant/frontend/blob/dev/src/panels/logbook/ha-logbook.ts#L92-L93
Question about the users/persons handling of this card:
Appreciate your work adding this card! |
This PR is 9 months old... If you have questions, please use or community forums or discord chat. If you found an issue, please raise an issue in the issue tracker. Thanks! ../Frenck |
Proposed change
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: