Hey there,
I’m completly new to the automation stuff and home assistant.
I’m Using an standart Gauge to Display the CPU-Load, Temperatur and some other stuff from my computer. But when the Computer is turned off it just displays “Entity not available”
Instead of that i want the Card to display the Value 0.
Okay, I think I need to create an Template for that. I know it has to look something like that:
Not sure what happened there. I actually had )}" originally and thought I had corrected it. I obviously stuffed the edit up somehow too. Thanks for pointing out he fix.
Again, thank you very much. Your templates helped me to understand the syntax a little bit more. I was even able to create an own script after your help
I noticed someone liked the solution above. However it is now out of date due to changes in the way home assistant deals with defaults. You should now use:
Hello all, I have a similar question with a twist.
I have created a sensors.yaml file that contains some template sensors mostly for conversion purposes for my solar panel system. Needing to change value scales.
As you can see this converts the sensor.solarnet_power_photovoltaics from KW to W.
However sometimes when there are prolonged periods of darkness (I live in the high north), the sensor becomes unavailable which messes up some calculations.
In the developer tools templating section, I followed an example from a previous post and it the result is 0
state: "{{ 0 if states('sensor.solarnet_power_photovoltaics') == 'unavailable' else states('sensor.solarnet_power_photovoltaics') }}
So my question is how can i integrate that in my existing code? Adding it as a line after gives me an error.