forked from moustic999/bosch-thermostat-http-client-python
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathexample_nefit_local.py
50 lines (41 loc) · 1.36 KB
/
example_nefit_local.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
""" Test script of bosch_thermostat_client. """
import asyncio
import logging
import aiohttp
import bosch_thermostat_client as bosch
from bosch_thermostat_client.const.nefit import NEFIT
from bosch_thermostat_client.const import HTTP, HC, DHW
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
async def hc_circuits_test(gateway):
await gateway.initialize_circuits(HC)
hcs = gateway.heating_circuits
hc = hcs[0]
await hc.update()
print("hvac mode", hc.current_temp)
print("target temp ->", hc.target_temperature)
async def dhw_circuits_test(gateway):
await gateway.initialize_circuits(DHW)
circs = gateway.dhw_circuits
circ = circs[0]
await circ.update()
print("DHW mode", circ.current_temp)
print("target temp ->", circ.target_temperature)
async def main():
"""
Provide data_file.txt with ip, access_key, password and check
if you can retrieve data from your thermostat.
"""
BoschGateway = bosch.gateway_chooser(device_type=NEFIT)
async with aiohttp.ClientSession() as session:
gateway = BoschGateway(
session=session,
session_type=HTTP,
host="127.0.0.1:8080",
access_token="ABCdEFGHIJHKL2MN",
password="abcdef12",
)
await gateway.initialize()
await dhw_circuits_test(gateway)
return
asyncio.run(main())