-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenergy_management_read.py
executable file
·45 lines (33 loc) · 1.07 KB
/
energy_management_read.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
#!/usr/bin/env python
import asyncio
import chipstart
import click
import pprint
import chip.clusters as Clusters
from chip.ChipStack import ChipStack
async def commission_impl(devCtrl, node_id):
await devCtrl.CommissionOnNetwork(node_id, 20202021)
devCtrl.Shutdown()
async def read_heater_types_impl(devCtrl, node_id):
attr = await devCtrl.ReadAttribute(
node_id, [Clusters.WaterHeaterManagement.Attributes.HeaterTypes]
)
pprint.pprint(attr)
devCtrl.Shutdown()
@chipstart.main.command()
@click.pass_context
@click.option("--node-id", "-n", default=1234, show_default=True)
def commission(ctx, node_id):
asyncio.get_event_loop().run_until_complete(
commission_impl(ctx.obj["devCtrl"], node_id)
)
@chipstart.main.command()
@click.pass_context
@click.option("--node-id", "-n", default=1234, show_default=True)
def read_heater_types(ctx, node_id):
asyncio.get_event_loop().run_until_complete(
read_heater_types_impl(ctx.obj["devCtrl"], node_id)
)
if __name__ == "__main__":
chipstart.main()
ChipStack.Shutdown()