Skip to content

Add support for custom_card component#831

Closed
c727 wants to merge 6 commits intohome-assistant:masterfrom
c727:custom_card
Closed

Add support for custom_card component#831
c727 wants to merge 6 commits intohome-assistant:masterfrom
c727:custom_card

Conversation

@c727
Copy link
Copy Markdown
Contributor

@c727 c727 commented Jan 23, 2018

custom_card is a component to show any custom content on HA frontend like
floorplan or my state-cards 1 2 that currently have to hijack the card of another entity to show up on frontend.
config:

frontend:
  extra_html_url:
    - /local/custom_ui/ha-test-card.html
  extra_html_url_es5:
    - /local/custom_ui/ha-test-card.html
  development_repo: /share/home-assistant-polymer

media_player:
  - platform: cast
    host: 192.168.1.45
custom_card:
  test1:
    full_card: ha-test-card
    more_info_card: ha-test-card
  test2:
    state_card: ha-test-card
    more_info_card: ha-test-card
<dom-module id='ha-test-card'>
  <template>
    <style>

    </style>
    Hello!<br>
    I'm a custom card :-)  ([[stateObj.entity_id]])<button on-tap='onTap'>fire more info</button>
  </template>
</dom-module>

<script>
  Polymer({
    is: 'ha-test-card',
    properties: {
      hass: {
        type: Object,
      },
      stateObj: {
        type: Object,
      },
    },
    
    onTap: function (ev) {     
      this.fire('hass-more-info', { entityId: this.stateObj.entity_id });
      ev.stopPropagation();
    },
  });
</script>

Backend-PR: home-assistant/core#11866

unbenannt1

@c727
Copy link
Copy Markdown
Contributor Author

c727 commented Jan 23, 2018

What data is OK for stateObj.attributes? I'm sure don't allow me to store my config there...

Should I create an API or are there some other solutions?

Also, how would I share this data for all cards (more-info) instead of calling the API again?

@c727
Copy link
Copy Markdown
Contributor Author

c727 commented Jan 30, 2018

Frontend PR should be OK now, changed it to use custom_ui_xxx as Andrey suggested

persistent_notification: 0,
plant: 3,
weather: 4,
custom_full_card: 0,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an agreement on the backend PR? If not - let's drop this line change for now

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I wanted to avoid merge conflicts in my first approach. Will submit a new PR

Comment thread src/cards/ha-card-chooser.html Outdated
this, 'HA-' + newData.cardType.toUpperCase() + '-CARD',
newData
);
var cardType;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use let here and elsewhere in new code.

@c727 c727 changed the title Allow more custom ui and support custom_card component Add support for custom_card component Jan 30, 2018
@c727
Copy link
Copy Markdown
Contributor Author

c727 commented Feb 28, 2018

functionality is will be included in frontend entity registry

@c727 c727 closed this Feb 28, 2018
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants