Skip to content

[Library Bug] TypeError: 'Service' object is not callable #243

@b0bcarlson

Description

@b0bcarlson

Describe the bug
This is a new bug as of v6.0.0, this code worked in v5.0.3
I have checked the documentation and don't see anything that changed regarding this

To Reproduce
Minimum reproduceable example:

import os

from homeassistant_api import Client

HOME_ASSISTANT_URL = "https://" + os.environ["HOME_ASSISTANT_HOST"] + "/api"
HOME_ASSISTANT_TOKEN = os.environ["HOME_ASSISTANT_TOKEN"]

client = Client(HOME_ASSISTANT_URL, HOME_ASSISTANT_TOKEN)

if __name__ == "__main__":
    light = client.get_domain("light")
    light.turn_on(entity_id="light.habitat_strip_socket_2")

Stack trace:

Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2024.2.3\plugins\python-ce\helpers\pydev\pydevd.py", line 1570, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2024.2.3\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
    ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "minimumreproduceable.py", line 12, in <module>
    light.turn_on(entity_id="light.habitat_strip_socket_2")
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'Service' object is not callable

Screenshots
Debugger shows that turn_on is a valid service

Image

Desktop (please complete the following information):

  • Python 3.14 (tried in Docker and natively on Windows)
  • HomeAssistantAPI Version: [e.g. 0.0.3] 6.0.0

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions