Debian Codegraph @

intents/responses/ru/HassClimateGetTemperature.yaml

raw symbols SCIP
1 language: ru
2 responses:
3 intents:
4 HassClimateGetTemperature:
5 # Extract the last integer digit from number and use it to select the right word ending
6 default: >-
7 {% set current_temperature = state_attr(state.entity_id, 'current_temperature') %}
8 {% set temperature = state.state if current_temperature is none else current_temperature %}
9 {{ temperature }}
10 {% set temp = temperature | float %}
11 {% set last_digit = temp|abs|int % 10 %}
12 {% set last_two_digits = temp|abs|int % 100 %}
13 {% if last_digit == 1 and last_two_digits != 11 %}
14 градус
15 {% elif last_digit in [2, 3, 4] and (last_two_digits < 10 or last_two_digits > 20) %}
16 градуса
17 {% else %}
18 градусов
19 {% endif %}