I have a couple of AD apps to control my heavy energy consumers. For thermostats I made rules and changes the target temperature via a service call like this:
thermostat = self.get_entity(self.entity) # entity is the name of the thermostate
thermostat.call_service("set_temperature", temperature = self.getTargetTemp(shallBeOn))
To my problem
Now I would like to do the same thing for the Garo Wall box which is an charger for my car (GitHub - sockless-coding/garo_wallbox: Garo wallbox - Home Assistant Component). It has a service defined to enable/disable charging. I have tried this:
charger = self.get_entity("sensor.charger")
charger.call_service("set_mode", entity_id = "sensor.laddbox", mode = "Off")
and get this in the error log:
2024-09-20 08:59:27.008320 WARNING BilladdareV3: ------------------------------------------------------------
2024-09-20 09:00:03.583623 WARNING BilladdareV3: ------------------------------------------------------------
2024-09-20 09:00:03.585160 WARNING BilladdareV3: Unexpected error in worker for App BilladdareV3:
2024-09-20 09:00:03.587683 WARNING BilladdareV3: Worker Ags: {'id': 'b9ed65a25f684d25a73486c508630190', 'name': 'BilladdareV3', 'objectid': 'a4244cb9eb574c8fb50a6530456552bc', 'type': 'scheduler', 'function': <bound method CarChargerV3.HandlePrice of <ChargerV3.CarChargerV3 object at 0xffffad7eb450>>, 'pin_app': True, 'pin_thread': 6, 'kwargs': {'__thread_id': 'thread-6'}}
2024-09-20 09:00:03.588059 WARNING BilladdareV3: ------------------------------------------------------------
2024-09-20 09:00:03.590002 WARNING BilladdareV3: Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/appdaemon/threading.py", line 1022, in worker
funcref(self.AD.sched.sanitize_timer_kwargs(app, args["kwargs"]))
File "/config/apps/energy/ChargerV3.py", line 65, in HandlePrice
laddbox.call_service("set_mode", entity_id = "sensor.laddbox", mode = "Off")
File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 231, in inner_sync_wrapper
f = run_coroutine_threadsafe(self, coro(self, *args, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 313, in run_coroutine_threadsafe
result = future.result(self.AD.internal_function_timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/concurrent/futures/_base.py", line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/usr/lib/python3.11/site-packages/appdaemon/entity.py", line 363, in call_service
return await self.AD.services.call_service(namespace, domain, service, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/appdaemon/services.py", line 166, in call_service
raise DomainException(f"Unknown domain ({namespace}/{domain}) in call_service from {name}")
appdaemon.exceptions.DomainException: Unknown domain (default/sensor) in call_service from BilladdareV3
The parameter in mode
can be wrong. The documentation of the integration says On/Off in some places and ALWAYS_ON/ALWAYS_OFF in other places but that is not the main problem right now.
To me it looks like I call the service on the wrong entity.
Anyone who can see what is wrong?