Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

entity_id still relevant in the integration configuration? #117

Closed
lostcontrol opened this issue Mar 8, 2024 · 7 comments
Closed

entity_id still relevant in the integration configuration? #117

lostcontrol opened this issue Mar 8, 2024 · 7 comments

Comments

@lostcontrol
Copy link

Since v4, entity_id must be passed to presence_simulation.start and presence_simulation.stop. But there is still a field for this in the configuration page of the integration:

image

Is this still relevant? I removed my previous entry but I'm not sure if it is needed or not.

@slashback100
Copy link
Owner

I fixed the fact that the entity_id is mandatory yesterday in v4.3 in #116, it should not be.
So yes, it is relevant. You can configure the default entities in the configuration, which are the entities that will be simulated when you just turn on the switch, or when you use the start service without the entity_id parameter filled.

@lostcontrol
Copy link
Author

Would be nice if you could release 4.3. I can't get 4.2 to work properly because of entity id being None (I set it every where though). Thank you

@slashback100
Copy link
Owner

slashback100 commented Mar 8, 2024

@lostcontrol
Copy link
Author

v4.3 is already released https://github.com/slashback100/presence_simulation/releases/tag/v4.3

It was not available on HACS when I last checked. It's ok now, I updated. Still I get the same error:

Enregistreur: homeassistant.components.automation.simulation_activation_presence
Source: components/automation/__init__.py:666
intégration: Automatisation (documentation, problèmes)
S'est produit pour la première fois: 17:42:18 (1 occurrences)
Dernier enregistrement: 17:42:18

While executing automation automation.simulation_activation_presence
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 666, in async_trigger
    return await self.action_script.async_run(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1600, in async_run
    return await asyncio.shield(run.async_run())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 435, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 487, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 512, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 485, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 723, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 685, in _async_run_long_action
    return long_task.result()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2319, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2356, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/presence_simulation/__init__.py", line 111, in handle_presence_simulation
    entity = hass.data[DOMAIN][SWITCH_PLATFORM][switch_id]
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: None

I'm using a group as entity_id.

@lostcontrol
Copy link
Author

I'm calling it like this:

alias: "[Alarme] Activation de la simulation de présence"
description: ""
trigger:
  - platform: state
    entity_id: switch.alarme_commutation
    from: "off"
    to: "on"
    for:
      hours: 0
      minutes: 5
      seconds: 0
condition: []
action:
  - service: presence_simulation.start
    data: {}
mode: single

@lostcontrol
Copy link
Author

Ok, got it working. I misunderstood the changes you made in v4. Keeping things backward compatible would have been nice. But the migration is ready once you get it 😉

@slashback100
Copy link
Owner

FYI I just commit a change to adapt the behaviour: If only one presence simulation is configured and if you don't give any switch_id, the only existing switch will be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants