slashback100 / presence_simulation

Home Assistant Presence Simulation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Possible to add multiple switch entities?

mngsps opened this issue · comments

commented

Hi @slashback100 ,
at first, thank you so much for this great work!
One question: Is or would it be possible to add and configure multiple presence simulation switches (e.g. to have separate ones for lights, covers or different floors/rooms)? I tried, but the second one will not create a switch entity in my case...
All the best and kind regards
Benedikt

It has been asked in #27.
I can take a look to see how to do that, but it seems like an important architecture change

Just created a branch manage_multiple_switches with this feature. Don't know if you can test it, in particular the migration from old to new version

Hi @slashback100, hopefully you're still following up on this:

I've now activated the manage_multiple_switches variant on my prod environment (Because I really want this feature). My specific setup is:

  • Presence Simulation Lights -> Couple of lights
  • Presence Simulation Covers -> Just 2 covers (I don't want these to trigger, read: wake the kids, while we're not actually gone)

Now I've gone ahead and deleted the old presence simulation (I'll test migration later, but I want to test with clean slate first), then installed the manage_multiple_switches branch.

What I saw:

  1. The second presence simulation switch was unavailable until a restart
  2. When activating just the "Lights" PS, the attributes show next event being closing cover_0001:

This actually is applied: the covers were closed even though it was disabled for the "Covers" variant.

Edit: Lights are fully ignored, even when all PS instances are enabled. It seems like only the last added presence simulation is looked at.

Yes, still working on it but can't figure out why the entities are unavailable...

Got this problem fixed. Working now on the mix up between switches

There you go. I fixed the issue, which included a refactoring of the restore after restart feature. My tests give good results.
Everything is in branch manage_multiple_switches, I created a PR
I just need to test the migration from a v3 to this v4 still.

I tested the migration. It works, but since the logic changes, the id of the switch entity changes --> a new entity will be created (switch.presence_simulation_2) and the previous one will be unavailable.
I don't see any solution, it is kind of breaking change.
I will merge on the main, but won't do any release for now, I will be on holiday so don't have time for fixing issues.

FYI I managed to avoid the breaking change in the migration