To use your mqtt sensor in your installation add the following to your configuration yaml file.
Home assistant sensor template.
This mqtt sensor platform uses the mqtt message payload as the sensor value.
State.
The template platform supports sensors which get their values from other entities.
Sun is up value template.
Process incoming data from sources that provide raw data like mqtt rest sensor or the command line sensor.
The template platform creates switches that combines components.
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.
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.
If messages in this state topic are published with retain flag the sensor will receive an instant update with last known value.
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.
This component is only for numeral states.
Example configuration yaml entry sensor.
The configuration of template sensors depends on what you want them to be.
Here is an example of adding a template binary sensor to the configuration yaml file.
This means that we are using their syntax and make some custom home assistant variables available to templates during.
The state of a template binary sensor can only be on or off.
Otherwise the initial state will be undefined.
The template platform supports binary sensors which get their values from other entities.