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

execute_chore giving Attribute hass is None for <entity unknown.unknown=unknown> #309

Open
derobert opened this issue Apr 22, 2024 · 0 comments

Comments

@derobert
Copy link

derobert commented Apr 22, 2024

Unless all relevant information is provided, I can't help you

Describe the bug
When trying to execute a chore via Home Assistant, getting Attribute hass is None for .

Note the chore actually executed.

192.168.65.164 - - [22/Apr/2024:17:47:43 -0400] "POST /api/chores/13/execute HTTP/1.1" 200 498 "-" "python-requests/2.31.0"

Expected behavior
A clear and concise description of what you expected to happen.

To Reproduce
Script YAML:

service: grocy.execute_chore
metadata: {}
data:
  chore_id: "13"
  done_by: "2"

General information to help debugging:

What sensors do you have enabled? Are they working and/or what state are they in? Do you have the corresponding functions enabled in Grocy?

Only have overdue chores enabled (and its working)

What is your installed versions of Home Assistant, Grocy and this integration?
HA: 2024.4.3 (HA OS install, x86-64 VM)
Grocy: 4.1.0
Integration: v4.11.1

How do you have Grocy installed? Add-on or external?
External

Have you added debugging to the log, and what does the log say?

2024-04-22 17:47:43.813 ERROR (MainThread) [homeassistant.components.script.defrost_chest_freezer] Defrost Chest Freezer: Error executing script. Unexpected error for call_service at pos 5: Attribute hass is None for <entity unknown.unknown=unknown>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 507, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 736, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 699, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2543, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2580, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/grocy/services.py", line 170, in async_call_grocy_service
    await async_execute_chore_service(hass, coordinator, service_data)
  File "/config/custom_components/grocy/services.py", line 264, in async_execute_chore_service
    await _async_force_update_entity(coordinator, ATTR_CHORES)
  File "/config/custom_components/grocy/services.py", line 368, in _async_force_update_entity
    await entity.async_update_ha_state(force_refresh=True)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 941, in async_update_ha_state
    raise RuntimeError(f"Attribute hass is None for {self}")
RuntimeError: Attribute hass is None for <entity unknown.unknown=unknown>
2024-04-22 17:47:43.839 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140549040846784] Attribute hass is None for <entity unknown.unknown=unknown>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2543, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2580, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 672, in _service_handler
    response = await self._async_start_run(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 630, in _async_start_run
    script_result = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 661, in _async_run
    return await self.script.async_run(script_vars, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1713, in async_run
    return await asyncio.shield(create_eager_task(run.async_run()))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 457, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 509, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 539, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 507, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 736, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 699, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2543, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2580, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/grocy/services.py", line 170, in async_call_grocy_service
    await async_execute_chore_service(hass, coordinator, service_data)
  File "/config/custom_components/grocy/services.py", line 264, in async_execute_chore_service
    await _async_force_update_entity(coordinator, ATTR_CHORES)
  File "/config/custom_components/grocy/services.py", line 368, in _async_force_update_entity
    await entity.async_update_ha_state(force_refresh=True)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 941, in async_update_ha_state
    raise RuntimeError(f"Attribute hass is None for {self}")
RuntimeError: Attribute hass is None for <entity unknown.unknown=unknown>

JSON service data (if related to using a service)
(see above)

Additional context
Add any other context about the problem here.

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

1 participant