The template platform supports sensors which get their values from other entities.
Home assistant sensor template.
This mqtt sensor platform uses the mqtt message payload as the sensor value.
Process incoming data from sources that provide raw data like mqtt rest sensor or the command line sensor.
To use your mqtt sensor in your installation add the following to your configuration yaml file.
State.
The state of a template binary sensor can only be on or off.
For example if you have a garage door with a toggle switch that operates the motor and a sensor that allows you know whether the door is open or closed you can combine these into a switch that knows whether the garage door is open or closed.
This means that we are using their syntax and make some custom home assistant variables available to templates during.
Example configuration yaml entry sensor.
Importing attributes is currently not supported but you can create template sensors in home assistant that return the attribute of a sensor and then import the template sensor here.
Otherwise the initial state will be undefined.
The template platform creates switches that combines components.
The template platform supports binary sensors which get their values from other entities.
If you want to import arbitrary text states from home assistant use the home assistant text sensor.
The configuration of template sensors depends on what you want them to be.
Sun is up value template.
If messages in this state topic are published with retain flag the sensor will receive an instant update with last known value.
Here is an example of adding a template binary sensor to the configuration yaml file.
Templating in home assistant is powered by the jinja2 templating engine.