radsonpatrick / qbittorrent_custom_component

Custom component for use in Homeasssistant
6 stars 3 forks source link

Variables in HA dissappear if value is 0 - causing templating issues #2

Open javempt opened 1 year ago

javempt commented 1 year ago

The variables in this custom component seem to disappear from homeassistant if the value is 0 (e.g active_torrents is only visible in homeassistant if there is at least one active torrent). This introduces issues when trying to use these variables in automation or templates as homeassistant cannot evaluate whether a variable is >= 0 if it is not persistent in HA. Is there any way to make these values persistent and show their value as 0, or false?

radsonpatrick commented 1 year ago

Can you send a print of your error?

javempt commented 1 year ago

ValueError: Template error: float got invalid input 'unknown' when rendering template

{% if (states['sensor.qbit_downloading'].state == '0') %} " " {% elif (states['sensor.qbit_downloading'].state >= '0.1') %} {{ states['sensor.qbit_downloading'].state }} {% else %} " " {% endif %}

Because sensor.qbit_downloading is not persistant, HA can't execute this template.

radsonpatrick commented 4 months ago

hello... i working to resolve this problem ! sorry for freezing i'm back to develop the componet!