If messages in this state topic are published with retain flag the sensor will receive an instant update with last known value.
Home assistant sensor template.
This component is only for numeral states.
Example configuration yaml entry sensor.
The template platform supports binary sensors which get their values from other entities.
The template platform supports sensors which get their values from other entities.
The state of a template binary sensor can only be on or off.
To use your mqtt sensor in your installation add the following to your configuration yaml file.
Adding the following to your configuration yaml file will create two sensors one for the current sun angle and one for the time of the next sunrise.
State.
This mqtt sensor platform uses the mqtt message payload as the sensor value.
Templating in home assistant is powered by the jinja2 templating engine.
If you want to import arbitrary text states from home assistant use the home assistant text 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.
This means that we are using their syntax and make some custom home assistant variables available to templates during.
Here is an example of adding a template binary sensor to the configuration yaml file.
Example configuration yaml entry binary sensor.
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.
The template platform creates switches that combines components.