github gadgetchnnel/lovelace-card-templater 0.0.6b1

latest releases: 0.1.0-alpha3, 0.1.0-alpha2, 0.1.0-alpha1...
pre-release4 years ago

Added an option to set state attributes when templating entity states.
This can be used like this (without using a template):

type: 'custom:card-templater'
card:
  ...
entities:
  - entity: sensor.my_sensor
     state_template: >
       {{ "One" if states.sensor.my_sensor.state == "1" else "Not One" }}
     attributes:
       unit_of_measurement: "Testing"

or like this (using a template):

type: 'custom:card-templater'
card:
  ...
entities:
  - entity: sensor.my_sensor
     state_template: >
       {{ "One" if states.sensor.my_sensor.state == "1" else "Not One" }}
     attributes:
       unit_of_measurement_template: >
         {{ states.sensor.my_sensor.state }}

Don't miss a new lovelace-card-templater release

NewReleases is sending notifications on new releases.