添加测试代码
This commit is contained in:
@@ -546,6 +546,7 @@ class JackeryDataCoordinator:
|
|||||||
ts = int(time.time())
|
ts = int(time.time())
|
||||||
|
|
||||||
# 1. Poll Device Status (Type 25)
|
# 1. Poll Device Status (Type 25)
|
||||||
|
try:
|
||||||
payload_25 = {
|
payload_25 = {
|
||||||
"type": 25,
|
"type": 25,
|
||||||
"eventId": 0,
|
"eventId": 0,
|
||||||
@@ -562,8 +563,11 @@ class JackeryDataCoordinator:
|
|||||||
0,
|
0,
|
||||||
False
|
False
|
||||||
)
|
)
|
||||||
|
except Exception as e:
|
||||||
|
_LOGGER.warning(f"Error polling device status (Type 25): {e}")
|
||||||
|
|
||||||
# 2. Poll Sub-devices (Type 100) - CTs (2) and Plugs (6)
|
# 2. Poll Sub-devices (Type 100) - CTs (2) and Plugs (6)
|
||||||
|
try:
|
||||||
for dev_type in [2, 6]:
|
for dev_type in [2, 6]:
|
||||||
payload_100 = {
|
payload_100 = {
|
||||||
"type": 100,
|
"type": 100,
|
||||||
@@ -584,6 +588,8 @@ class JackeryDataCoordinator:
|
|||||||
False
|
False
|
||||||
)
|
)
|
||||||
await asyncio.sleep(0.5) # Avoid spamming too fast
|
await asyncio.sleep(0.5) # Avoid spamming too fast
|
||||||
|
except Exception as e:
|
||||||
|
_LOGGER.warning(f"Error polling sub-devices (Type 100): {e}")
|
||||||
|
|
||||||
_LOGGER.debug(f"Sent poll requests (25 & 100 [2,6]) to {action_topic}")
|
_LOGGER.debug(f"Sent poll requests (25 & 100 [2,6]) to {action_topic}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user