Skip to content

Commit

Permalink
Fix tests after #1373
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Apr 16, 2024
1 parent fa07f4c commit 4f02ea2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions custom_components/sonoff/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ class XT5Action(XEventSesor):
uid = "action"

def set_state(self, params: dict):
# https://github.com/AlexxIT/SonoffLAN/issues/1373
if "switches" in params and params.get("triggerType") == 2:
self._attr_native_value = "touch"
asyncio.create_task(self.clear_state())
Expand Down
4 changes: 3 additions & 1 deletion tests/test_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -1641,7 +1641,9 @@ def test_t5():
action: XT5Action = entities[4]
assert action.state == ""

action.internal_update({"triggerType": 2})
action.internal_update(
{"switches": [{"switch": "on", "outlet": 0}], "triggerType": 2}
)
assert action.state == "touch"

action.internal_update({"slide": 2})
Expand Down

0 comments on commit 4f02ea2

Please sign in to comment.