Sensor configuration problem ValueError: invalid literal for int() with base 10: 'Unknown'

I have following code, which should convert hpa to mmhg pressure from 2 sensors and calculate mid value but when is 1 of sensor is unavailable it should return unknown value, not zero so as not to break the graphics.
Everything worked well until recently updates.

btw In developer Tab it works as should.

       - trigger:
           - platform: time_pattern
             minutes: '/5' 
           - name: home_atm_pressure_mmhg
             state: >
                   {% set tualet = states('sensor.tualet_climate_pressure')|float(0) %}
                   {% set kuhnya = states('sensor.kuhnya_climate_pressure')|float(0) %}
                   {% if ((tualet + kuhnya)*0.7500637)/2|round(0)  > 400 %}
                   {{ (((tualet + kuhnya)*0.7500637)/2)|round(0) }}
                   {% else %}
                   {% endif %}
             icon: mdi:gauge
             unit_of_measurement: 'mmHg'

here is Error

Error adding entity sensor.home_atm_pressure_mmhg for domain sensor with platform template
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/", line 658, in state
    numerical_value = int(value)
ValueError: invalid literal for int() with base 10: 'Unknown'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/", line 661, in state
    numerical_value = float(value)
ValueError: could not convert string to float: 'Unknown'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/", line 580, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/", line 892, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/", line 1359, in add_to_platform_finish
  File "/usr/src/homeassistant/homeassistant/helpers/", line 1009, in async_write_ha_state
  File "/usr/src/homeassistant/homeassistant/helpers/", line 1132, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
  File "/usr/src/homeassistant/homeassistant/helpers/", line 1067, in __async_calculate_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/", line 1015, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/", line 665, in state
    raise ValueError(
ValueError: Sensor sensor.home_atm_pressure_mmhg has device class 'None', state class 'None' unit 'mmHg' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'Unknown' (<class 'str'>)

If you have a unit of measurement, you must always return a number.

Use an availability template to deal with unavailable situations.

thx, it works!