Skip to content

Commit 1451031

Browse files
committed
Remove property declarations
1 parent d3e8eac commit 1451031

File tree

3 files changed

+14
-24
lines changed

3 files changed

+14
-24
lines changed

pystiebeleltron/pystiebeleltron.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,7 @@
117117
0: 'EMERGENCY OPERATION'
118118
}
119119

120-
B2_OPERATING_MODE_WRITE = {
121-
'AUTOMATIC': 11,
122-
'STANDBY': 1,
123-
'DAY MODE': 3,
124-
'SETBACK MODE': 4,
125-
'DHW': 5,
126-
'MANUAL MODE': 14,
127-
'EMERGENCY OPERATION': 0
128-
}
120+
B2_OPERATING_MODE_WRITE = {value: key for key, value in B2_OPERATING_MODE_READ.items()}
129121

130122
B2_RESET = {
131123
'OFF': 0,
@@ -274,19 +266,16 @@ def get_conv_val(self, name):
274266

275267
# Handle room temperature & humidity
276268

277-
@property
278269
def get_current_temp(self):
279270
"""Get the current room temperature."""
280271
if self._update_on_read:
281272
self.update()
282273
return self.get_conv_val('ACTUAL_ROOM_TEMPERATURE_HC1')
283274

284-
@property
285275
def get_target_temp(self):
286276
"""Get the target room temperature."""
287277
if self._update_on_read:
288278
self.update()
289-
# return self.get_conv_val('SET_ROOM_TEMPERATURE_HC1')
290279
return self.get_conv_val('ROOM_TEMP_HEAT_DAY_HC1')
291280

292281
def set_target_temp(self, temp):
@@ -297,7 +286,6 @@ def set_target_temp(self, temp):
297286
self._block_2_holding_regs['ROOM_TEMP_HEAT_DAY_HC1']['addr']),
298287
value=round(temp * 10.0))
299288

300-
@property
301289
def get_current_humidity(self):
302290
"""Get the current room humidity."""
303291
if self._update_on_read:
@@ -306,7 +294,6 @@ def get_current_humidity(self):
306294

307295
# Handle operation mode
308296

309-
@property
310297
def get_operation(self):
311298
"""Return the current mode of operation."""
312299
if self._update_on_read:
@@ -324,23 +311,20 @@ def set_operation(self, mode):
324311

325312
# Handle device status
326313

327-
@property
328314
def get_heating_status(self):
329315
"""Return heater status."""
330316
if self._update_on_read:
331317
self.update()
332318
return bool(self.get_conv_val('OPERATING_STATUS') &
333319
B3_OPERATING_STATUS['HEATING'])
334320

335-
@property
336321
def get_cooling_status(self):
337322
"""Cooling status."""
338323
if self._update_on_read:
339324
self.update()
340325
return bool(self.get_conv_val('OPERATING_STATUS') &
341326
B3_OPERATING_STATUS['COOLING'])
342327

343-
@property
344328
def get_filter_alarm_status(self):
345329
"""Return filter alarm."""
346330
if self._update_on_read:

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
sys.exit()
1919

2020
if sys.argv[-1] == 'publish':
21-
os.system('python3 setup.py sdist upload')
21+
os.system('twine upload dist/*')
2222
sys.exit()
2323

2424

@@ -37,7 +37,7 @@ def run_tests(self):
3737

3838
setup(
3939
name='pystiebeleltron',
40-
version='0.0.1.dev1',
40+
version='0.0.1.dev2',
4141
description='Python API for interacting with the Stiebel Eltron ISG web gateway via Modbus for controlling integral ventilation units and heat pumps.',
4242
long_description=long_description,
4343
long_description_content_type='text/markdown',

test/test_pystiebeleltron.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def pyse_api(self, request):
2525

2626
mb_s = ModbusServer()
2727
mb_c = ModbusClient(host=host_ip, port=host_port, timeout=2)
28-
api = pyse.StiebelEltronAPI(mb_c, slave)
28+
api = pyse.StiebelEltronAPI(mb_c, slave, update_on_read=False)
2929

3030
# Cleanup after last test did run (will run as well, if something fails in setup).
3131
def fin():
@@ -58,24 +58,24 @@ def fin():
5858
return api
5959

6060
def test_temperature_read(self, pyse_api):
61-
temp = pyse_api.get_current_temp
61+
temp = pyse_api.get_current_temp()
6262
assert temp >= 20.0 and temp < 25.0
6363

64-
temp = pyse_api.get_target_temp
64+
temp = pyse_api.get_target_temp()
6565
assert temp >= 20.0 and temp < 25.0
6666

6767
#@pytest.mark.skip
6868
def test_temperature_write(self, pyse_api):
6969
# Get old target temperature
70-
old_temp = pyse_api.get_target_temp
70+
old_temp = pyse_api.get_target_temp()
7171
new_temp = 22.5
7272

7373
# Set new target temperature
7474
pyse_api.set_target_temp(new_temp)
7575
time.sleep(3)
7676
pyse_api.update()
7777

78-
mod_temp = pyse_api.get_target_temp
78+
mod_temp = pyse_api.get_target_temp()
7979
assert mod_temp == new_temp
8080

8181
# Restore old target temperature
@@ -84,6 +84,12 @@ def test_temperature_write(self, pyse_api):
8484
time.sleep(3)
8585
pyse_api.update()
8686

87+
def test_operation(self, pyse_api):
88+
pyse_api.set_operation('DHW')
89+
time.sleep(3)
90+
pyse_api.update()
91+
oper = pyse_api.get_operation()
92+
assert oper == 'DHW'
8793

8894
@pytest.mark.skip
8995
def test_fail(self):

0 commit comments

Comments
 (0)