Debian Codegraph @

intents/responses/pl/HassClimateGetTemperature.yaml

raw
1 language: pl
2 responses:
3 intents:
4 HassClimateGetTemperature:
5 default: >
6 {% set current_temperature = state_attr(state.entity_id, 'current_temperature') %}
7 {% set temperature = state.state if current_temperature is none else current_temperature %}
8 {% set temperature_pl = (temperature | string).replace(".", ",") %}
9 {% set temperature_decimal = (temperature | float - temperature | int) | round(2) %}
10 {% set negative_name = "" %}
11 {% if temperature | float < 0 %}
12 {% set negative_name = "minus " %}
13 {% endif %}
14 {% if temperature_decimal == 0 %}
15 {% if temperature | int | abs == 1 %}
16 {% set degree_name = 'stopień' %}
17 {% elif temperature | int | abs in [2, 3, 4] %}
18 {% set degree_name = 'stopnie' %}
19 {% elif temperature | int | abs in [12, 13, 14] %}
20 {% set degree_name = 'stopni' %}
21 {% elif (temperature | int | string)[-1] | int | abs in [2, 3, 4] %}
22 {% set degree_name = 'stopnie' %}
23 {% else %}
24 {% set degree_name = 'stopni' %}
25 {% endif %}
26 {% else %}
27 {% set degree_name = "stopnia" %}
28 {% endif %}
29 Temperatura wynosi {{ negative_name }}{{ temperature_pl.replace("-", "") }} {{ degree_name }}
30
31 # Explanation and Examples:
32 # 0 stopni
33 # 1 stopień
34 # 2 stopnie
35 # 3 stopnie
36 # 4 stopnie
37 # 5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21 stopni
38 # 22,23,24 stopnie
39 # 25,26,27,28,29,30,31 stopni
40 # 32,33,34 stopnie
41 # 35,36,37,38,39,40,41 stopni
42 # 42,43,44 stopnie
43
44 # Explanation and Examples with decimal numbers:
45 # 0 stopni
46 # 0,1 stopnia
47 # 0,2 stopnia
48 # 0,3 stopnia
49 # 0,4 stopnia
50 # 0,5 stopnia
51 # 0,6 stopnia
52 # 0,7 stopnia
53 # 0,8 stopnia
54 # 0,9 stopnia
55 # 1 stopień
56 # 1,1 stopnia
57 # 1,2 stopnia
58 # 1,3 stopnia
59 # 1,4 stopnia
60 # 1,5 stopnia
61 # 1,6 stopnia
62 # 1,7 stopnia
63 # 1,8 stopnia
64 # 1,9 stopnia
65 # 2 stopnie
66 # 2,1 stopnia
67 # 2,2 stopnia
68 # 2,3 stopnia
69 # 2,4 stopnia
70 # 2,5 stopnia
71 # 2,6 stopnia
72 # 2,7 stopnia
73 # 2,8 stopnia
74 # 2,9 stopnia
75 # 3 stopnie