Polymer entities

Hi, I need to create a custom pannels using polymer.
How I can bring for example the state of an input boolean and make a string like this:
“The status of boolean ID:[[ID_input_boolea]] is : [[ID_input_boolean.state]]” ??

this.$.selector.checked gives you the state of a checkbox.

And if you were not talking about a checkbox, you would define it in the properties:

properties: {
  checked: {
    type: Boolean,
    value: false  // initial value required for binding
  }
}

and can then just reference it like: this.checked (would give false now)

what is ‘$’ for you?
You me for example :
hass: {
type: Object,
},
?

this.$ is:

Automatic node finding

Polymer automatically builds a map of statically created instance nodes in its local DOM, to provide convenient access to frequently used nodes without the need to query for them manually. Any node specified in the element’s template with an id is stored on the this.$ hash by id.

https://www.polymer-project.org/1.0/docs/devguide/local-dom

Maybe you could share your code, that makes it easier to guide you…

But I what to known the state for example of an input_boolean element that finds in my configuration file of home assistant.

To explain you in python script i do
input_boolean = hass.states.get(entity_id)

By input boolean, do you mean a HASS entity? If so, it is:

this.hass.states.entityid.state or this.hass.states[“entity id”].state

yes do you post a very small example of html ?

using this scode for the base :
https://home-assistant.io/developers/frontend_creating_custom_panels/

<dom-module id="example">

  <template>

    <div>
      <p>The status of the input_boolean with entity id: entity_id is: [[hass.states.entityid.state]]</p>
    </div>

  </template>

</dom-module>

<script>
  Polymer({
    is: 'example',

	properties: {
      hass: {
        type: Object,
      },
	}
});
</script>

oh greate.
And if i want to save the state in a variable in to the script?

<dom-module id="example">

  <template>

    <div>
      <p>The status of the input_boolean with entity id: input_boolean.example is: [[variable]]</p>
    </div>

  </template>

</dom-module>

<script>
  Polymer({
    is: 'example',

	properties: {
      hass: {
        type: Object,
        observer: 'hassChanged'
      },
	},
	
	hassChanged: function (newHass, oldHass) {
		this.variable = newHass.states['input_boolean.example'].state;
	}
});
</script>

thanks, and entityid is in my case :
input_boolean.example

See edit above

1 Like

Yes man, very thanks

I try to include this polymer component in my panel but I don’ Kwon ho to do
:http://saeidzebardast.github.io/nvd3-elements/components/nvd3-elements/#nvd3-bullet