Thanks for the reply @anon43302295 I am sure your solution would have worked but was a little too much for me to follow.
@hmoffatt I ended up doing it a different way, I guess it might to be the prettiest way… I just created a new sensor that senses the other sensor. So the sensor that keeps going missing for me is sensor.power_ac_fronius_inverter_1_http_192_168_1_85
Then I added the following to my sensors.yaml:
- platform: template
friendly_name: 'Current Energy'
Then the new sensor created sensor.fronius_energy_current_kwh gives me the “unknown” reply if it is offline/missing.
That way I can use conditional controls when I need to; ie. state or state_not
Hope this helps someone else. If anyone has another simple idea or better way than me, I am happy to hear it