slashback100 / presence_simulation

Home Assistant Presence Simulation
423 stars 22 forks source link

Unknown error following update to v4+ (currently on v4.2) #116

Closed Wright55 closed 4 months ago

Wright55 commented 4 months ago

Have several automations using the start/stop service. Works regularly but since update failed. Tested using Developer Tools comes up unknown error.

The service dev tool allows you to call any available service in Home Assistant.

Service Presence Simulation: Presence simulation start Start the presence simulation

The list of entities to use by the presence simulation to override the list configured in the component Service data 1

Failed to call service presence_simulation.start. Unknown error

Enabled Debug logging

Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/presence_simulation/init.py:111 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 10:14:07 (4 occurrences) Last logged: 10:22:50

[140223109604160] Error handling message: Unknown error (unknown_error) Graham from 192.168.2.117 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0) [140221880514240] Error handling message: Unknown error (unknown_error) Graham from 192.168.2.116 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Home Assistant/2024.2 (io.robbie.HomeAssistant; build:2024.561; iPadOS 17.4.0) Mobile/HomeAssistant, like Safari) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response await func(hass, connection, msg) File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 795, in handle_execute_script script_result = await script_obj.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 2279, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2316, 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

Last worked prior to v4.0
slashback100 commented 4 months ago

The service call takes now a mandatory parameter which is switch_id, that must contain the entity id of the presence simulation switch (switch.presence_simulation by default). Could you try and let me know please? I will update de Readme accordingly to make it more clear.

Wright55 commented 4 months ago

Added to automationswitch_id:  - switch.presence_simulationStill unknown errorCan you provide an example so I can see where I am going wrong.ThanksGrahamOn 6 Mar 2024, at 17:34, Graham Wright @.> wrote:I have this which still Sent from my iPad ProOn 6 Mar 2024, at 11:49, slashback100 @.> wrote: The service call takes now a mandatory parameter which is switch_id, that must contain the entity id of the presence simulation switch (switch.presence_simulation by default). Could you try and let me know please? I will update de Readme accordingly to make it more clear.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

slashback100 commented 4 months ago

You should not create a list under the switch_id but a single value (the example is wrong, it is fixed in future release). Example:

service: presence_simulation.start
data:
  switch_id: switch.presence_simulation
  entity_id:
    - light.l_bar

[EDIT] entity_id seems to be mandatory, I will work on that

slashback100 commented 4 months ago

New release with the fix : https://github.com/slashback100/presence_simulation/releases/tag/v4.3

Wright55 commented 4 months ago

Thank you, all okay now.