File tree Expand file tree Collapse file tree 2 files changed +12
-15
lines changed
custom_components/daikinone Expand file tree Collapse file tree 2 files changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -14,26 +14,23 @@ class Temperature(BaseModel):
14
14
print(temp.fahrenheit) # Prints the temperature in Fahrenheit
15
15
"""
16
16
17
+ _temp_c : float
18
+
19
+ def __init__ (self , temp_c : float ) -> None :
20
+ super ().__init__ ()
21
+ self ._temp_c = round (temp_c , 1 )
22
+
17
23
@staticmethod
18
24
def from_celsius (temp_c : float ) -> "Temperature" :
19
- temp = Temperature ()
20
- temp ._init (temp_c )
21
- return temp
25
+ return Temperature (temp_c )
22
26
23
27
@staticmethod
24
28
def from_fahrenheit (temp_f : float ) -> "Temperature" :
25
- temp = Temperature ()
26
- temp ._init ((temp_f - 32 ) * 5 / 9 )
27
- return temp
29
+ return Temperature ((temp_f - 32 ) * 5 / 9 )
28
30
29
31
@staticmethod
30
32
def from_kelvin (temp_k : float ) -> "Temperature" :
31
- temp = Temperature ()
32
- temp ._init (temp_k - 273.15 )
33
- return temp
34
-
35
- def _init (self , temp_c : float ) -> None :
36
- self ._temp_c : float = round (temp_c , 1 )
33
+ return Temperature (temp_k - 273.15 )
37
34
38
35
@property
39
36
def celsius (self ) -> float :
You can’t perform that action at this time.
0 commit comments