Skip to content

Commit

Permalink
Fix #116
Browse files Browse the repository at this point in the history
  • Loading branch information
slashback100 committed Mar 7, 2024
1 parent 3dbb7fe commit 69f64c6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
18 changes: 11 additions & 7 deletions custom_components/presence_simulation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,17 @@ async def handle_presence_simulation(call, restart=False, switch_id=None):
internal = call.data.get("internal", False) and call.data.get("internal")
entity = hass.data[DOMAIN][SWITCH_PLATFORM][switch_id]
if not is_running(switch_id) and not internal:
if isinstance(call.data.get("entity_id"), list):
await entity.set_entities(call.data.get("entity_id"))
else:
await entity.set_entities([call.data.get("entity_id")])
await entity.set_delta(call.data.get("delta", 7))
await entity.set_restore(call.data.get("restore_states", False))
await entity.set_random(call.data.get("random", 0))
if "entity_id" in call.data:
if isinstance(call.data.get("entity_id"), list):
await entity.set_entities(call.data.get("entity_id"))
else:
await entity.set_entities([call.data.get("entity_id")])
if "delta" in call.data:
await entity.set_delta(call.data.get("delta", 7))
if "restore_states" in call.data:
await entity.set_restore(call.data.get("restore_states", False))
if "random" in call.data:
await entity.set_random(call.data.get("random", 0))
else: #if we are it is a call from the toggle service or from the turn_on action of the switch entity
# or this is a restart and the simulation was launched after a restart of HA
#get the switch entity
Expand Down
2 changes: 1 addition & 1 deletion custom_components/presence_simulation/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"documentation": "https://github.com/slashback100/presence_simulation",
"iot_class": "local_polling",
"issue_tracker": "https://github.com/slashback100/presence_simulation/issues",
"version": "4.2"
"version": "4.3"
}

0 comments on commit 69f64c6

Please sign in to comment.