How do I create a binary sensor depending on the values of two numeric sensors?

I would like some help in finding the best HA techniques to solve the following use-case:

Situation:
I have:
a weather station which reports the solar radiation (in watt/m²).
solar panels for which the inverter reports the current power which is being produced.

Both are available as numeric sensors. (sensor.weather_solar_rad , sensor.weather_pacinvtot ).
(I get the data via MQTT, but that is not relevant.)

Problem:
Sometimes the inverter switches off. This is a safeguard if there is a peak somewhere.
If this goes unnoticed, I lose solar energy, of course. Several hours or several days, until I notice it.

Solution:
Create a “device” in Home Assistant that has a virtual indication if the inverter is working or not.
default state = working (on).
if there is sufficient sunlight (sensor.weather_solar_rad > treshold (say 20 w/m²) AND
the inverter is not generating power (sensor.weather_pacinvtot = 0)
then
state = not working (off) .

and then an action to set the status back to “working” : if there is light and power : state = working.

If state goes from on to off , send an alarm.

Question:
which HA techniques can I use to solve this use case ?

Use a template binary sensor.

OK. So the “templates” integration is the technology I need to dig into.
Thanks. That was exactly the info I needed.

1 Like