Skip to content

Commit

Permalink
Get updated attribute values
Browse files Browse the repository at this point in the history
Make sure to get the attribute values again after each command to get
the updated attribute cache.
  • Loading branch information
agners committed Sep 13, 2024
1 parent b02ee8e commit eba1724
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/controller/python/test/test_scripts/cluster_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,12 @@ def subUpdate(path: TypedAttributePath, transaction: SubscriptionTransaction):
sub.SetAttributeUpdateCallback(subUpdate)

try:
data = sub.GetAttributes()
req = Clusters.OnOff.Commands.On()
await devCtrl.SendCommand(nodeid=NODE_ID, endpoint=1, payload=req)

await asyncio.wait_for(event.wait(), timeout=11)

data = sub.GetAttributes()
if (data[1][Clusters.OnOff][Clusters.OnOff.Attributes.OnOff] != 1):
raise ValueError("Current On/Off state should be 1")

Expand All @@ -232,6 +232,7 @@ def subUpdate(path: TypedAttributePath, transaction: SubscriptionTransaction):

await asyncio.wait_for(event.wait(), timeout=11)

data = sub.GetAttributes()
if (data[1][Clusters.OnOff][Clusters.OnOff.Attributes.OnOff] != 0):
raise ValueError("Current On/Off state should be 0")

Expand Down

0 comments on commit eba1724

Please sign in to comment.