-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic_usage.py
More file actions
41 lines (29 loc) · 1.24 KB
/
Copy pathbasic_usage.py
File metadata and controls
41 lines (29 loc) · 1.24 KB
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
"""Basic usage example for Keba KeContact client."""
import asyncio
from keba_kecontact import KebaClient
async def main():
"""Example showing basic usage of KebaClient."""
charger_ip = "192.168.1.100"
async with KebaClient(charger_ip) as client:
print(f"Connected to charger at {charger_ip}")
report1 = await client.get_report_1()
print(f"\nProduct Info: {report1}")
print(f" Product: {report1.product}")
print(f" Serial: {report1.serial}")
print(f" Firmware: {report1.firmware}")
report2 = await client.get_report_2()
print(f"\nCurrent State: {report2}")
print(f" State: {report2.state}")
print(f" Plug: {report2.plug}")
print(f" Max Current: {report2.max_curr} mA")
report3 = await client.get_report_3()
print(f"\nPower Measurements: {report3}")
print(f" Power: {report3.power_kw} kW")
print(f" Energy (session): {report3.energy_present_kwh} kWh")
print(f" Energy (total): {report3.energy_total_kwh} kWh")
await client.set_current(16000)
print("\nSet charging current to 16A")
await client.enable()
print("Enabled charging")
if __name__ == "__main__":
asyncio.run(main())