|
| 1 | +#!/usr/bin/env python3 |
| 2 | +import asyncio |
| 3 | +from pystiebeleltron.wpm import WpmStiebelEltronAPI, WpmSystemParametersRegisters, WpmSystemValuesRegisters |
| 4 | + |
| 5 | +host_ip = "192.168.1.20" |
| 6 | + |
| 7 | + |
| 8 | +async def main(): |
| 9 | + api = WpmStiebelEltronAPI(host_ip, 502) |
| 10 | + await api.connect() |
| 11 | + |
| 12 | + await api.async_update() |
| 13 | + |
| 14 | + for k, v in api._data.items(): |
| 15 | + if v is not None: |
| 16 | + print(f"{k.name} ({k.value}): {v}") |
| 17 | + |
| 18 | + outside_temp = api.get_register_value(WpmSystemValuesRegisters.OUTSIDE_TEMPERATURE) |
| 19 | + print(f"The current outside temperature is {outside_temp} °C") |
| 20 | + |
| 21 | + comfort_temp = api.get_register_value(WpmSystemParametersRegisters.COMFORT_TEMPERATURE) |
| 22 | + print(f"The current water comfort temperature is {comfort_temp} °C") |
| 23 | + |
| 24 | + # Test set_target_temp |
| 25 | + print("Setting temperature to 50.0") |
| 26 | + await api.write_register_value(WpmSystemParametersRegisters.COMFORT_TEMPERATURE, 50) |
| 27 | + await asyncio.sleep(3) |
| 28 | + await api.async_update() |
| 29 | + mod_temp = api.get_register_value(WpmSystemParametersRegisters.COMFORT_TEMPERATURE) |
| 30 | + if mod_temp != 50.0: |
| 31 | + print("setting the water comfort temperature failed!") |
| 32 | + if mod_temp != comfort_temp: |
| 33 | + await api.write_register_value(WpmSystemParametersRegisters.COMFORT_TEMPERATURE, comfort_temp) |
| 34 | + await asyncio.sleep(3) |
| 35 | + await api.async_update() |
| 36 | + print(f"get_target_temp: {api.get_register_value(WpmSystemParametersRegisters.COMFORT_TEMPERATURE)}") |
| 37 | + await api.close() |
| 38 | + |
| 39 | + |
| 40 | +if __name__ == "__main__": |
| 41 | + loop = asyncio.new_event_loop() |
| 42 | + asyncio.set_event_loop(loop) |
| 43 | + |
| 44 | + loop.run_until_complete(main()) |
0 commit comments