snarky-snark / home-assistant-variables

A custom Home Assistant component for declaring and setting generic variable entities dynamically.
Apache License 2.0
278 stars 16 forks source link

Appdaemon doesn't recognize the var.set service #36

Closed marclefevre closed 4 years ago

marclefevre commented 4 years ago

I am using appdaemon to set some variables using the var component and I can't get it to work.

If I look in the service list in the HA GUI, I see var.set and var.update. However, when I call call_service() with a service parameter of var.set, I get

2020-07-29 20:30:32.030875 WARNING sun: Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/appdaemon/threading.py", line 900, in worker
    funcref(
  File "/home/homeassistant/.appdaemon/apps/sun.py", line 28, in sunset
    self.call_service('var.set', entity_id='variable.sunset', value=localtime)
  File "/usr/local/lib/python3.8/dist-packages/appdaemon/utils.py", line 195, in inner_sync_wrapper
    f = run_coroutine_threadsafe(self, coro(self, *args, **kwargs))
  File "/usr/local/lib/python3.8/dist-packages/appdaemon/utils.py", line 299, in run_coroutine_threadsafe
    result = future.result(self.AD.internal_function_timeout)
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 439, in result
    return self.__get_result()
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.8/dist-packages/appdaemon/adapi.py", line 1568, in call_service
    self._check_service(service)
  File "/usr/local/lib/python3.8/dist-packages/appdaemon/adapi.py", line 1449, in _check_service
    raise ValueError("Invalid Service Name: {}".format(service))
ValueError: Invalid Service Name: var.set

Has anyone verified that appdaemon works with this component?

snarky-snark commented 4 years ago

Try

self.call_service('var/set', ... 
marclefevre commented 4 years ago

That worked.  I saw that syntax in your documentation but I thought it was a typo.  Until now, I had not seen a service call with that service definition. Thanks for the help.