-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Add product picture to ozw node dashboard #7203
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,20 +87,31 @@ class OZWNodeDashboard extends LitElement { | |
| ${this._node | ||
| ? html` | ||
| <ha-card class="content"> | ||
| <div class="card-content"> | ||
| <b | ||
| >${this._node.node_manufacturer_name} | ||
| ${this._node.node_product_name}</b | ||
| ><br /> | ||
| Node ID: ${this._node.node_id}<br /> | ||
| Query Stage: ${this._node.node_query_stage} | ||
| ${this._metadata?.metadata.ProductManualURL | ||
| ? html` <a | ||
| href="${this._metadata.metadata.ProductManualURL}" | ||
| > | ||
| <p>Product Manual</p> | ||
| </a>` | ||
| : ``} | ||
| <div class="card-content flex"> | ||
| <div class="node-details"> | ||
| <b> | ||
| ${this._node.node_manufacturer_name} | ||
| ${this._node.node_product_name} | ||
| </b> | ||
| <br /> | ||
| Node ID: ${this._node.node_id}<br /> | ||
| Query Stage: ${this._node.node_query_stage} | ||
| ${this._metadata?.metadata.ProductManualURL | ||
| ? html` <a | ||
| href="${this._metadata.metadata.ProductManualURL}" | ||
| > | ||
| <p>Product Manual</p> | ||
| </a>` | ||
| : ``} | ||
| </div> | ||
| <div class="product-image"> | ||
| ${this._metadata?.metadata.ProductPicBase64 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we btw do this differently? Sending large files like images over the WebSocket is not recommended, would rather have just the URL or something.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OZW just has the base64 encoded image in the MQTT data for the node. Though I suppose we could register a regular HTTP endpoint on the backend to return the image instead of feeding it over the websocket. I've never done anything with custom endpoints like that in the backend though.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something for a future PR maybe |
||
| ? html`<img | ||
| src="data:image/png;base64,${this._metadata | ||
| ?.metadata.ProductPicBase64}" | ||
| />` | ||
| : ``} | ||
| </div> | ||
| </div> | ||
| <div class="card-actions"> | ||
| <mwc-button @click=${this._refreshNodeClicked}> | ||
|
|
@@ -199,6 +210,11 @@ class OZWNodeDashboard extends LitElement { | |
| max-width: 600px; | ||
| } | ||
|
|
||
| .flex { | ||
| display: flex; | ||
| justify-content: space-between; | ||
| } | ||
|
|
||
| .card-actions.warning ha-call-service-button { | ||
| color: var(--error-color); | ||
| } | ||
|
|
@@ -219,6 +235,18 @@ class OZWNodeDashboard extends LitElement { | |
| [hidden] { | ||
| display: none; | ||
| } | ||
|
|
||
| .product-image { | ||
| padding: 12px; | ||
| } | ||
|
|
||
| .product-image img { | ||
| max-height: 140px; | ||
| max-width: 140px; | ||
| } | ||
| .card-actions { | ||
| clear: right; | ||
| } | ||
| `, | ||
| ]; | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.