Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ddbc98a

Browse files
authored
Merge pull request #4 from mochman/tempChange
2025 Version
2 parents 193a5ce + 3af75a5 commit ddbc98a

File tree

6 files changed

+22
-47
lines changed

6 files changed

+22
-47
lines changed

__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@
1414

1515
from .device import RecteqDevice
1616

17-
from homeassistant import config_entries
1817
from homeassistant.config_entries import ConfigEntry
1918
from homeassistant.core import HomeAssistant
20-
from homeassistant.const import ATTR_ENTITY_ID, ATTR_TEMPERATURE
21-
from homeassistant.exceptions import ConfigEntryNotReady
2219

2320
from integrationhelper.const import CC_STARTUP_VERSION
2421

@@ -58,4 +55,3 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
5855
hass.data[DOMAIN].pop(entry.entry_id)
5956

6057
return unload_ok
61-

climate.py

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,16 @@
2020
ATTR_MAX_TEMP,
2121
ATTR_MIN_TEMP,
2222
ATTR_TARGET_TEMP_STEP,
23-
HVAC_MODE_HEAT,
24-
HVAC_MODE_OFF,
25-
SUPPORT_TARGET_TEMPERATURE,
23+
ClimateEntityFeature,
24+
HVACMode,
2625
)
2726
from homeassistant.const import (
2827
ATTR_TEMPERATURE,
2928
PRECISION_WHOLE,
3029
STATE_UNAVAILABLE,
31-
TEMP_CELSIUS,
32-
TEMP_FAHRENHEIT,
30+
3331
)
3432
from homeassistant.core import callback
35-
from homeassistant.util.unit_system import IMPERIAL_SYSTEM, METRIC_SYSTEM
3633

3734
_LOGGER = logging.getLogger(__name__)
3835

@@ -87,13 +84,13 @@ def temperature_unit(self):
8784
@property
8885
def hvac_mode(self):
8986
if self.is_on:
90-
return HVAC_MODE_HEAT
87+
return HVACMode.HEAT
9188

92-
return HVAC_MODE_OFF
89+
return HVACMode.OFF
9390

9491
@property
9592
def hvac_modes(self):
96-
return [HVAC_MODE_OFF, HVAC_MODE_HEAT]
93+
return [HVACMode.OFF, HVACMode.HEAT]
9794

9895
@property
9996
def current_temperature(self):
@@ -111,7 +108,7 @@ def target_temperature(self):
111108

112109
@property
113110
def target_temperature_step(self):
114-
if self.temperature_unit == TEMP_FAHRENHEIT:
111+
if True:
115112
return 5.0
116113
return 2.5
117114

@@ -129,18 +126,12 @@ def set_temperature(self, **kwargs):
129126
self.set_hvac_mode(mode)
130127

131128
temp = kwargs.get(ATTR_TEMPERATURE)
132-
if self._device.units.temperature_unit != TEMP_FAHRENHEIT:
133-
if self._device.force_fahrenheit:
134-
# undo HA's conversion
135-
temp = METRIC_SYSTEM.temperature(temp, TEMP_FAHRENHEIT)
136-
else:
137-
temp = IMPERIAL_SYSTEM.temperature(temp, self._device.units.temperature_unit)
138129
self._device.dps(DPS_TARGET, int(temp+0.5))
139130

140131
def set_hvac_mode(self, hvac_mode):
141-
if hvac_mode == HVAC_MODE_HEAT:
132+
if hvac_mode == HVACMode.HEAT:
142133
self.turn_on()
143-
elif hvac_mode == HVAC_MODE_OFF:
134+
elif hvac_mode == HVACMode.OFF:
144135
self.turn_off()
145136
else:
146137
raise Exception('Invalid hvac_mode; "{}"'.format(hvac_mode))
@@ -161,7 +152,7 @@ def turn_off(self):
161152

162153
@property
163154
def supported_features(self):
164-
return SUPPORT_TARGET_TEMPERATURE
155+
return ClimateEntityFeature.TARGET_TEMPERATURE
165156

166157
@property
167158
def min_temp(self):
@@ -202,4 +193,3 @@ async def async_added_to_hass(self):
202193
@callback
203194
def _update_callback(self):
204195
self.async_write_ha_state()
205-

device.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@
1919
DPS_POWER,
2020
)
2121

22-
from homeassistant.const import (
23-
EVENT_HOMEASSISTANT_STOP,
24-
STATE_UNAVAILABLE,
25-
TEMP_FAHRENHEIT,
26-
)
22+
2723
from homeassistant.helpers import update_coordinator
2824

2925
_LOGGER = logging.getLogger(__name__)
@@ -107,13 +103,11 @@ def units(self):
107103
@property
108104
def temperature_unit(self):
109105
if self._force_fahrenheit:
110-
return TEMP_FAHRENHEIT
106+
return True
111107
return self.units.temperature_unit
112108

113109
def temperature(self, degrees_f):
114-
if self._force_fahrenheit:
115-
return degrees_f
116-
return self.units.temperature(degrees_f, TEMP_FAHRENHEIT)
110+
return degrees_f
117111

118112
def update(self):
119113
self._lock.acquire()

info.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,14 @@ Custom integration for [recteq][recteq] grills and smokers providing a climate e
88

99
This integration is configured using the UI only. Navigate to Configuration > Integrations and tap the red "+" button in the bottom right. Search for and select the "Rectec" entry. You'll get the dialog shown below. Enter the details for your grill and tap "Submit".
1010

11-
See the [wiki](https://github.com/pdugas/recteq/wiki) for info on where to find the Device ID, IP address and Local Key values needed to add a grill.
11+
See the [wiki](https://github.com/mochman/recteq/wiki) for info on where to find the Device ID, IP address and Local Key values needed to add a grill.
1212

1313
## License
1414

15-
Copyright (c) 2020 Paul Dugas
16-
1715
See [LICENSE](LICENSE) for details.
1816

1917
## Support
2018

21-
Submit [issues](https://github.com/pdugas/recteq/issues) for defects, feature requests or questions. I'll try to help as I can.
19+
Submit [issues](https://github.com/mochman/recteq/issues) for defects, feature requests or questions. I'll try to help as I can.
2220

2321
[recteq]: https://www.recteq.com/

manifest.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
{
22
"domain": "recteq",
33
"name": "Recteq",
4-
"version": "v0.0.5",
4+
"version": "v0.1.0",
55
"documentation": "https://github.com/mochman/recteq/wiki",
66
"issue_tracker": "https://github.com/mochman/recteq/issues",
77
"dependencies": [],
88
"after_dependencies": [],
99
"codeowners": ["@mochman"],
10-
"requirements": [
11-
"tinytuya==1.9.1",
12-
"integrationhelper",
13-
"voluptuous"
14-
],
15-
"config_flow": true
10+
"requirements": ["tinytuya==1.9.1"],
11+
"config_flow": true,
12+
"iot_class": "local_polling"
1613
}

sensor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
DPS_TARGET,
99
)
1010

11-
from homeassistant.components.sensor import DEVICE_CLASS_TEMPERATURE
12-
from homeassistant.const import TEMP_FAHRENHEIT, STATE_UNAVAILABLE
11+
from homeassistant.components.sensor import SensorDeviceClass
12+
from homeassistant.const import STATE_UNAVAILABLE
1313
from homeassistant.core import callback
1414
from homeassistant.helpers import entity
1515

@@ -62,7 +62,7 @@ def unit_of_measurement(self):
6262

6363
@property
6464
def device_class(self):
65-
return DEVICE_CLASS_TEMPERATURE
65+
return SensorDeviceClass.TEMPERATURE
6666

6767
@property
6868
def should_poll(self):

0 commit comments

Comments
 (0)